jihot2000 commented on issue #217:
URL: https://github.com/apache/incubator-age/issues/217#issuecomment-1130820868

   > It looks like the VLE is not using the correct graph global context
   > 
   > ```
   > BEGIN;
   > 
   > SET search_path = ag_catalog, "$user", public;
   > 
   > SELECT create_graph('mygraph');
   > 
   > SELECT * FROM cypher('mygraph', $$
   >     CREATE (a:Node {name: 'a'})-[:Edge]->(c:Node {name: 'c'})
   > $$) AS (g1 agtype);
   > 
   > --Removed VLE call
   > 
   > SELECT * FROM cypher('mygraph', $$
   >     MATCH (a:Node {name: 'a'})-[e:Edge]->(c:Node {name: 'c'})
   >     DELETE e
   >     CREATE (a)-[:Edge]->(:Node {name: 'b'})-[:Edge]->(c)
   > $$) AS (g3 agtype);
   > 
   > SELECT * FROM cypher('mygraph', $$
   >     MATCH p = ()-[:Edge]->()
   >     RETURN p
   > $$) AS (g4 agtype);
   > 
   > SELECT * FROM cypher('mygraph', $$
   >     MATCH p = ()-[:Edge*]->()
   >     RETURN p
   > $$) AS (g5 agtype);
   > 
   > SELECT drop_graph('mygraph', true);
   > 
   > COMMIT;
   > ```
   > 
   > We will take a look into it, for now the workaround I recommend is only 
use variable length edges once in a transaction
   
   Thank you for your suggestion.
   
   I tried to append the element 'b' to the end of the link list instead of 
inserting as follows. The outputs of g5 are still different.
   
   ```sql
   \pset pager off
   
   BEGIN;
   
   SET search_path = ag_catalog, "$user", public;
   
   SELECT create_graph('mygraph');
   
   SELECT * FROM cypher('mygraph', $$
       CREATE (a:Node {name: 'a'})-[:Edge]->(c:Node {name: 'c'})
   $$) AS (g1 agtype);
   
   SELECT * FROM cypher('mygraph', $$
       MATCH p = ()-[:Edge*]->()
       RETURN p
   $$) AS (g2 agtype);
   
   SELECT * FROM cypher('mygraph', $$
       MATCH (c:Node {name: 'c'})
       CREATE (c)-[:Edge]->(:Node {name: 'b'})
   $$) AS (g3 agtype);
   
   SELECT * FROM cypher('mygraph', $$
       MATCH p = ()-[:Edge]->()
       RETURN p
   $$) AS (g4 agtype);
   
   SELECT * FROM cypher('mygraph', $$
       MATCH p = ()-[:Edge*]->()
       RETURN p
   $$) AS (g5 agtype);
   
   SELECT drop_graph('mygraph', true);
   
   COMMIT;
   ```
   
   So, it is not the 'DELETE' clause caused the bug. It is the variable length 
edges match that caused the bug indeed.
   
   I will use "LOOP ... END LOOP" PL/pgSQL control statements to query my link 
list  instead of "(head)-[:Edge*]->(node)". It looks ugly, but reliable.


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