-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ALTER COLUMN TYPE doesn’t work if the column being altered has a default value #119555
Comments
Hi @rimadeodhar, can I pick this issue to contribute? There doesn't seem to be any takers for this and seems perfect for a newcomer like me. |
@uds5501 have you been working on this? What is the new behavior going to do to the existing default? If we want, we can remove the default or we can try to convert it as well. |
@cjhetzle I am currently exploring the codebase and checking relevant files to change. |
func (node *AlterTableSetDefault) Format(ctx *FmtCtx) { This function should be responsible for ALTER table having default feature added in node need to fix logic here @uds5501 are you looking into similar part of code? |
I think it's got to be |
@cjhetzle @uds5501 can you please let me do we need to remove the default one or need to update handling for that
Here we need to remove the |
hey @sahilwahi7 , since you've debugged the issue in depth, you can carry on with the dev of the same. Feel free to raise an MR |
@uds5501 please go ahead with raising PR , it was your initial hint from which i was able to debug |
Hi @sahilwahi7 , I am not able to setup cockroach locally over the weekend and don't want myself to be a blocker if someone else can contribute to this. Please feel free to raise the MR. |
@dikshant In your example:
why do we cast the default value to INT8 when the column is defined to be an INT4? Just curious to know if that's relevant to the issue? |
@sahilwahi7 @uds5501 the issue is not in alterColumnType, but in the validator pkg>sql>catalog>tabledesc>validate.go (line 1144).
@dikshant I am new here, and not sure what needs to be done, as it was a bug with clusters & cluster backup which contain tables with such columns as described here. What should be the new behaviour/additional check that would resolve this issue? |
Alter column type doesn’t work if the column has a default value.
For example:
Will fail with:
But this will work without the DEFAULT
Epic CRDB-25314
Jira issue: CRDB-36224
The text was updated successfully, but these errors were encountered: