Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: create index support LOCK syntax #5851

Merged
merged 2 commits into from
Feb 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,10 @@ AlterTableSpec:
}
}

LockClauseOpt:
{}
| LockClause {}

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

Expand Down