Prevent generated UPDATE statement to double quote the default value, this causes an error on postgresql

This commit is contained in:
deathmeat 2007-04-25 15:59:43 +00:00
parent 8767c779dd
commit 910fa16127
1 changed files with 19 additions and 6 deletions

View File

@ -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