Skip to content

Commit 3a6cddd

Browse files
winkyaocoocood
authored andcommitted
parser: create index support LOCK syntax (#5851) (#5853)
1 parent fafc39d commit 3a6cddd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

parser/parser.y

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,10 @@ AlterTableSpec:
937937
}
938938
}
939939

940+
LockClauseOpt:
941+
{}
942+
| LockClause {}
943+
940944
LockClause:
941945
"LOCK" eq "NONE"
942946
{
@@ -1448,7 +1452,7 @@ NumLiteral:
14481452

14491453

14501454
CreateIndexStmt:
1451-
"CREATE" CreateIndexStmtUnique "INDEX" Identifier IndexTypeOpt "ON" TableName '(' IndexColNameList ')' IndexOptionList
1455+
"CREATE" CreateIndexStmtUnique "INDEX" Identifier IndexTypeOpt "ON" TableName '(' IndexColNameList ')' IndexOptionList LockClauseOpt
14521456
{
14531457
var indexOption *ast.IndexOption
14541458
if $11 != nil {

parser/parser_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,7 @@ func (s *testParserSuite) TestDDL(c *C) {
14741474
{"CREATE INDEX idx ON t (a) USING HASH", true},
14751475
{"CREATE INDEX idx ON t (a) COMMENT 'foo'", true},
14761476
{"CREATE INDEX idx ON t (a) USING HASH COMMENT 'foo'", true},
1477+
{"CREATE INDEX idx ON t (a) LOCK=NONE", true},
14771478
{"CREATE INDEX idx USING BTREE ON t (a) USING HASH COMMENT 'foo'", true},
14781479
{"CREATE INDEX idx USING BTREE ON t (a)", true},
14791480

0 commit comments

Comments
 (0)