Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
60535: sql: support INSERT with partial UNIQUE WITHOUT INDEX constraints r=mgartner a=mgartner #### optbuilder: return scope from mutationBuilder.buildCheckInputScan This commit updates `mutationBuilder.buildCheckInputScan` to build a scope containing the constructed WithScan expression and the scope columns output by the expression. Also, the WithScan output column names are now the names of the columns in the underlying table, rather than the names of the input columns. Access to a scope for the WithScan expression will be required to support partial `UNIQUE WITHOUT INDEX` constraints. For uniqueness checks, a filter on the WithScan columns must be added to the semi-join filters. The WithScan scope will be required in order to build the filter expression. Additionally, the names of the WithScan output columns must match the names of the columns in the underlying table in order to build partial predicate expressions that refer to the table's columns. Release note: None #### sql: support INSERT with partial UNIQUE WITHOUT INDEX constraints Uniqueness checks on INSERTs are now performed for partial UNIQUE WITHOUT INDEX constraints. The semi-join filters in the uniqueness checks filter out rows that do not satisfy the predicate. Rows on both sides of the join are filtered. This is required to prevent duplicate key violations from occurring for rows that do not satisfy the predicate of the partial unique constraint. The WithScan and Scan of the uniqueness check now produce all ordinary table columns, rather than just the PK and unique columns, because predicates may refer any columns 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