* [ 1707611 ] Column synchronization for mandatory columns doesn't work

This commit is contained in:
Heng Sin Low 2007-04-26 01:05:25 +00:00
parent 17126b8dd1
commit 7cd703ce8e
2 changed files with 25 additions and 9 deletions

View File

@ -1009,10 +1009,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
// 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
DDL += sqlStatement.substring(0, begin_col
- action.length())
+ " ALTER COLUMN "
+ column
+ " SET DEFAULT "
+ defaultvalue + "; ";
}
@ -1022,16 +1022,26 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
- action.length())
+ " ALTER COLUMN "
+ column
+ " SET DEFAULT '"
+ defaultvalue + "'; ";
+ " SET DEFAULT '"
+ defaultvalue + "'; ";
}
}
if (rest != null && rest.indexOf(" NOT NULL ") == 0)
DDL += sqlStatement.substring(0, begin_col)
+ " ALTER COLUMN " + column + " SET " + rest
if (rest != null && rest.toUpperCase().indexOf("NOT NULL") >= 0)
DDL += sqlStatement.substring(0, begin_col - action.length())
+ " ALTER COLUMN " + column + " SET " + rest.trim()
+ ";";
// return DDL;
}
else if ( rest.toUpperCase().indexOf("NOT NULL") >= 0 ) {
DDL += sqlStatement.substring(0, begin_col - action.length())
+ " ALTER COLUMN " + column + " SET " + rest.trim()
+ ";";
}
else if ( rest.toUpperCase().indexOf("NULL") >= 0) {
DDL += sqlStatement.substring(0, begin_col - action.length())
+ " ALTER COLUMN " + column + " SET " + rest.trim()
+ ";";
}
// System.out.println("DDL" + DDL);
}

View File

@ -28,6 +28,12 @@ public final class Convert_PostgreSQLTest {
String sqe;
String[] r;
//[ 1707611 ] Column synchronization for mandatory columns doesn't work
sql = "ALTER TABLE Test MODIFY T_Integer NUMBER(10) NOT NULL";
sqe = "ALTER TABLE Test ALTER COLUMN T_Integer TYPE NUMERIC(10); ALTER TABLE Test ALTER COLUMN T_Integer SET NOT NULL;";
r = convert.convert(sql);
verify(sql, r, sqe);
// Convert.recoverQuotedStrings() error on strings with "<-->" - teo_sarca [ 1705768 ]
// http://sourceforge.net/tracker/index.php?func=detail&aid=1705768&group_id=176962&atid=879332
sql = "SELECT 'Partner <--> Organization', 's2\\$', 's3' FROM DUAL";