Skip to content

Commit

Permalink
parser: create index support LOCK syntax (#5851) (#5853)
Browse files Browse the repository at this point in the history
  • Loading branch information
winkyao authored and coocood committed Feb 11, 2018
1 parent fafc39d commit 3a6cddd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,10 @@ AlterTableSpec:
}
}

LockClauseOpt:
{}
| LockClause {}

LockClause:
"LOCK" eq "NONE"
{
Expand Down Expand Up @@ -1448,7 +1452,7 @@ NumLiteral:


CreateIndexStmt:
"CREATE" CreateIndexStmtUnique "INDEX" Identifier IndexTypeOpt "ON" TableName '(' IndexColNameList ')' IndexOptionList
"CREATE" CreateIndexStmtUnique "INDEX" Identifier IndexTypeOpt "ON" TableName '(' IndexColNameList ')' IndexOptionList LockClauseOpt
{
var indexOption *ast.IndexOption
if $11 != nil {
Expand Down
1 change: 1 addition & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,7 @@ func (s *testParserSuite) TestDDL(c *C) {
{"CREATE INDEX idx ON t (a) USING HASH", true},
{"CREATE INDEX idx ON t (a) COMMENT 'foo'", true},
{"CREATE INDEX idx ON t (a) USING HASH COMMENT 'foo'", true},
{"CREATE INDEX idx ON t (a) LOCK=NONE", true},
{"CREATE INDEX idx USING BTREE ON t (a) USING HASH COMMENT 'foo'", true},
{"CREATE INDEX idx USING BTREE ON t (a)", true},

Expand Down

0 comments on commit 3a6cddd

Please sign in to comment.