Skip to content

Commit

Permalink
sql: adds unique constraint checks to SCRUB
Browse files Browse the repository at this point in the history
The SCRUB tool validates table constraints. Before this change, it could
only validate `CHECK` and foreign key constraints. This PR enhances
SCRUB to also validate tables that contain `PRIMARY KEY`, `UNIQUE`, or
the experimental `UNIQUE WITHOUT INDEX` keywords.

Fixes: #73632

Release note (sql change): This PR expands the capabilities of the experimental
SCRUB tool to include checking unique constraints for primary keys,
unique indexes, and unique columns without indexes. The usage and output
of SCRUB is unchanged, but if there is a unique constraint violation,
users will see the error message `unique_constraint_violation` for all
rows that violate the constraint, along with information about the row.
  • Loading branch information
rharding6373 committed May 25, 2022
1 parent a35b848 commit a6567e3
Show file tree
Hide file tree
Showing 9 changed files with 965 additions and 115 deletions.
4 changes: 4 additions & 0 deletions pkg/ccl/partitionccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ go_test(
"drop_test.go",
"main_test.go",
"partition_test.go",
"scrub_test.go",
"zone_test.go",
],
embed = [":partitionccl"],
Expand Down Expand Up @@ -73,6 +74,9 @@ go_test(
"//pkg/sql/lexbase",
"//pkg/sql/parser",
"//pkg/sql/randgen",
"//pkg/sql/rowenc",
"//pkg/sql/scrub",
"//pkg/sql/scrub/scrubtestutils",
"//pkg/sql/sem/eval",
"//pkg/sql/sem/tree",
"//pkg/sql/tests",
Expand Down
Loading

0 comments on commit a6567e3

Please sign in to comment.