You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "alexgraul (via GitHub)" <gi...@apache.org> on 2024/08/22 00:01:22 UTC

[I] Single SET command fails on MERGE created edge. [age]

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

   **Describe the bug**
   A clear and concise description of what the bug is.
   
   **How are you accessing AGE (Command line, driver, etc.)?**
   Direct PG CLI for reproduction
   
   **What data setup do we need to do?**
   Create `mygraph`
   
   **What is the command that caused the error?**
   ```pgsql
   ...
   SELECT * FROM cypher('mygraph', $$ 
   	MERGE (a:Airport { code: 'ATL'})
   	MERGE (b:Airport { code: 'LHR'})
   	MERGE (c:Airport { code: 'LGW'})
   $$) AS (value agtype);
   
   SELECT * FROM cypher('mygraph', $$ 
   	MATCH (left:Airport) WHERE left.code = 'LHR'
   	MATCH (right:Airport) WHERE right.code = 'LGW'
       MERGE (left)-[edge:ROUTE { code: 1 }]->(right)
       SET edge.foo = 2
       SET edge.bar = 2
       RETURN edge
   $$) AS (value agtype);
   
   SELECT * FROM cypher('mygraph', $$ 
   	MATCH (:Airport)-[r:ROUTE { code: 1 }]->(:Airport)
   	RETURN r
   $$) AS (value agtype);	
   
   SELECT * FROM cypher('mygraph', $$ 
   	MATCH (left:Airport) WHERE left.code = 'ATL'
   	MATCH (right:Airport) WHERE right.code = 'LGW'
       MERGE (left)-[edge:ROUTE { code: 2 }]->(right)
       SET edge.foo = 2
       RETURN edge
   $$) AS (value agtype);
   
   SELECT * FROM cypher('mygraph', $$ 
   	MATCH (:Airport)-[r:ROUTE { code: 2 }]->(:Airport)
   	RETURN r
   $$) AS (value agtype);	
   ...
   ```
   
   Observe that query 3 MATCH `[:Route { code: 1}]` returns an edge with props `{"bar": 2, "foo": 2, "code": 1}`
   The last query MATCH `[:Route { code: 2}]` however returns an edge with the props `{"code": 2}` - prop `foo` is missing.
   
   
   **What is the necessary configuration info needed?**
   Stock Apache AGE docker image
   
   **Expected behavior**
   The property `foo` should have been created on the edge that was created by the MERGE command in query 4. The returned edge correctly has the property but it is not actually stored in the database, thus query 5 returns an edge without `foo`.
   If you run query 4 twice it will work, this seems to be specific to a single SET coupled with a MERGE statement that is creating a new edge. It works correctly in all tested scenarios for vertices. 
   
   **Environment (please complete the following information):**
   - Version: 1.5


-- 
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] Single SET command fails on MERGE created edge. [age]

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

   @alexgraul This has been addressed in the current, unreleased, development branches. If you would like to try those branches, you can build them directly or use the **unsupported** `DockerHub dev_snapshot_<branch>` Fx: `dev_snapshot_PG16`
   
   ```
   psql-16.2-5432-psql=# select from create_graph('mygraph');
   NOTICE:  graph "mygraph" has been created
   --
   (1 row)
   
   psql-16.2-5432-psql=# SELECT * FROM cypher('mygraph', $$
   psql-16.2-5432-psql$# MERGE (a:Airport { code: 'ATL'})
   psql-16.2-5432-psql$# MERGE (b:Airport { code: 'LHR'})
   psql-16.2-5432-psql$# MERGE (c:Airport { code: 'LGW'})
   psql-16.2-5432-psql$# $$) AS (value agtype);
    value
   -------
   (0 rows)
   
   psql-16.2-5432-psql=# SELECT * FROM cypher('mygraph', $$
   psql-16.2-5432-psql$# MATCH (left:Airport) WHERE left.code = 'LHR'
   psql-16.2-5432-psql$# MATCH (right:Airport) WHERE right.code = 'LGW'
   psql-16.2-5432-psql$#     MERGE (left)-[edge:ROUTE { code: 1 }]->(right)
   psql-16.2-5432-psql$#     SET edge.foo = 2
   psql-16.2-5432-psql$#     SET edge.bar = 2
   psql-16.2-5432-psql$#     RETURN edge
   psql-16.2-5432-psql$# $$) AS (value agtype);
                                                                             value
   
   ------------------------------------------------------------------------------------------------------------------------------------
   ---------------------
    {"id": 1125899906842625, "label": "ROUTE", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {"bar": 2, "foo":
   2, "code": 1}}::edge
   (1 row)
   
   psql-16.2-5432-psql=# SELECT * FROM cypher('mygraph', $$
   psql-16.2-5432-psql$# MATCH (:Airport)-[r:ROUTE { code: 1 }]->(:Airport)
   psql-16.2-5432-psql$# RETURN r
   psql-16.2-5432-psql$# $$) AS (value agtype);
                                                                             value
   
   ------------------------------------------------------------------------------------------------------------------------------------
   ---------------------
    {"id": 1125899906842625, "label": "ROUTE", "end_id": 844424930131971, "start_id": 844424930131970, "properties": {"bar": 2, "foo":
   2, "code": 1}}::edge
   (1 row)
   
   psql-16.2-5432-psql=# SELECT * FROM cypher('mygraph', $$
   psql-16.2-5432-psql$# MATCH (left:Airport) WHERE left.code = 'ATL'
   psql-16.2-5432-psql$# MATCH (right:Airport) WHERE right.code = 'LGW'
   psql-16.2-5432-psql$#     MERGE (left)-[edge:ROUTE { code: 2 }]->(right)
   psql-16.2-5432-psql$#     SET edge.foo = 2
   psql-16.2-5432-psql$#     RETURN edge
   psql-16.2-5432-psql$# $$) AS (value agtype);
                                                                        value
   
   ------------------------------------------------------------------------------------------------------------------------------------
   -----------
    {"id": 1125899906842626, "label": "ROUTE", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {"foo": 2, "code":
    2}}::edge
   (1 row)
   
   psql-16.2-5432-psql=# SELECT * FROM cypher('mygraph', $$
   psql-16.2-5432-psql$# MATCH (:Airport)-[r:ROUTE { code: 2 }]->(:Airport)
   psql-16.2-5432-psql$# RETURN r
   psql-16.2-5432-psql$# $$) AS (value agtype);
                                                                        value
   
   ------------------------------------------------------------------------------------------------------------------------------------
   -----------
    {"id": 1125899906842626, "label": "ROUTE", "end_id": 844424930131971, "start_id": 844424930131969, "properties": {"foo": 2, "code":
    2}}::edge
   (1 row)
   
   psql-16.2-5432-psql=#
   ```
   


-- 
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] Single SET command fails on MERGE created edge. [age]

Posted by "alexgraul (via GitHub)" <gi...@apache.org>.
alexgraul closed issue #2067: Single SET command fails on MERGE created edge.
URL: https://github.com/apache/age/issues/2067


-- 
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] Single SET command fails on MERGE created edge. [age]

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

   Awesome news! Thankyou for the update, will take a look and confirm for our full scenario and then eagerly await the next release :) 


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