提交 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 ...@@ -63,6 +63,7 @@ Change Log
</li><li>Experimental off-heap memory storage engine "nioMemFS:" and "nioMemLZF:", </li><li>Experimental off-heap memory storage engine "nioMemFS:" and "nioMemLZF:",
suggestion from Mark Addleman. suggestion from Mark Addleman.
</li><li>Fix issue #438:JdbcDatabaseMetaData#getSchemas() no longer supported as of 1.3.169 </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> </li></ul>
<h2>Version 1.3.170 (2012-11-30)</h2> <h2>Version 1.3.170 (2012-11-30)</h2>
......
...@@ -4878,6 +4878,12 @@ public class Parser { ...@@ -4878,6 +4878,12 @@ public class Parser {
command.setOldColumn(table.getColumn(columnName)); command.setOldColumn(table.getColumn(columnName));
return command; 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")) { } else if (readIf("ALTER")) {
readIf("COLUMN"); readIf("COLUMN");
String columnName = readColumnIdentifier(); String columnName = readColumnIdentifier();
......
...@@ -45,6 +45,7 @@ public class TestAlter extends TestBase { ...@@ -45,6 +45,7 @@ public class TestAlter extends TestBase {
testAlterTableAlterColumn2(); testAlterTableAlterColumn2();
testAlterTableAddColumnBefore(); testAlterTableAddColumnBefore();
testAlterTableAddColumnAfter(); testAlterTableAddColumnAfter();
testAlterTableModifyColumn();
conn.close(); conn.close();
deleteDb("alter"); deleteDb("alter");
} }
...@@ -186,4 +187,10 @@ public class TestAlter extends TestBase { ...@@ -186,4 +187,10 @@ public class TestAlter extends TestBase {
stat.execute("drop table t"); 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论