-
Notifications
You must be signed in to change notification settings - Fork 458
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: ALTER TABLE .. VALIDATE CONSTRAINT substatement #990
Comments
Just pinging this to mention that confusion over the "Unvalidated" state of a new foreign key constraint came up with a user today. |
@dt Have we added meaningful validation to FKs? |
what do you mean? VALIDATE CONSTRAINT does what it claims, it is just super slow. @jordanlewis has started on fixing that part in #13681 though. |
Yeah, the validation is meaningful, but it requires the manual step of running the command that this issue is about. |
Sorry––I'd misremembered a conversation with @dt. The constraint is validated if it's present during the |
as a stopgap until something like cockroachdb/cockroach#13681 lands, we could error if |
If it's present during the If it's added after the table is created, my understanding (please correct me if I'm wrong, @dt) is that all new updates to the table have to respect the constraint, but the existing data in the table might not because it isn't validated when the constraint is added. So the table is in a state where the data in it might not meet all of the constraints on it. Running the |
@a-robinson correct. in postgres / elsewhere, this is the behavior of |
Almost filed an issue for this just now. I came across the empty Parameters table and Examples section and thought we had a build error or something. @jseldess I'm gonna snag this if you don't mind? Shout at me if you do! I have a really rough draft of the empty sections about ready to make a PR with. I still think it will at least be better than the current state. |
All yours, @rmloveland! |
Complete reference documentation for the
ALTER TABLE .. VALIDATE CONSTRAINT
statement.Intro, Required Privileges, and Synopsis are complete. We need to complete Parameters and Examples. For style reference, see ADD COLUMN or ADD CONSTRAINT.
More reference:
The text was updated successfully, but these errors were encountered: