Describe the bug
In a chained MERGE query with two MERGE clauses, the first MERGE does not see the updates of the second one.
What data setup do we need to do?
SELECT create_graph('breakmerge');
SELECT * FROM cypher('breakmerge', $$
CREATE (:A), (:C)
$$) as (a agtype);
What is the command that caused the error?
SELECT * FROM cypher('breakmerge', $$
MATCH (x)
MERGE (x)-[:r]->(:t)
MERGE (:C)-[:r]->(:t)
$$) as (a agtype);
Outputs:
a
------------------------------------------------------------------
{"id": 844424930131969, "label": "A", "properties": {}}::vertex
{"id": 1125899906842625, "label": "C", "properties": {}}::vertex
{"id": 1125899906842626, "label": "C", "properties": {}}::vertex
{"id": 1125899906842627, "label": "C", "properties": {}}::vertex
(4 rows)
Expected behavior
There should be only one instance of :A and :C (verified in Neo4j).
a
------------------------------------------------------------------
{"id": 844424930131969, "label": "A", "properties": {}}::vertex
{"id": 1125899906842625, "label": "C", "properties": {}}::vertex
Environment (please complete the following information):
Master branch; PG 15.4
Additional context
Maybe related to how command IDs are used in MERGE's executor.
My assumption: when the MATCH node sends :A to the first MERGE node it creates (:A)-[:r]->(:t) and the second MERGE node creates (:C)-[:r]->(:t). In the next iteration, MATCH sends :C to the first MERGE, but it does not see that the second MERGE has already created (:C)-[:r]->(:t) in the previous iteration.
Describe the bug
In a chained MERGE query with two MERGE clauses, the first MERGE does not see the updates of the second one.
What data setup do we need to do?
What is the command that caused the error?
Outputs:
Expected behavior
There should be only one instance of
:Aand:C(verified in Neo4j).Environment (please complete the following information):
Master branch; PG 15.4
Additional context
Maybe related to how command IDs are used in MERGE's executor.
My assumption: when the MATCH node sends
:Ato the first MERGE node it creates(:A)-[:r]->(:t)and the second MERGE node creates(:C)-[:r]->(:t). In the next iteration, MATCH sends:Cto the first MERGE, but it does not see that the second MERGE has already created(:C)-[:r]->(:t)in the previous iteration.