-
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.
60680: opt: support INSERT ON CONFLICT DO NOTHING with partial unique constraints r=mgartner a=mgartner #### opt: move INSERT DO NOTHING arbiter code to mutation_builder_arbiter.go Arbiter-related code in `pkg/sql/opt/optbuilder/insert.go` has grown unruly due to the added complexity of partial indexes and unique constraints. This commit moves some arbiter-related functions to a new file to accommodate the growth. It also breaks some anonymous closures into independent functions, for clarity. Release note: None #### opt: pass column ordinals directly to arbiter building functions This commit makes the arguments of `buildAntiJoinForDoNothingArbiter` and `buildDistinctOnForDoNothingArbiter` more intuitive. Columns ordinals are now passed directly to these functions, rather than a column count and ordinal-returning callback. Release note: None #### opt: create arbiterPredicateHelper for picking partial index arbiters This commit adds a new helper struct that can determine if a partial index can be used as an arbiter based on the arbiter predicate of an `INSERT ON CONFLICT` statement. This will also be a useful utility to determine if partial unique constraints can be used as arbiters. Release note: None #### opt: support INSERT ON CONFLICT DO NOTHING with partial unique constraints To support INSERT ON CONFLICT DO NOTHING statements on tables with partial UNIQUE WITHOUT INDEX constraints, partial constraints are now selected as arbiters. These arbiters are used to filter out insert rows that would conflict with existing rows in the table. Informs #59195 There is no release note because these constraints are gated behind the experimental_enable_unique_without_index_constraints session variable. Release note: None Co-authored-by: Marcus Gartner <[email protected]>
- Loading branch information
Showing
11 changed files
with
1,322 additions
and
428 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
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
Oops, something went wrong.