YGY-001 opened a new issue, #2594:
URL: https://github.com/apache/age/issues/2594

    
   ## Environment
   
   - Apache AGE `1.8.0`, PostgreSQL `18.6`
   - Docker image: `apache/age:release_PG18_1.8.0`
   
   ## Reproduction
   
   Run setup and target queries as separate statements. The two AGE graphs start
   with the same single relationship.
   
   ```sql
   LOAD 'age';
   SET search_path = ag_catalog, public;
   
   SELECT ag_catalog.create_graph('age_repro22_left');
   SELECT *
   FROM ag_catalog.cypher('age_repro22_left', $$
   CREATE ()-[:R]->()
   $$) AS (v agtype);
   
   SELECT ag_catalog.create_graph('age_repro22_right');
   SELECT *
   FROM ag_catalog.cypher('age_repro22_right', $$
   CREATE ()-[:R]->()
   $$) AS (v agtype);
   ```
   
   ### Baseline query — `age_repro22_left`
   
   ```sql
   SELECT *
   FROM ag_catalog.cypher('age_repro22_left', $$
   UNWIND [1, 2] AS i
   MATCH (a)-[:R]->(b)
   SET b.x = 1
   MERGE (a)-[:R]->(b)<-[:R]-({id: 1})
   RETURN i
   $$) AS (i agtype);
   ```
   
   ### Row-preserving barrier query — `age_repro22_right`
   
   ```sql
   SELECT *
   FROM ag_catalog.cypher('age_repro22_right', $$
   UNWIND [1, 2] AS i
   MATCH (a)-[:R]->(b)
   SET b.x = 1
   WITH {i: i, a: a, b: b} AS row
   WITH collect(row) AS rows
   UNWIND rows AS row
   WITH row.i AS i, row.a AS a, row.b AS b
   MERGE (a)-[:R]->(b)<-[:R]-({id: 1})
   RETURN i
   $$) AS (i agtype);
   ```
   
   ## Expected and actual
   
   Both target queries should return three rows: `1`, `2`, `2`. The two input 
rows
   are distinct (`i` is `1` and `2`), and the map/`collect`/`UNWIND` barrier
   retains both rows and their multiplicity.
   
   On AGE `1.8.0` / PostgreSQL `18.6`:
   
   ```text
   baseline: 1, 2, 2   (3 rows)
   barrier:  1, 2      (2 rows)
   ```
   
   The three expected rows follow from the full-pattern `MERGE`: the first input
   row creates the missing pattern, and the next input row can then match two
   complete paths. Cypher `MERGE` matches the full pattern or creates it; see 
the
   [Cypher `MERGE` 
documentation](https://neo4j.com/docs/cypher-manual/current/clauses/merge/).


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