WHERE clause on ARRAY incorrectly applied when GIN index exists #117979
Labels
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
O-community
Originated from the community
S-3-erroneous-edge-case
Database produces or stores erroneous data without visible error/warning, in rare edge cases.
T-sql-queries
SQL Queries Team
X-blathers-triaged
blathers was able to find an owner
Describe the problem
I'm running a query with multiple conditions on arrays using
<@
and&&
operators in itsWHERE
clause combined with bothAND
andOR
operators.When there are no indices on the table, the results are correct.
After adding a GIN index on the array column, other rows start being included in the results. The incorrect results are consistent with the query conditions if the
OR
condition was applied at the top-level and not nested in parentheses.Removing the index restores the correct behavior.
To Reproduce
This returns rows 1 and 4.
This now returns rows 1, 4, and 3.
(Row 3 does not match the mandatory
ARRAY['str1'] <@ t.links
condition).Expected behavior
The query results should always be the same regardless of the index being used.
Environment:
Jira issue: CRDB-35441
The text was updated successfully, but these errors were encountered: