opt: tables with non-covering partitions can cause incorrect results when avoiding full scans #137994
Labels
branch-release-22.1
Used to mark GA and release blockers, technical advisories, and bugs for 22.1
branch-release-22.2
Used to mark GA and release blockers, technical advisories, and bugs for 22.2
branch-release-23.1
Used to mark GA and release blockers, technical advisories, and bugs for 23.1
branch-release-23.2
Used to mark GA and release blockers, technical advisories, and bugs for 23.2
branch-release-24.1
Used to mark GA and release blockers, technical advisories, and bugs for 24.1
branch-release-24.2
Used to mark GA and release blockers, technical advisories, and bugs for 24.2
branch-release-24.3
Used to mark GA and release blockers, technical advisories, and bugs for 24.3
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
GA-blocker
T-sql-queries
SQL Queries Team
Describe the problem
If the partitions of a table do not cover all valid values for the partition columns, the optimizer may create a query plan that produces incorrect results. I noticed this issue while making a recent change, but I think the bug has existed for years.
To Reproduce
With CockroachDB v24.3 or a prior version, run the following in
cockroach demo
:This should update every row to have
col1_5 = 'bar'
.Now re-create the table and insert the rows, but change the UPDATE statement to avoid a full scan:
This will only update 2 rows.
Expected behavior
Both UPDATE statements should update all 8 rows in the table.
Jira issue: CRDB-45844
The text was updated successfully, but these errors were encountered: