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

scbuildstmt: fallback if adding a virtual column with NOT NULL #87459

Conversation

Xiang-Gu
Copy link
Contributor

@Xiang-Gu Xiang-Gu commented Sep 6, 2022

We found a regression in the new schema changer for the following stmt: ALTER TABLE t ADD COLUMN j INT AS (NULL::INT) VIRTUAL NOT NULL; incorrectly succeeded. This PR made ADD COLUMN fall back if the to-be-added column is a virtual column with NOT NULL constraint.

Surprisingly, we actually have logic tests in place for this case but it has incorrect expected output so we also changed the exsiting tests.

Fix: #87457

Release justification: bug fix for GA blocker.

Release note: None

We found a regression in the new schema changer for the following stmt:
`ALTER TABLE t ADD COLUMN j INT AS (NULL::INT) VIRTUAL NOT NULL;`
incorrectly succeeded. This PR made `ADD COLUMN` fall back if the
to-be-added column is a virtual column with NOT NULL constraint.

Surprisingly, we actually have logic tests in place for this case but
it has incorrect expected output so we also changed the exsiting tests.

Release justification: bug fix for GA blocker.

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@Xiang-Gu Xiang-Gu marked this pull request as ready for review September 7, 2022 13:50
@Xiang-Gu Xiang-Gu requested a review from a team September 7, 2022 13:50
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

Relates to #81690.

:lgtm:

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @Xiang-Gu)

@Xiang-Gu
Copy link
Contributor Author

Xiang-Gu commented Sep 7, 2022

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Sep 7, 2022

Build succeeded:

@craig craig bot merged commit e39111b into cockroachdb:master Sep 7, 2022
@Xiang-Gu Xiang-Gu deleted the fallback_add_virtual_column_with_not_null_constraint branch September 8, 2022 06:49
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.

schemachanger: ADD COLUMN AS (NULL) virtual not null incorrectly succeeds
3 participants