-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
ddl: Support some definitions and fix a bug to modify|change column
#2629
Conversation
@@ -846,6 +846,10 @@ func modifiable(origin *types.FieldType, to *types.FieldType) bool { | |||
return false | |||
} | |||
default: | |||
if origin.Tp == to.Tp { |
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.
Need to check Flen
, Decimal
and Flag
?
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.
There are checked in line819-830.
if err != nil { | ||
return errors.Trace(err) | ||
return ErrColumnBadNull.Gen("invalid default value - %s", err) |
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.
Add test case for this case.
ddl/ddl_api.go
Outdated
col.Flag &= ^uint(mysql.NotNullFlag) | ||
case ast.ColumnOptionOnUpdate: | ||
if !expression.IsCurrentTimeExpr(opt.Expr) { | ||
return ErrInvalidOnUpdate.Gen("invalid ON UPDATE for - %s", col.Name) |
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.
Add test case for this case.
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.
This check is done at the parsing layer In MySQL. But we didn't do that. I will fix it in the next PR.
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.
And now we only support the type of current_timestamp
. I will add a TODO
here.
LGTM |
PTAL @shenli |
LGTM |
This PR for the statement of
alter table ... modify|change column
.Support the following definitions: 'not null', 'null', 'default value' and 'comment'.
Fix the same type of change.