eeshwarg opened a new pull request, #2468:
URL: https://github.com/apache/age/pull/2468

   Apache AGE's MATCH grammar rejects openCypher's relationship-type 
alternation syntax - `MATCH ()-[:A|B]->()` fails at parse time with `syntax 
error at or near "|"`. For example, a query like `SELECT * FROM cypher('kg_s7', 
$$ MATCH (p)-[:WORKS_AT|REPORTS_TO]->(c) RETURN c $$) AS (c agtype);` throws a 
syntax error. A workaround for this today is to run something like `SELECT * 
FROM cypher('kg_s7', $$ MATCH (p)-[r]->(c) WHERE type(r) IN 
['WORKS_AT','REPORTS_TO'] RETURN c $$) AS (c agtype);`.
   
   This change enables support for relationship-type alternation in accordance 
with the openCypher standard. Changes are made in the grammar, AST and during 
transformation from the AST to Postgres `Query` struct by adding the types to 
the `quals` list.
   
   Variable-length relationship patterns with alternation `([:A|B*1..2])` are 
explicitly rejected with `ERRCODE_FEATURE_NOT_SUPPORTED`.
   
   Testing:
   - Added regress test with cases with directed/undirected edges, and variable 
length edges
   
   Future work:
   - openCypher also supports node-type alternation (like n:Person|Customer), 
which could be added to AGE in a future PR


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