Skip to content

release-21.2: sql: enforce NOT NULL when adding a virtual computed column#83355

Merged
ajwerner merged 1 commit intocockroachdb:release-21.2from
ajwerner:backport21.2-81693
Jun 27, 2022
Merged

release-21.2: sql: enforce NOT NULL when adding a virtual computed column#83355
ajwerner merged 1 commit intocockroachdb:release-21.2from
ajwerner:backport21.2-81693

Conversation

@ajwerner
Copy link
Copy Markdown
Contributor

@ajwerner ajwerner commented Jun 24, 2022

Backport 1/1 commits from #81693.

/cc @cockroachdb/release


Before this change, we did not ever validate that newly added
virtual computed columns which were marked NOT NULL actually were
not NULL. This is because there historically, in the legacy schema changer,
we'd validate the NULL nature of the column when performing a column
backfill. In the declarative schema changer, we don't do a column backfill,
so we have bugs aplenty related to the general failure to check the NULL
disposition of the data (see #81679).

This change only affects the legacy schema changer so that it can be
backported. A separate issue (#81690) has been filed for parity in the
declarative schema changer.

Release note (bug fix): Before this change, not validation was performed
when adding a virtual computed column which was marked NOT NULL. This meant
that it was possible to have a virtual computed column with an active NOT NULL
constraint despite having rows in the table for which the column was NULL.
This has now been fixed.

Release justification: Fixes bug.

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Jun 24, 2022

Thanks for opening a backport.

Please check the backport criteria before merging:

  • Patches should only be created for serious issues or test-only changes.
  • Patches should not break backwards-compatibility.
  • Patches should change as little code as possible.
  • Patches should not change on-disk formats or node communication protocols.
  • Patches should not add new functionality.
  • Patches must not add, edit, or otherwise modify cluster versions; or add version gates.
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
  • There is a high priority need for the functionality that cannot wait until the next release and is difficult to address in another way.
  • The new functionality is additive-only and only runs for clusters which have specifically “opted in” to it (e.g. by a cluster setting).
  • New code is protected by a conditional check that is trivial to verify and ensures that it only runs for opt-in clusters.
  • The PM and TL on the team that owns the changed code have signed off that the change obeys the above rules.

Add a brief release justification to the body of your PR to justify this backport.

Some other things to consider:

  • What did we do to ensure that a user that doesn’t know & care about this backport, has no idea that it happened?
  • Will this work in a cluster of mixed patch versions? Did we test that?
  • If a user upgrades a patch version, uses this feature, and then downgrades, what happens?

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Before this change, we did not ever validate that newly added
virtual computed columns which were marked NOT NULL actually were
not NULL. This is because there historically, in the legacy schema changer,
we'd validate the `NULL` nature of the column when performing a column
backfill. In the declarative schema changer, we don't do a column backfill,
so we have bugs aplenty related to the general failure to check the `NULL`
disposition of the data (see cockroachdb#81679).

This change only affects the legacy schema changer so that it can be
backported. A separate issue (cockroachdb#81690) has been filed for parity in the
declarative schema changer.

Release note (bug fix): Before this change, not validation was performed
when adding a virtual computed column which was marked `NOT NULL`. This meant
that it was possible to have a virtual computed column with an active `NOT
NULL`
constraint despite having rows in the table for which the column was `NULL`.
This has now been fixed.
@ajwerner ajwerner force-pushed the backport21.2-81693 branch from b3fb71a to 2f3c84c Compare June 27, 2022 04:01
@ajwerner ajwerner marked this pull request as ready for review June 27, 2022 13:27
@ajwerner ajwerner requested a review from a team June 27, 2022 13:27
@ajwerner ajwerner merged commit 0800d1e into cockroachdb:release-21.2 Jun 27, 2022
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