-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: don't exclude unvalidated check constraints #37366
Conversation
Previously, as of 19.1, AllActiveAndInactiveChecks(), which gets check constraints for ALTER TABLE as well as SHOW CONSTRAINT, etc., excluded unvalidated checks on the table descriptor, under the assumption that all checks would be validated once they'd been added to the table descriptor. This was to avoid double-counting constraints that were both on the table descriptor and in the list of mutations. This caused unvalidated checks added in earlier versions to disappear (though they are still on the table descriptor itself, and are still enforced for writes). This PR fixes the issue by only excluding `Validating` checks on the table descriptor to avoid double-counting. Release note (bug fix): Fixes bug where unvalidated check constraints disappear from the output of SHOW CONSTRAINT and cannot be referenced in ALTER TABLE after upgrading to 19.1.
I updated the PR. I realized the previous approach (deduplicating by name, or even name and expression) doesn't work, since this function gets called in validating the uniqueness of constraint names before they're added. What will work is just filtering out |
bors r+ |
37366: sql: don't exclude unvalidated check constraints r=lucy-zhang a=lucy-zhang Previously, as of 19.1, AllActiveAndInactiveChecks(), which gets check constraints for ALTER TABLE as well as SHOW CONSTRAINT, etc., excluded unvalidated checks on the table descriptor, under the assumption that all checks would be validated once they'd been added to the table descriptor. This was to avoid double-counting constraints that were both on the table descriptor and in the list of mutations. This caused unvalidated checks added in earlier versions to disappear (though they are still on the table descriptor itself, and are still enforced for writes). This PR fixes the issue by only excluding `Validating` checks on the table descriptor to avoid double-counting. Fixes #37285. Release note (bug fix): Fixes bug where unvalidated check constraints disappear from the output of SHOW CONSTRAINT and cannot be referenced in ALTER TABLE after upgrading to 19.1. 37450: parser: Add IMPORT INTO prototype syntax r=dt a=dt Breaking this out of the implementation PR. Release note: None Co-authored-by: Lucy Zhang <lucy-zhang@users.noreply.github.com> Co-authored-by: David Taylor <tinystatemachine@gmail.com>
Build succeeded |
Previously, as of 19.1, AllActiveAndInactiveChecks(), which gets check
constraints for ALTER TABLE as well as SHOW CONSTRAINT, etc., excluded
unvalidated checks on the table descriptor, under the assumption that all
checks would be validated once they'd been added to the table descriptor. This
was to avoid double-counting constraints that were both on the table descriptor
and in the list of mutations. This caused unvalidated checks added in earlier
versions to disappear (though they are still on the table descriptor itself,
and are still enforced for writes). This PR fixes the issue by only excluding
Validating
checks on the table descriptor to avoid double-counting.Fixes #37285.
Release note (bug fix): Fixes bug where unvalidated check constraints disappear
from the output of SHOW CONSTRAINT and cannot be referenced in ALTER TABLE
after upgrading to 19.1.