-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: fast-path blind UPSERT does not have distinct check #146759
Copy link
Copy link
Open
Labels
A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Teambranch-release-20.1Used to mark GA and release blockers, technical advisories, and bugs for 20.1Used to mark GA and release blockers, technical advisories, and bugs for 20.1
Metadata
Metadata
Assignees
Labels
A-sql-optimizerSQL logical planning and optimizations.SQL logical planning and optimizations.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Teambranch-release-20.1Used to mark GA and release blockers, technical advisories, and bugs for 20.1Used to mark GA and release blockers, technical advisories, and bugs for 20.1
Type
Projects
Status
Bugs to Fix
(Thanks to @fabiog1901 for finding this!)
#45372 added a distinct check to UPSERT and INSERT ON CONFLICT that prevents the same row from being modified twice by the statement. But it looks like the fast-path blind upsert does not have this same distinct check, leading to inconsistent behavior for UPSERT statements.
Here's a repro using current tip of master (59c35f8):
I don't think this fast-path UPSERT can cause corruption, as in #70731, so the only problem here is the confusing difference in behavior between plans for the same statement, depending on the indexes.
Jira issue: CRDB-50690