Skip to content

opt: fix fetch scope in UPDATE..FROM statements#61522

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:partial-index-scope-fix
Mar 5, 2021
Merged

opt: fix fetch scope in UPDATE..FROM statements#61522
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:partial-index-scope-fix

Conversation

@mgartner
Copy link
Copy Markdown
Contributor

@mgartner mgartner commented Mar 5, 2021

Previously, the fetch scope incorrectly included columns in the FROM
clause of an UPDATE..FROM statement. As a result, column names shared by
the FROM clause and the mutating table lead to ambiguity when resolving
partial index DEL column expressions. This commit ensures that the fetch
scope does not include columns in the FROM clause.

Fixes #61284

Release justification: This is a low-risk bug fix to existing
functionality.

Release note (bug fix): An UPDATE..FROM statement where the FROM clause
contained column names that match table column names erred if the table
had a partial index predicate referencing those columns. This bug,
present since partial indexes were released in version 20.2.0, has been
fixed.

Previously, the fetch scope incorrectly included columns in the FROM
clause of an UPDATE..FROM statement. As a result, column names shared by
the FROM clause and the mutating table lead to ambiguity when resolving
partial index DEL column expressions. This commit ensures that the fetch
scope does not include columns in the FROM clause.

Fixes cockroachdb#61284

Release justification: This is a low-risk bug fix to existing
functionality.

Release note (bug fix): An UPDATE..FROM statement where the FROM clause
contained column names that match table column names erred if the table
had a partial index predicate referencing those columns. This bug,
present since partial indexes were released in version 20.2.0, has been
fixed.
@mgartner mgartner requested a review from a team as a code owner March 5, 2021 01:34
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@mgartner
Copy link
Copy Markdown
Contributor Author

mgartner commented Mar 5, 2021

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 5, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 5, 2021

Build succeeded:

@craig craig bot merged commit 2264789 into cockroachdb:master Mar 5, 2021
@mgartner mgartner deleted the partial-index-scope-fix branch March 5, 2021 20:47
@rafiss rafiss added this to the 20.2 milestone Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: partial predicate causes error for UPDATE .. FROM

4 participants