DBZ-3067 Add OR REPLACE condition for create index
This commit is contained in:
parent
009ee807ba
commit
c39192e9f2
@ -2010,6 +2010,24 @@ public void shouldParseAlterTableWithIndex() {
|
||||
assertThat(table.columns()).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@FixFor("DBZ-3067")
|
||||
public void shouldParseIndex() {
|
||||
final String ddl1 = "USE db;"
|
||||
+ "CREATE TABLE db.t1 (ID INTEGER PRIMARY KEY, val INTEGER, INDEX myidx(val));";
|
||||
final String ddl2 = "USE db;"
|
||||
+ "CREATE OR REPLACE INDEX myidx on db.t1(val);";
|
||||
parser = new MysqlDdlParserWithSimpleTestListener(listener, true);
|
||||
parser.parse(ddl1, tables);
|
||||
assertThat(tables.size()).isEqualTo(1);
|
||||
final Table table = tables.forTable(new TableId(null, "db", "t1"));
|
||||
assertThat(table).isNotNull();
|
||||
assertThat(table.columns()).hasSize(2);
|
||||
parser.parse(ddl2, tables);
|
||||
assertThat(tables.size()).isEqualTo(1);
|
||||
assertThat(((MySqlAntlrDdlParser) parser).getParsingExceptionsFromWalker().size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@FixFor("DBZ-437")
|
||||
@Test
|
||||
public void shouldParseStringSameAsKeyword() {
|
||||
|
@ -138,7 +138,7 @@ createEvent
|
||||
;
|
||||
|
||||
createIndex
|
||||
: CREATE
|
||||
: CREATE (OR REPLACE)? // OR is MariaDB-specific only
|
||||
intimeAction=(ONLINE | OFFLINE)?
|
||||
indexCategory=(UNIQUE | FULLTEXT | SPATIAL)?
|
||||
INDEX uid indexType?
|
||||
|
@ -89,6 +89,10 @@ create index index3 using hash on antlr_tokens(token(30) asc);
|
||||
create index ix_add_test_col1 on add_test(col1) comment 'test index' using btree;
|
||||
#end
|
||||
#begin
|
||||
create index myindex on t1(col1) comment 'test index' comment 'some test' using btree;
|
||||
create or replace index myindex on t1(col1) comment 'test index' comment 'some test' using btree;
|
||||
#end
|
||||
#begin
|
||||
-- Create logfile group
|
||||
-- http://dev.mysql.com/doc/refman/5.6/en/create-logfile-group.html
|
||||
CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undo.dat' INITIAL_SIZE = 10M ENGINE = InnoDB;
|
||||
|
Loading…
Reference in New Issue
Block a user