Silence6666668 opened a new issue, #2390:
URL: https://github.com/apache/age/issues/2390
**Describe the bug**
`MATCH` may fail to see nodes that were created earlier in the same Cypher
query after a `WITH` boundary.
In the minimized repro below, the query creates two `Person` nodes, carries
them through `WITH`, and then immediately runs `MATCH (x:Person)`. Under Cypher
semantics, that `MATCH` should see the two newly created nodes and produce two
rows.
Instead, Apache AGE returns no rows at all.
**How are you accessing AGE (Command line, driver, etc.)?**
- PostgreSQL `cypher(...)` wrapper through the local Python
differential-testing harness
- Reproducible directly in `psql` inside the Docker container
**What data setup do we need to do?**
```pgsql
SELECT create_graph('fuzz_graph');
```
No graph data is required beyond creating an empty graph.
**What is the necessary configuration info needed?**
- Plain Apache AGE Docker image was enough
- Docker image in local repro: `apache/age`
- AGE extension version: `1.7.0`
- PostgreSQL version: `18.1`
- Graph name used in repro: `fuzz_graph`
- No extra extensions or special configuration were required
**What is the command that caused the error?**
```pgsql
SELECT * FROM cypher('fuzz_graph', $$
CREATE (a:Person {id: 1, name: 'Alice'}),
(m:Person {id: 2, name: 'Bob'})
WITH a, m
MATCH (x:Person)
RETURN a, m, x
$$) AS (a agtype, m agtype, x agtype);
```
Returned result on AGE:
```text
(0 rows)
```
**Expected behavior**
The `MATCH (x:Person)` clause should see the two newly created nodes, so the
query should return two rows.
Observed behavior on both Neo4j and Memgraph:
```text
a = Alice, m = Bob, x = Alice
a = Alice, m = Bob, x = Bob
```
**Environment (please complete the following information):**
- Version: Apache AGE `1.7.0`
- PostgreSQL: `18.1`
- Host OS: Windows
- Architecture: x86_64
- Deployment: Docker
**Additional context**
A smaller control case without the post-`WITH` `MATCH` behaves normally on
the same AGE instance:
```pgsql
SELECT * FROM cypher('fuzz_graph', $$
CREATE (a:Person {id: 1, name: 'Alice'}),
(m:Person {id: 2, name: 'Bob'})
WITH a, m
RETURN a, m
$$) AS (a agtype, m agtype);
```
AGE returns the two created nodes correctly there.
A filtered variant also fails unexpectedly:
```pgsql
SELECT * FROM cypher('fuzz_graph', $$
CREATE (a:Person {id: 1, name: 'Alice'}),
(m:Person {id: 2, name: 'Bob'})
WITH a, m
MATCH (x:Person)
WHERE x.id = 1
RETURN a, m
$$) AS (a agtype, m agtype);
```
Neo4j and Memgraph return one row, but AGE still returns no rows.
This same family also appeared during automated differential testing in
larger queries such as:
```cypher
UNWIND range(1, 3) AS i
CREATE (n:Person {id: i})
SET n.name = 'Person' + toString(i)
WITH n
MATCH (m:Person)
OPTIONAL MATCH path = (n)-[:KNOWS]->(m)
RETURN n, m, path
```
and:
```cypher
MATCH (p:Person)
WITH p ORDER BY p.age DESC LIMIT 2
CREATE (new:City {name: 'Metropolis'})
WITH collect(p) AS people, new
MATCH (c:City)
WHERE c.name = new.name
RETURN c.name AS city, count(people) AS resident_count, people
```
In both of those larger variants, Neo4j and Memgraph return rows, while AGE
returns none.
--
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]