YGY-001 opened a new issue, #2596:
URL: https://github.com/apache/age/issues/2596
## Environment
- Apache AGE `1.8.0`, PostgreSQL `18.6`
- Docker image: `apache/age:release_PG18_1.8.0`
## Reproduction
Create two initially unlabeled nodes in each of two clean graphs:
```sql
LOAD 'age';
SET search_path = ag_catalog, public;
SELECT ag_catalog.create_graph('age_repro24_left');
SELECT *
FROM ag_catalog.cypher('age_repro24_left', $$
CREATE (), ()
$$) AS (v agtype);
SELECT ag_catalog.create_graph('age_repro24_right');
SELECT *
FROM ag_catalog.cypher('age_repro24_right', $$
CREATE (), ()
$$) AS (v agtype);
```
### Baseline — `age_repro24_left`
```sql
SELECT *
FROM ag_catalog.cypher('age_repro24_left', $$
MATCH (n)
DETACH DELETE n
MERGE (:New)
RETURN count(*) AS rows
$$) AS (rows agtype);
```
### Row-materialized variant — `age_repro24_right`
```sql
SELECT *
FROM ag_catalog.cypher('age_repro24_right', $$
MATCH (n)
WITH {n: n} AS row
WITH collect(row) AS rows
UNWIND rows AS row
WITH row.n AS n
DETACH DELETE n
MERGE (:New)
RETURN count(*) AS rows
$$) AS (rows agtype);
```
The `collect`/`UNWIND` block preserves the two input rows and their bindings;
it materializes the earlier `MATCH` result before the later writes.
## Expected and actual
The initial `MATCH` should bind the two nodes that exist when that clause is
evaluated. The later `MERGE` must not add another row to that
already-completed
scan. Both queries should therefore return `2`.
On AGE 1.8.0 / PostgreSQL 18.6:
```text
baseline: 3 rows
barrier: 2 rows
```
The official Cypher clause-composition documentation states that a clause
cannot observe writes made by a later clause and notes that a `MATCH` before
`CREATE` does not find the node created later in the query: [Neo4j Cypher
clause
composition](https://neo4j.com/docs/cypher-manual/current/clauses/clause-composition/).
--
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]