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


##########
regress/expected/cypher_subquery.out:
##########
@@ -0,0 +1,333 @@
+LOAD 'age';
+SET search_path TO ag_catalog;
+SELECT * FROM create_graph('exists_subquery');
+NOTICE:  graph "exists_subquery" has been created
+ create_graph 
+--------------
+ 
+(1 row)
+
+SELECT * FROM cypher('exists_subquery', $$ 
+                                                                               
CREATE (:person {name: "Briggite", age: 32})-[:knows]->(:person {name: 
"Takeshi", age: 28}),
+                                                                               
           (:person {name: "Faye", age: 25})-[:knows]->(:person {name: "Tony", 
age: 34})-[:loved]->(:person {name : "Valerie", age: 33}),
+                                                                               
           (:person {name: "Calvin", age: 6})-[:knows]->(:pet {name: "Hobbes"}),
+                                                                               
           (:person {name: "Charlie", age: 8})-[:knows]->(:pet {name : 
"Snoopy"})
+                                                                               
$$) AS (result agtype);
+ result 
+--------
+(0 rows)
+
+SELECT * FROM cypher('exists_subquery', $$ MATCH (a) RETURN (a) $$) AS (result 
agtype);
+                                              result                           
                    
+---------------------------------------------------------------------------------------------------
+ {"id": 844424930131969, "label": "person", "properties": {"age": 32, "name": 
"Briggite"}}::vertex
+ {"id": 844424930131970, "label": "person", "properties": {"age": 28, "name": 
"Takeshi"}}::vertex
+ {"id": 844424930131971, "label": "person", "properties": {"age": 25, "name": 
"Faye"}}::vertex
+ {"id": 844424930131972, "label": "person", "properties": {"age": 34, "name": 
"Tony"}}::vertex
+ {"id": 844424930131973, "label": "person", "properties": {"age": 33, "name": 
"Valerie"}}::vertex
+ {"id": 844424930131974, "label": "person", "properties": {"age": 6, "name": 
"Calvin"}}::vertex
+ {"id": 844424930131975, "label": "person", "properties": {"age": 8, "name": 
"Charlie"}}::vertex
+ {"id": 1688849860263937, "label": "pet", "properties": {"name": 
"Hobbes"}}::vertex
+ {"id": 1688849860263938, "label": "pet", "properties": {"name": 
"Snoopy"}}::vertex
+(9 rows)
+
+SELECT * FROM cypher('exists_subquery', $$ MATCH (a:person) 
+                                                                               
   WHERE EXISTS {(a:person)-[]->(:pet)}
+                                                                               
   RETURN (a) $$) AS (result agtype);
+                                             result                            
                  
+-------------------------------------------------------------------------------------------------
+ {"id": 844424930131974, "label": "person", "properties": {"age": 6, "name": 
"Calvin"}}::vertex
+ {"id": 844424930131975, "label": "person", "properties": {"age": 8, "name": 
"Charlie"}}::vertex
+(2 rows)
+
+-- trying to use b when not defined, should fail
+SELECT * FROM cypher('exists_subquery', $$ MATCH (a:person) 
+                                                                               
   WHERE EXISTS {(a:person)-[]->(b:pet)}
+                                                                               
   RETURN (a) $$) AS (result agtype);
+ERROR:  variable `b` does not exist
+LINE 2:              WHERE EXISTS {(a:person)-[]->(b:pet)}
+                                                   ^
+--query inside
+SELECT * FROM cypher('exists_subquery', $$ MATCH (a:person)
+                                                                               
   WHERE EXISTS {MATCH (a:person)-[]->(b:pet) RETURN b}
+                                                                               
   RETURN (a) $$) AS (result agtype);
+                                              result                           
                    

Review Comment:
   Is this the correct output? It doesn't seem like it should be.



-- 
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