-
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.
57149: opt: don't hold on to evalCtx from detached Memo r=RaduBerinde a=RaduBerinde This change adds more "cleanup" code when detaching a Memo (a detached memo is stored in the query cache and is reused later in a "read-only" fashion). In particular, we clear the EvalContext in logicalPropsBuilder which can lead to inadvertently holding on to a lot of memory. Fixes #57059. Release note: None 57153: optbuilder: fix ambiguous column references for FK cascades r=RaduBerinde a=mgartner This commit fixes an issue in optbuilder that caused "ambiguous column reference" errors. This error would be produced during cascading updates if a child table's reference column name was equal to the parent column name concatenated with `_new`, and the child table had a check constraint, computed column, or partial index predicate that referenced the column. For example, the following `UPDATE` statement would produce an error. The expected behavior is a successful `UPDATE`. Notice that `p_new` of the child table references `p` of the parent table. CREATE TABLE parent (p INT PRIMARY KEY) CREATE TABLE child ( c INT PRIMARY KEY, p_new INT REFERENCES parent(p) ON UPDATE CASCADE, CHECK (p_new > 0) ) UPDATE parent SET p = p * 10 WHERE p > 1 This issue was the result of incorrect scoping while building foreign key cascading update expressions. A column with the same name and column ID was added to the update expression's input scope. Because the `mutationBuilder.disambiguateColumns` function is unable to disambiguate columns with the same name and column ID, building any expression that referenced the duplicated column would result in an error. This commit fixes the issue by no longer duplicating columns in the update expression's input scope. `mutationBuilder.addUpdateCols` now detects the special case when the update expression is a `*scopeColumn` and avoids duplicating it in the generated projection scope. Fixes #57148 Release note (bug fix): A bug has been fix that caused an "ambiguous column reference" error during foreign key cascading updates. This error was incorrectly produced when the child table's reference column name was equal to the concatenation of the parent's reference column name and "_new", and when the child table had a CHECK constraint, computed column, or partial index predicate expression that referenced the column. This bug was introduce in version 20.2. 57242: kvserver: avoid serving an unsafe string to log.Fatalf r=irfansharif a=knz A linter change in #57134 made me discover this bug. Release note: None 57246: rowenc: de-flake TestEncodeContainingArrayInvertedIndexSpans r=rytaft a=mgartner `TestEncodeContainingArrayInvertedIndexSpans` was failing sporadically because of randomized test cases that were incorrectly determining the expected value for the `unique` return value from `EncodeContainingInvertedIndexSpans`. The test was using the `reflect.DeepEqual` function to check for `Datum` equality, which does not return true in all cases where `Datum.Compare` returns `0`. Fixes #57237 Release note: None Co-authored-by: Radu Berinde <radu@cockroachlabs.com> Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com> Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
- Loading branch information
Showing
7 changed files
with
138 additions
and
19 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
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
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