-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
26699: release-2.0: sql: Check CHECK constraints on upsert when updating a conflicting row r=emsal1863 a=emsal1863 Backport 1/1 commits from #26642. /cc @cockroachdb/release --- * Before: On a table with a CHECK constraint, such as: ``` CREATE TABLE ex(foo INT PRIMARY KEY, bar INT, CHECK (bar < 2) ``` an upsert on the table would not properly check the CHECK constraints, e.g. ``` INSERT INTO ex(foo, bar) VALUES(1, 2); INSERT INTO ex(foo, bar) VALUES(1, 2) ON CONFLICT (foo) DO UPDATE SET bar = 3 ``` would update the row, violating the check constraint. * After: On attempting such an operation, CockroachDB now throws the proper database error "failed to satisfy CHECK constraint ..." Release note (sql change): CHECK constraints are now checked when updating a conflicting row in INSERT ... ON CONFLICT DO UPDATE statements. closes #23699 Co-authored-by: Emmanuel <[email protected]>
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters