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 "
+ defaultvalue + "; ";
} else {
DDL += sqlStatement.substring(0, begin_col
- action.length())
+ " ALTER COLUMN "
+ column
+ " SET DEFAULT '"
+ defaultvalue + "'; ";
// 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
- action.length())
+ " ALTER COLUMN "
+ column
+ " SET DEFAULT '"
+ defaultvalue + "'; ";
}
}
if (rest != null && rest.indexOf(" NOT NULL ") == 0)
DDL += sqlStatement.substring(0, begin_col)