Prevent generated UPDATE statement to double quote the default value, this causes an error on postgresql
This commit is contained in:
parent
8767c779dd
commit
910fa16127
|
@ -1006,6 +1006,18 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
||||||
+ " SET DEFAULT "
|
+ " SET DEFAULT "
|
||||||
+ defaultvalue + "; ";
|
+ defaultvalue + "; ";
|
||||||
} else {
|
} else {
|
||||||
|
// Check if default value is already quoted, no need to double quote
|
||||||
|
if(defaultvalue.startsWith("'") && defaultvalue.endsWith("'"))
|
||||||
|
{
|
||||||
|
DDL += sqlStatement.substring(0, begin_col
|
||||||
|
- action.length())
|
||||||
|
+ " ALTER COLUMN "
|
||||||
|
+ column
|
||||||
|
+ " SET DEFAULT "
|
||||||
|
+ defaultvalue + "; ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DDL += sqlStatement.substring(0, begin_col
|
DDL += sqlStatement.substring(0, begin_col
|
||||||
- action.length())
|
- action.length())
|
||||||
+ " ALTER COLUMN "
|
+ " ALTER COLUMN "
|
||||||
|
@ -1013,6 +1025,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
||||||
+ " SET DEFAULT '"
|
+ " SET DEFAULT '"
|
||||||
+ defaultvalue + "'; ";
|
+ defaultvalue + "'; ";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (rest != null && rest.indexOf(" NOT NULL ") == 0)
|
if (rest != null && rest.indexOf(" NOT NULL ") == 0)
|
||||||
DDL += sqlStatement.substring(0, begin_col)
|
DDL += sqlStatement.substring(0, begin_col)
|
||||||
+ " ALTER COLUMN " + column + " SET " + rest
|
+ " ALTER COLUMN " + column + " SET " + rest
|
||||||
|
|
Loading…
Reference in New Issue