[ 1746266 ] Convert fails for type only ALTER...MODIFY statement

This commit is contained in:
Heng Sin Low 2007-07-02 04:57:13 +00:00
parent 9a929f1dc6
commit 09de60d04c
2 changed files with 8 additions and 2 deletions

View File

@ -1000,8 +1000,8 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
else
{
int typeEnd = rest.indexOf(' ');
type = rest.substring(0, typeEnd).trim();
rest = rest.substring(typeEnd);
type = typeEnd > 0 ? rest.substring(0, typeEnd).trim() : rest;
rest = typeEnd > 0 ? rest.substring(typeEnd) : "";
}
if (rest.toUpperCase().indexOf(" DEFAULT ") != -1) {

View File

@ -78,6 +78,12 @@ public final class Convert_PostgreSQLTest extends TestCase{
sqe = "ALTER TABLE XX ADD COLUMN A VARCHAR(10) DEFAULT '--'";
r = convert.convert(sql);
assertEquals(sqe, r[0].trim());
//[ adempiere-Bugs-1746266 ]
sql = "ALTER TABLE someTableName MODIFY someColumnName NVARCHAR2(64)";
sqe = "insert into t_alter_column values('sometablename','someColumnName','VARCHAR(64)',null,null)";
r = convert.convert(sql);
assertEquals(sqe, r[0].trim());
}
// Convert.recoverQuotedStrings() error on strings with "<-->" - teo_sarca [ 1705768 ]