You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "diangamichael (via GitHub)" <gi...@apache.org> on 2024/04/03 20:36:58 UTC

Re: [I] Where Union of Labels [age]

diangamichael commented on issue #1714:
URL: https://github.com/apache/age/issues/1714#issuecomment-2035535583

   
   It seems you're trying to execute Cypher queries within a PostgreSQL environment using the cypher function. The error you're encountering is due to the incorrect usage of the '|' symbol in the label definition within your MATCH clause. In Cypher, '|' is not used to denote multiple labels for a node. Instead, you should use the IN keyword.
   
   Here's the corrected version of your first query:
   
   sql
   Copy code
   SELECT * FROM cypher('playground', $$
   MATCH (n)
   WHERE n:Movie OR n:Person
   RETURN n
   $$) AS (v agtype);
   This query will match nodes that have either the label 'Movie' or 'Person'.
   
   Alternatively, you can use your second query as you provided:
   
   sql
   Copy code
   SELECT * FROM cypher('playground', $$
   MATCH (n)
   WHERE label(n) = 'Movie' OR label(n) = 'Person'
   RETURN n
   $$) AS (v agtype);
   
   Both queries should achieve the same result, with the second one explicitly checking the labels of nodes. Choose whichever you find more readable or preferable for your use case.


-- 
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: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org