IDEMPIERE-5009 Syntax error while installing PackIn (native postgres) (#946)
* IDEMPIERE-5009 Syntax error while installing PackIn (native postgres) * IDEMPIERE-5009 Syntax error while installing PackIn (native postgres) Incorporate patch from Carlos
This commit is contained in:
parent
85f640ffdf
commit
f863f9b652
|
@ -1480,6 +1480,7 @@ public class DB_Oracle implements AdempiereDatabase
|
|||
StringBuilder sqlDefault = new StringBuilder(sqlBase)
|
||||
.append(" ").append(column.getSQLDataType());
|
||||
String defaultValue = column.getDefaultValue();
|
||||
String originalDefaultValue = defaultValue;
|
||||
if (defaultValue != null
|
||||
&& defaultValue.length() > 0
|
||||
&& defaultValue.indexOf('@') == -1 // no variables
|
||||
|
@ -1512,6 +1513,17 @@ public class DB_Oracle implements AdempiereDatabase
|
|||
// Null Values
|
||||
if (column.isMandatory() && defaultValue != null && defaultValue.length() > 0)
|
||||
{
|
||||
if (!(DisplayType.isText(column.getAD_Reference_ID())
|
||||
|| DisplayType.isList(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.YesNo
|
||||
|| column.getAD_Reference_ID() == DisplayType.Payment
|
||||
// Two special columns: Defined as Table but DB Type is String
|
||||
|| column.getColumnName().equals("EntityType") || column.getColumnName().equals("AD_Language")
|
||||
|| (column.getAD_Reference_ID() == DisplayType.Button &&
|
||||
!(column.getColumnName().endsWith("_ID")))))
|
||||
{
|
||||
defaultValue = originalDefaultValue;
|
||||
}
|
||||
StringBuilder sqlSet = new StringBuilder("UPDATE ")
|
||||
.append(table.getTableName())
|
||||
.append(" SET ").append(column.getColumnName())
|
||||
|
|
|
@ -1390,6 +1390,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
|||
|
||||
// Default
|
||||
String defaultValue = column.getDefaultValue();
|
||||
String originalDefaultValue = defaultValue;
|
||||
if (defaultValue != null
|
||||
&& defaultValue.length() > 0
|
||||
&& defaultValue.indexOf('@') == -1 // no variables
|
||||
|
@ -1398,12 +1399,13 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
|||
if (defaultValue.equalsIgnoreCase("sysdate"))
|
||||
defaultValue = "getDate()";
|
||||
if (!defaultValue.startsWith("'") && !defaultValue.endsWith("'"))
|
||||
defaultValue = "'" + defaultValue + "'";
|
||||
defaultValue = DB.TO_STRING(defaultValue);
|
||||
sql.append(defaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
sql.append("null");
|
||||
defaultValue = null;
|
||||
}
|
||||
sql.append(")");
|
||||
|
||||
|
@ -1411,6 +1413,19 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
|||
// Null Values
|
||||
if (column.isMandatory() && defaultValue != null && defaultValue.length() > 0)
|
||||
{
|
||||
if (!(DisplayType.isText(column.getAD_Reference_ID())
|
||||
|| DisplayType.isList(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.YesNo
|
||||
|| column.getAD_Reference_ID() == DisplayType.Payment
|
||||
// Two special columns: Defined as Table but DB Type is String
|
||||
|| column.getColumnName().equals("EntityType") || column.getColumnName().equals("AD_Language")
|
||||
|| (column.getAD_Reference_ID() == DisplayType.Button &&
|
||||
!(column.getColumnName().endsWith("_ID")))))
|
||||
{
|
||||
defaultValue = originalDefaultValue;
|
||||
if (defaultValue.equalsIgnoreCase("sysdate"))
|
||||
defaultValue = "getDate()";
|
||||
}
|
||||
StringBuilder sqlSet = new StringBuilder("UPDATE ")
|
||||
.append(table.getTableName())
|
||||
.append(" SET ").append(quoteColumnName(column.getColumnName()))
|
||||
|
|
Loading…
Reference in New Issue