Skip to content

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 PG13 PostgreSQL13 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 4d4fad2 into apache:PG13 Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PG13 PostgreSQL13

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants