Skip to content

Commit

Permalink
parser: support 'ALTER TABLE FORCE' syntax (pingcap#6476)
Browse files Browse the repository at this point in the history
* support 'ALTER TABLE FORCE' syntax
  • Loading branch information
spongedu authored and ngaut committed May 6, 2018
1 parent 7aee5f7 commit 9cd410d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ const (
AlterTableAlterColumn
AlterTableLock
AlterTableAlgorithm
AlterTableForce

// TODO: Add more actions
)
Expand Down
8 changes: 8 additions & 0 deletions parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,14 @@ AlterTableSpec:
Tp: ast.AlterTableAlgorithm,
}
}
| "FORCE"
{
// Parse it and ignore it. Just for compatibility.
$$ = &ast.AlterTableSpec{
Tp: ast.AlterTableForce,
}
}


AlterAlgorithm:
"DEFAULT" | "INPLACE" | "COPY"
Expand Down
1 change: 1 addition & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,7 @@ func (s *testParserSuite) TestDDL(c *C) {
{"ALTER TABLE t CONVERT TO CHARSET utf8;", true},
{"ALTER TABLE t CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;", true},
{"ALTER TABLE t CONVERT TO CHARSET utf8 COLLATE utf8_bin;", true},
{"ALTER TABLE t FORCE", true},
{"ALTER TABLE t DROP INDEX;", false},

// For create index statement
Expand Down

0 comments on commit 9cd410d

Please sign in to comment.