diff --git a/include/sqlparser/sql_lex.l b/include/sqlparser/sql_lex.l index e8fcdc0e..ef2b097f 100644 --- a/include/sqlparser/sql_lex.l +++ b/include/sqlparser/sql_lex.l @@ -351,6 +351,9 @@ SERIALIZABLE { un_reserved_keyword(yylval, yyscanner, parser); return SERIALIZAB SESSION { un_reserved_keyword(yylval, yyscanner, parser); return SESSION; } SHARE { un_reserved_keyword(yylval, yyscanner, parser); return SHARE; } SHARED { un_reserved_keyword(yylval, yyscanner, parser); return SHARED; } +INPLACE { un_reserved_keyword(yylval, yyscanner, parser); return INPLACE; } +INSTANT { un_reserved_keyword(yylval, yyscanner, parser); return INSTANT; } +COPY { un_reserved_keyword(yylval, yyscanner, parser); return COPY; } SHUTDOWN { un_reserved_keyword(yylval, yyscanner, parser); return SHUTDOWN; } SIGNED { un_reserved_keyword(yylval, yyscanner, parser); return SIGNED; } SLAVE { un_reserved_keyword(yylval, yyscanner, parser); return SLAVE; } diff --git a/include/sqlparser/sql_parse.y b/include/sqlparser/sql_parse.y index fc89e1e8..10f2c4a3 100644 --- a/include/sqlparser/sql_parse.y +++ b/include/sqlparser/sql_parse.y @@ -297,6 +297,7 @@ extern int sql_error(YYLTYPE* yylloc, yyscan_t yyscanner, SqlParser* parser, con COMPRESSION CONNECTION CONSISTENT + COPY DAY DATA DATE @@ -335,7 +336,9 @@ extern int sql_error(YYLTYPE* yylloc, yyscan_t yyscanner, SqlParser* parser, con IDENTIFIED ISOLATION INDEXES + INPLACE INSERT_METHOD + INSTANT INVOKER JSON KEY_BLOCK_SIZE @@ -595,10 +598,15 @@ extern int sql_error(YYLTYPE* yylloc, yyscan_t yyscanner, SqlParser* parser, con ColumnDefList IndexOptionList IndexOption + DropIndexOpt IndexType TablePartitionOpt IndexTypeOpt RowFormatOpt + AlgorithmVal + AlgorighmOpt + IndexLockVal + IndexLockOpt InsertMethodOpt PartitionRange PartitionRangeList @@ -2793,6 +2801,7 @@ AllIdent: | COMPRESSION | CONNECTION | CONSISTENT + | COPY | DAY | DATA | DATE @@ -2831,8 +2840,10 @@ AllIdent: | IDENTIFIED | ISOLATION | INDEXES + | INPLACE | INSERT_METHOD | INVOKER + | INSTANT | JSON | KEY_BLOCK_SIZE | DYNAMIC_PARTITION_ATTR @@ -3724,6 +3735,31 @@ IndexOptionList: } ; +AlgorighmOpt: + ALGORITHM EqOpt AlgorithmVal { + + $$ = nullptr; + } + ; + +IndexLockOpt: + LOCK EqOpt IndexLockVal { + $$ = nullptr; + } + ; + +DropIndexOpt: + { + $$ = nullptr; + } + | AlgorighmOpt { + $$ = nullptr; + } + | IndexLockOpt { + + } + ; + IndexOption: KEY_BLOCK_SIZE EqOpt INTEGER_LIT { $$ = nullptr; @@ -3736,6 +3772,13 @@ IndexOption: op->comment = ((LiteralExpr*)$2)->_u.str_val; $$ = op; } + | AlgorighmOpt { + + $$ = nullptr; + } + | IndexLockOpt { + $$ = nullptr; + } ; IndexType: @@ -4542,6 +4585,14 @@ RowFormatOpt: DEFAULT | DYNAMIC | FIXED | COMPRESSED | REDUNDANT | COMPACT ; +AlgorithmVal: + DEFAULT | INSTANT | INPLACE | COPY + ; + +IndexLockVal: + DEFAULT | NONE | SHARED | EXCLUSIVE + ; + IgnoreTableOption: ROW_FORMAT EqOpt RowFormatOpt | STATS_PERSISTENT EqOpt NumLiteral @@ -5107,6 +5158,17 @@ AlterTableStmt: stmt->alter_specs.push_back((AlterTableSpec*)spec, parser->arena); $$ = stmt; } + | DROP INDEX IndexName ON TableName ForceOrNot DropIndexOpt + { + AlterTableStmt* stmt = new_node(AlterTableStmt); + stmt->table_name = (TableName*)$5; + AlterTableSpec* spec = new_node(AlterTableSpec); + spec->spec_type = ALTER_SPEC_DROP_INDEX; + spec->index_name = $3; + spec->force = $6; + stmt->alter_specs.push_back((AlterTableSpec*)spec, parser->arena); + $$ = stmt; + } ; AlterSpecList: