IDEMPIERE-709 All Created and Updated columns must be not null default statement_timestamp() in database / packin failed creating Created column with default SYSDATE

This commit is contained in:
Carlos Ruiz 2014-05-07 18:16:28 -05:00
parent 45ede791a4
commit e3ed5124c2
2 changed files with 6 additions and 1 deletions

View File

@ -1013,7 +1013,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
} else { } else {
rest = ""; rest = "";
} }
if (defaultvalue.equalsIgnoreCase("NULL")) { if (defaultvalue.equalsIgnoreCase("NULL") || defaultvalue.equalsIgnoreCase("statement_timestamp()")) {
DDL = sqlStatement.substring(0, begin_col DDL = sqlStatement.substring(0, begin_col
- action.length()) - action.length())
+ " ADD COLUMN " + " ADD COLUMN "

View File

@ -140,6 +140,11 @@ public final class Convert_PostgreSQLTest extends TestCase{
sqe = "INSERT INTO t_alter_column values('pp_order_nodenext','PP_Order_NodeNext_ID',null,'NULL',null)"; sqe = "INSERT INTO t_alter_column values('pp_order_nodenext','PP_Order_NodeNext_ID',null,'NULL',null)";
r = convert.convert(sql); r = convert.convert(sql);
assertEquals(sqe, r[0].trim()); assertEquals(sqe, r[0].trim());
sql = "ALTER TABLE C_InvoiceTax ADD Created DATE DEFAULT SYSDATE NOT NULL";
sqe = "ALTER TABLE C_InvoiceTax ADD COLUMN Created TIMESTAMP DEFAULT statement_timestamp() NOT NULL";
r = convert.convert(sql);
assertEquals(sqe, r[0].trim());
} }
// Convert.recoverQuotedStrings() error on strings with "<-->" - teo_sarca [ 1705768 ] // Convert.recoverQuotedStrings() error on strings with "<-->" - teo_sarca [ 1705768 ]