Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 1219 - MERGE not seeing previous clause var (#1441) #1444

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

jrgemignani
Copy link
Contributor

Fixed issue 1219 where MERGE did not see the previous clause's variable.

This description is a bit misleading as the transform phase did see the variable and was able to use it. However, the planner phase removed the variable by replacing it with a NULL Const. This caused MERGE to see a NULL Const for the previous tuple, generating incorrect results. However, this only occurred for very specific cases.

Fx: MATCH (x) MERGE (y {id: id(x)}) -- worked
MATCH (x) MERGE (y {id: id(x)}) RETURN y -- didn't
MATCH (x) MERGE (y {id: id(x)}) RETURN x, y -- worked

The change impacted no current regression tests and involved wrapping all explicitly defined variables' target entries with a volatile wrapper.

Added new regression tests.

@github-actions github-actions bot added the PG12 PostgreSQL12 label Dec 11, 2023
Fixed issue 1219 where MERGE did not see the previous clause's
variable.

This description is a bit misleading as the transform phase did see
the variable and was able to use it. However, the planner phase
removed the variable by replacing it with a NULL Const. This caused
MERGE to see a NULL Const for the previous tuple, generating
incorrect results. However, this only occurred for very specific
cases.

Fx:    MATCH (x) MERGE (y {id: id(x)})              -- worked
       MATCH (x) MERGE (y {id: id(x)}) RETURN y     -- didn't
       MATCH (x) MERGE (y {id: id(x)}) RETURN x, y  -- worked

The change impacted no current regression tests and involved wrapping
all explicitly defined variables' target entries with a volatile
wrapper.

Added new regression tests.
@rafsun42 rafsun42 merged commit d638a19 into apache:PG12 Dec 11, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PG12 PostgreSQL12
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants