Skip to content

Commit

Permalink
parser: create index support LOCK syntax (pingcap#5851)
Browse files Browse the repository at this point in the history
  • Loading branch information
winkyao authored and jackysp committed Feb 11, 2018
1 parent a63601a commit f3c99cd
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
@@ -1012,6 +1012,10 @@ AlterTableSpec:
}
}

LockClauseOpt:
{}
| LockClause {}

LockClause:
"LOCK" eq "NONE"
{
@@ -1533,7 +1537,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 {
1 change: 1 addition & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
@@ -1548,6 +1548,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},

0 comments on commit f3c99cd

Please sign in to comment.