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

*: Support the statement of ALTER [COLUMN] col_name SET DEFAULT #2608

Merged
merged 3 commits into from
Feb 8, 2017

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Feb 7, 2017

Fix #2383

@@ -880,6 +880,17 @@ AlterTableSpec:
NewColumn: $4.(*ast.ColumnDef),
}
}
| "ALTER" "COLUMN" ColumnName "SET" "DEFAULT" SignedLiteral
{
option := &ast.ColumnOption{Expr: $6.(ast.ExprNode)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set ColumnOption Type.

Copy link
Contributor Author

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)
Copy link
Member

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?

Copy link
Contributor Author

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.

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Feb 8, 2017

LGTM

@zimulala
Copy link
Contributor Author

zimulala commented Feb 8, 2017

PTAL @coocood

@coocood
Copy link
Member

coocood commented Feb 8, 2017

LGTM

@zimulala zimulala merged commit 87f5173 into master Feb 8, 2017
@zimulala zimulala deleted the zimuxia/alter-column-default branch February 8, 2017 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants