Skip to content

Commit

Permalink
parser: index name in 'alter table drop index' should not be empty (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zz-jason authored and zhexuany committed May 10, 2018
1 parent 86d9165 commit e09213b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -934,11 +934,11 @@ AlterTableSpec:
{
$$ = &ast.AlterTableSpec{Tp: ast.AlterTableDropPrimaryKey}
}
| "DROP" KeyOrIndex IndexName
| "DROP" KeyOrIndex Identifier
{
$$ = &ast.AlterTableSpec{
Tp: ast.AlterTableDropIndex,
Name: $3.(string),
Name: $3,
}
}
| "DROP" "FOREIGN" "KEY" Symbol
Expand Down
1 change: 1 addition & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,7 @@ func (s *testParserSuite) TestDDL(c *C) {
{"ALTER TABLE `hello-world@dev`.`User` ADD COLUMN `name` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , ALGORITHM = DEFAULT;", true},
{"ALTER TABLE `hello-world@dev`.`User` ADD COLUMN `name` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , ALGORITHM = INPLACE;", true},
{"ALTER TABLE `hello-world@dev`.`User` ADD COLUMN `name` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , ALGORITHM = COPY;", true},
{"ALTER TABLE t DROP INDEX;", false},

// For create index statement
{"CREATE INDEX idx ON t (a)", true},
Expand Down

0 comments on commit e09213b

Please sign in to comment.