fix(plan): keep index row id for replace single-index path - #24580
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
# Conflicts: # pkg/sql/plan/build_test.go
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed the current head f0952b8 from multiple angles. The fix addresses the real planner bug in the REPLACE single-index path: index-table Name2ColIndex is now initialized before the old-rowid / lookup-column wiring, and the final old-column lookups no longer silently collapse to a zero-value ColRef when a key is missing. I also checked the surrounding replace path and the new regression test for the real-PK + non-unique single-column secondary-index case; I did not find a remaining blocking issue in the current patch.
Merge Queue Status
This pull request spent 1 hour 59 minutes 22 seconds in the queue, including 1 hour 58 minutes 24 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #23946
What this PR does / why we need it:
In the REPLACE merged-main-scan path (real primary key + non-unique
single-column secondary index), the planner builds the index table's
DeleteColsoldRow_IDby looking it up inoldColName2Idx. Thelookup key could be missing, silently falling back to a zero-value
ColRef{RelPos: 0, ColPos: 0}instead of the index table's ownRow_ID.This PR:
Name2ColIndexand fixes the lookup touse a consistent key with an
okcheck, so a missing key returns aninternal error instead of silently producing
[0,0].Row_IDobtained from the index-table LEFT JOIN.
TestReplaceNonUniqueSingleIndexDeleteUsesIndexRowIDcovering thereal-primary-key + non-unique single-column index scenario.