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: fix remove partitioning syntax #396

Merged
merged 6 commits into from
Jul 26, 2019
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
5 changes: 4 additions & 1 deletion ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,7 @@ const (
AlterTablePartition
AlterTableEnableKeys
AlterTableDisableKeys
AlterTableRemovePartitioning

// TODO: Add more actions
)
Expand Down Expand Up @@ -1998,6 +1999,8 @@ func (n *AlterTableSpec) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("ENABLE KEYS")
case AlterTableDisableKeys:
ctx.WriteKeyWord("DISABLE KEYS")
case AlterTableRemovePartitioning:
ctx.WriteKeyWord("REMOVE PARTITIONING")
default:
// TODO: not support
ctx.WritePlainf(" /* AlterTableType(%d) is not supported */ ", n.Tp)
Expand Down Expand Up @@ -2066,7 +2069,7 @@ func (n *AlterTableStmt) Restore(ctx *RestoreCtx) error {
return errors.Annotate(err, "An error occurred while restore AlterTableStmt.Table")
}
for i, spec := range n.Specs {
if i == 0 || spec.Tp == AlterTablePartition {
if i == 0 || spec.Tp == AlterTablePartition || spec.Tp == AlterTableRemovePartitioning {
ctx.WritePlain(" ")
} else {
ctx.WritePlain(", ")
Expand Down
2 changes: 2 additions & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ var tokenMap = map[string]int{
"PAGE": pageSym,
"PARTIAL": partial,
"PARTITION": partition,
"PARTITIONING": partitioning,
"PARTITIONS": partitions,
"PASSWORD": password,
"PESSIMISTIC": pessimistic,
Expand Down Expand Up @@ -440,6 +441,7 @@ var tokenMap = map[string]int{
"REGEXP": regexpKwd,
"REGIONS": regions,
"RELOAD": reload,
"REMOVE": remove,
"RENAME": rename,
"REPEAT": repeat,
"REPEATABLE": repeatable,
Expand Down
Loading