-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: Support the statement of ALTER [COLUMN] col_name SET DEFAULT
#2608
Conversation
@@ -880,6 +880,17 @@ AlterTableSpec: | |||
NewColumn: $4.(*ast.ColumnDef), | |||
} | |||
} | |||
| "ALTER" "COLUMN" ColumnName "SET" "DEFAULT" SignedLiteral | |||
{ | |||
option := &ast.ColumnOption{Expr: $6.(ast.ExprNode)} |
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.
Set ColumnOption Type.
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.
We can use original type information.
// Check column default value. | ||
// TODO: Put this code to checkDefaultValue and fix issue 2600. | ||
colInfo := col.ToInfo() | ||
_, _, err = table.GetColDefaultValue(ctx, colInfo) |
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.
Why try to get default value here?
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.
It uses to check column default value as the comment say.
LGTM |
PTAL @coocood |
LGTM |
Fix #2383