-
Notifications
You must be signed in to change notification settings - Fork 490
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, ast: add ColumnOptionCollate for all column types #260
Conversation
parser.y
Outdated
$$ = &ast.ColumnDef{Name: $1.(*ast.ColumnName), Tp: $2.(*types.FieldType), Options: $3.([]*ast.ColumnOption)} | ||
def := &ast.ColumnDef{Name: $1.(*ast.ColumnName), Tp: $2.(*types.FieldType)} | ||
opts := make([]*ast.ColumnOption, 0) | ||
for _, opt := range $3.([]*ast.ColumnOption) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this logic to CreateTable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
4b60e72
to
4990418
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -416,6 +418,12 @@ func (n *ColumnOption) Restore(ctx *RestoreCtx) error { | |||
if err := n.Refer.Restore(ctx); err != nil { | |||
return errors.Annotate(err, "An error occurred while splicing ColumnOption ReferenceDef") | |||
} | |||
case ColumnOptionCollate: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test in TestDDL
for testing restore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed, PTAL!
37794c8
to
f5a0676
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please fix the conflict. |
f5a0676
to
09b4eea
Compare
Updated, thanks @zimulala |
What problem does this PR solve?
In MySQL
CREATE TABLE
syntax, column collation is part of the column option, so the following statements are valid(although meaningless):This PR makes those statements acceptable
What is changed and how it works?
Column "COLLATE" definitions are moved from 'StringType' to 'ColumnOption'
Check List
Tests
Code changes
Side effects
Related changes