Skip to content

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

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
Xiang-Gu:fallback_add_virtual_column_with_not_null_constraint
Sep 7, 2022
Merged

scbuildstmt: fallback if adding a virtual column with NOT NULL#87459
craig[bot] merged 1 commit intocockroachdb:masterfrom
Xiang-Gu:fallback_add_virtual_column_with_not_null_constraint

Conversation

@Xiang-Gu
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Xiang-Gu commented Sep 7, 2022

TFTR!

bors r+

@craig
Copy link
Copy Markdown
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