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

Add testcase to ensure new columns can't be used as the the identity column in a backfill. #298

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

andrew-farries
Copy link
Collaborator

Add a test to ensure that new columns can't be used as the identity for a backfill, even if they satisfy the conditions for an identity column.

A newly added NOT NULL and UNIQUE column could in theory be used as the identity column for a backfill. However, it shouldn't be used as the identity column fora backfill because it's a newly added column whose temporary column will be full of NULLs for any existing rows in the table.

Currently the column won't be selected as an identity for backfills because the nullability and uniqueness for new column are not populated when adding it to the virtual schema in the add_column operation:

table.AddColumn(o.Column.Name, schema.Column{
Name: TemporaryName(o.Column.Name),
})

Following on from the discussion here: #289 (comment)

Add a test to ensure that new columns can't be used as the identity for
a backfill, even if they satisfy the conditions for an identity column.
@andrew-farries andrew-farries force-pushed the test-new-columns-cant-be-backfill-identities branch from 93cffda to a64fa08 Compare March 1, 2024 08:25
@andrew-farries andrew-farries merged commit 431b951 into main Mar 1, 2024
42 checks passed
@andrew-farries andrew-farries deleted the test-new-columns-cant-be-backfill-identities branch March 1, 2024 09:26
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.

2 participants