提交 c433c487 authored 作者: noelgrandin's avatar noelgrandin

Apply #418: MySQL compatibility: support for ALTER TABLE tbl_name MODIFY…

Apply #418: MySQL compatibility: support for ALTER TABLE tbl_name MODIFY [COLUMN] col_name column_definition, patch from Ville Koskela.
上级 7d1b8c51
......@@ -63,6 +63,7 @@ Change Log
</li><li>Experimental off-heap memory storage engine "nioMemFS:" and "nioMemLZF:",
suggestion from Mark Addleman.
</li><li>Fix issue #438:JdbcDatabaseMetaData#getSchemas() no longer supported as of 1.3.169
</li><li>MySQL compatibility: support for ALTER TABLE tbl_name MODIFY [COLUMN] col_name column_definition, patch from Ville Koskela.
</li></ul>
<h2>Version 1.3.170 (2012-11-30)</h2>
......
......@@ -4878,6 +4878,12 @@ public class Parser {
command.setOldColumn(table.getColumn(columnName));
return command;
}
} else if (readIf("MODIFY")) {
// MySQL compatibility
readIf("COLUMN");
String columnName = readColumnIdentifier();
Column column = table.getColumn(columnName);
return parseAlterTableAlterColumnType(table, columnName, column);
} else if (readIf("ALTER")) {
readIf("COLUMN");
String columnName = readColumnIdentifier();
......
......@@ -45,6 +45,7 @@ public class TestAlter extends TestBase {
testAlterTableAlterColumn2();
testAlterTableAddColumnBefore();
testAlterTableAddColumnAfter();
testAlterTableModifyColumn();
conn.close();
deleteDb("alter");
}
......@@ -186,4 +187,10 @@ public class TestAlter extends TestBase {
stat.execute("drop table t");
}
private void testAlterTableModifyColumn() throws SQLException {
stat.execute("create table t(x int)");
stat.execute("alter table t modify column x varchar(20)");
stat.execute("insert into t values('Hello')");
stat.execute("drop table t");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论