* [ 1707611 ] Column synchronization for mandatory columns doesn't work
This commit is contained in:
parent
17126b8dd1
commit
7cd703ce8e
|
@ -1009,10 +1009,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
||||||
// Check if default value is already quoted, no need to double quote
|
// Check if default value is already quoted, no need to double quote
|
||||||
if(defaultvalue.startsWith("'") && defaultvalue.endsWith("'"))
|
if(defaultvalue.startsWith("'") && defaultvalue.endsWith("'"))
|
||||||
{
|
{
|
||||||
DDL += sqlStatement.substring(0, begin_col
|
DDL += sqlStatement.substring(0, begin_col
|
||||||
- action.length())
|
- action.length())
|
||||||
+ " ALTER COLUMN "
|
+ " ALTER COLUMN "
|
||||||
+ column
|
+ column
|
||||||
+ " SET DEFAULT "
|
+ " SET DEFAULT "
|
||||||
+ defaultvalue + "; ";
|
+ defaultvalue + "; ";
|
||||||
}
|
}
|
||||||
|
@ -1022,16 +1022,26 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
||||||
- action.length())
|
- action.length())
|
||||||
+ " ALTER COLUMN "
|
+ " ALTER COLUMN "
|
||||||
+ column
|
+ column
|
||||||
+ " SET DEFAULT '"
|
+ " SET DEFAULT '"
|
||||||
+ defaultvalue + "'; ";
|
+ defaultvalue + "'; ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rest != null && rest.indexOf(" NOT NULL ") == 0)
|
if (rest != null && rest.toUpperCase().indexOf("NOT NULL") >= 0)
|
||||||
DDL += sqlStatement.substring(0, begin_col)
|
DDL += sqlStatement.substring(0, begin_col - action.length())
|
||||||
+ " ALTER COLUMN " + column + " SET " + rest
|
+ " ALTER COLUMN " + column + " SET " + rest.trim()
|
||||||
+ ";";
|
+ ";";
|
||||||
// return DDL;
|
// 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);
|
// System.out.println("DDL" + DDL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,12 @@ public final class Convert_PostgreSQLTest {
|
||||||
String sqe;
|
String sqe;
|
||||||
String[] r;
|
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 ]
|
// Convert.recoverQuotedStrings() error on strings with "<-->" - teo_sarca [ 1705768 ]
|
||||||
// http://sourceforge.net/tracker/index.php?func=detail&aid=1705768&group_id=176962&atid=879332
|
// http://sourceforge.net/tracker/index.php?func=detail&aid=1705768&group_id=176962&atid=879332
|
||||||
sql = "SELECT 'Partner <--> Organization', 's2\\$', 's3' FROM DUAL";
|
sql = "SELECT 'Partner <--> Organization', 's2\\$', 's3' FROM DUAL";
|
||||||
|
|
Loading…
Reference in New Issue