Silence6666668 opened a new issue, #2389:
URL: https://github.com/apache/age/issues/2389
**Describe the bug**
When a query has multiple input rows, creating a node into a variable and
then immediately creating a relationship to that variable may fail with:
```text
vertex assigned to variable new was deleted
```
In the repro below, the query should create one new `Person` node per
matched `a` row, connect `a` to that new node, and then return the matched
names.
Instead, Apache AGE errors out during execution.
**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 * FROM cypher('fuzz_graph', $$
CREATE (:Person {name:'Alice'}),
(:Person {name:'Bob'})
$$) AS (v agtype);
```
**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', $$
MATCH (a:Person)
CREATE (new:Person {name:'Zoe'})
CREATE (a)-[:FRIEND]->(new)
RETURN a.name AS a_name
$$) AS (a_name agtype);
```
Returned result on AGE:
```text
ERROR: vertex assigned to variable new was deleted
```
**Expected behavior**
The query should succeed and return the two matched rows:
```text
Alice
Bob
```
Neo4j returns exactly those two rows for the equivalent Cypher query.
**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**
Two nearby control cases behave correctly on the same AGE instance:
1. The same pattern works when restricted to a single input row:
```pgsql
SELECT * FROM cypher('fuzz_graph', $$
MATCH (a:Person)
WITH a LIMIT 1
CREATE (new:Person {name:'Nia'})
CREATE (a)-[:FRIEND]->(new)
RETURN a.name AS a_name
$$) AS (a_name agtype);
```
Observed result:
```text
Alice
```
2. The multi-row query also works if the target node is created anonymously
instead of being bound to a variable:
```pgsql
SELECT * FROM cypher('fuzz_graph', $$
MATCH (a:Person)
CREATE (a)-[:FRIEND]->(:Person {name:'Mia'})
RETURN a.name AS a_name
$$) AS (a_name agtype);
```
Observed result:
```text
Alice
Bob
```
3. Creating the node into `new` without immediately using it in the
relationship also works:
```pgsql
SELECT * FROM cypher('fuzz_graph', $$
MATCH (a:Person {name:'Alice'})
CREATE (new:Person {name:'Eve'})
RETURN a.name AS a_name, new.name AS new_name
$$) AS (a_name agtype, new_name agtype);
```
Observed result:
```text
Alice, Eve
```
So the failure appears to be specifically tied to multi-row execution of:
1. `CREATE` a new node bound to a variable
2. immediately `CREATE` a relationship to that bound node
--
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]