jrgemignani commented on code in PR #961:
URL: https://github.com/apache/age/pull/961#discussion_r1218418120


##########
regress/sql/cypher_merge.sql:
##########
@@ -479,6 +479,22 @@ SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) 
RETURN n $$) AS (n agtype
 SELECT * FROM cypher('cypher_merge', $$ MERGE (n:node {name: 'Jason'}) SET 
n.name = 'Lisa', n.age = 23, n.gender = 'Female' RETURN n $$) AS (n agtype);
 SELECT * FROM cypher('cypher_merge', $$ MATCH (n:node) RETURN n $$) AS (n 
agtype);
 
+--
+-- Complex MERGE w/wo RETURN values
+--
+-- These should each create a path, if it doesn't already exist.
+-- TODO Until the issue with variable reuse of 'x' in MERGE is corrected,
+--      these commands will each create a new path.
+SELECT * FROM cypher('cypher_merge', $$ MERGE 
()-[:B]->(x:C)-[:E]->(x:C)<-[f:F]-(y:I) $$) AS (x agtype);
+SELECT * FROM cypher('cypher_merge', $$ MERGE 
()-[:B]->(x:C)-[:E]->(x:C)<-[f:F]-(y:I) RETURN x $$) AS (x agtype);

Review Comment:
   I noticed that message when testing against Neo4j as well. 
   
   Neo4j is complaining because x is already defined and it looks like we are 
redefining it. But are we really redefining it? It is the same variable, label, 
and property. I only qualified it here because MERGE has additional logic that 
preprocesses the command that hasn't been fixed yet. Once that is done, you 
will be able to just use x in the second spot, and that is legal in Neo4j.
   
   This patch is only for fixing the memory issues that caused the crash. And, 
we still need to address the issue that x, as the logic currently is, is being 
recreated.
   
   Hope that is helpful



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to