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,12 +1006,25 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
+ " SET DEFAULT " + " SET DEFAULT "
+ defaultvalue + "; "; + defaultvalue + "; ";
} else { } else {
DDL += sqlStatement.substring(0, begin_col // Check if default value is already quoted, no need to double quote
- action.length()) if(defaultvalue.startsWith("'") && defaultvalue.endsWith("'"))
+ " ALTER COLUMN " {
+ column DDL += sqlStatement.substring(0, begin_col
+ " SET DEFAULT '" - action.length())
+ defaultvalue + "'; "; + " ALTER COLUMN "
+ column
+ " SET DEFAULT "
+ defaultvalue + "; ";
}
else
{
DDL += sqlStatement.substring(0, begin_col
- action.length())
+ " ALTER COLUMN "
+ column
+ " SET DEFAULT '"
+ 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)