You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "MuhammadTahaNaveed (via GitHub)" <gi...@apache.org> on 2024/02/14 18:19:12 UTC

[I] List comprehension as property constraint of MERGE clause errors out [age]

MuhammadTahaNaveed opened a new issue, #1611:
URL: https://github.com/apache/age/issues/1611

   **Describe the bug**
   List comprehension as property constraint of MERGE clause errors out.
   
   **How are you accessing AGE (Command line, driver, etc.)?**
   - command line
   
   **What is the command that caused the error?**
   ```pgsql
   SELECT * from cypher('graph_name', $$
     MERGE ({list:[u IN [1,2,3]]})
   $$) as (a agtype);
   ```
   ```
   ERROR:  Aggref found in non-Agg plan node
   ```
   
   **Expected behavior**
   Should execute without any error.
   
   **Environment (please complete the following information):**
   - Version: latest
   


-- 
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.apache.org

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


Re: [I] List comprehension as property constraint of MERGE clause errors out [age]

Posted by "diangamichael (via GitHub)" <gi...@apache.org>.
diangamichael commented on issue #1611:
URL: https://github.com/apache/age/issues/1611#issuecomment-2040762064

   To apply a workaround to the query and avoid using list comprehensions in the MERGE clause, you can modify the query to precompute the list before using it in the MERGE clause. Here's how you can rewrite the query:
   
   WITH input_list AS (
     SELECT [1,2,3] AS list
   )
   SELECT * FROM cypher('graph_name', $$
     MERGE ({list: u.list})
     ON CREATE SET ...
     ON MATCH SET ...
   $$) AS (a agtype);
   In this modified query:
   
   We first create a Common Table Expression (CTE) named input_list to compute the list [1,2,3].
   Then, we reference this computed list u.list within the MERGE clause.
   You need to replace ON CREATE SET ... and ON MATCH SET ... with the appropriate actions you want to perform when the MERGE clause creates or matches a node.
   By precomputing the list outside the MERGE clause, we avoid using list comprehensions directly within it, potentially bypassing the error you encountered.
   
   
   
   
   
   To apply a workaround to the query and avoid using list comprehensions in the MERGE clause, you can modify the query to precompute the list before using it in the MERGE clause. Here's how you can rewrite the query:
   
   sql
   Copy code
   WITH input_list AS (
     SELECT [1,2,3] AS list
   )
   SELECT * FROM cypher('graph_name', $$
     MERGE ({list: u.list})
     ON CREATE SET ...
     ON MATCH SET ...
   $$) AS (a agtype);
   In this modified query:
   
   We first create a Common Table Expression (CTE) named input_list to compute the list [1,2,3].
   Then, we reference this computed list u.list within the MERGE clause.
   You need to replace ON CREATE SET ... and ON MATCH SET ... with the appropriate actions you want to perform when the MERGE clause creates or matches a node.
   By precomputing the list outside the MERGE clause, we avoid using list comprehensions directly within it, potentially bypassing the error you encountered.
   
   
   
   
   
   


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


Re: [I] List comprehension as property constraint of MERGE clause errors out [age]

Posted by "sir-sa (via GitHub)" <gi...@apache.org>.
sir-sa commented on issue #1611:
URL: https://github.com/apache/age/issues/1611#issuecomment-2044399192

   SELECT * FROM cypher('graph_name', $$
     UNWIND [1,2,3] AS value
     MERGE (n {property: value})
   $$) AS (a agtype);
   


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


Re: [I] List comprehension as property constraint of MERGE clause errors out [age]

Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani closed issue #1611: List comprehension as property constraint of MERGE clause errors out
URL: https://github.com/apache/age/issues/1611


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