improve alter table statment

This commit is contained in:
高铁
2020-11-08 11:41:24 +08:00
parent 22d9c15931
commit 44452ff6a8
2 changed files with 24 additions and 1 deletions
@@ -1849,7 +1849,10 @@ public class MySqlExprParser extends SQLExprParser {
lexer.nextToken();
}
assignItem = new SQLAssignItem(new SQLIdentifierExpr(SINGLE_WORD_TABLE_OPTIONS[idx]), expr());
// STORAGE_POLICY
assignItem = new SQLAssignItem(
new SQLIdentifierExpr(SINGLE_WORD_TABLE_OPTIONS[idx])
, idx == 9 ? charExpr() : expr());
}
} else {
// Following may not table options. Save mark.
@@ -68,4 +68,24 @@ public class MySqlAlterTableTest54 extends TestCase {
//do nothing
}
}
public void test_6() throws Exception {
String sql = "alter table event_log storage_policy = HOT";
MySqlStatementParser parser = new MySqlStatementParser(sql);
try {
SQLAlterTableStatement stmt = (SQLAlterTableStatement) parser.parseStatementList().get(0);
fail();
} catch (Exception e) {
}
}
public void test_7() throws Exception {
String sql = "alter table event_log storage_policy = COLD";
MySqlStatementParser parser = new MySqlStatementParser(sql);
try {
SQLAlterTableStatement stmt = (SQLAlterTableStatement) parser.parseStatementList().get(0);
fail();
} catch (Exception e) {
}
}
}