`CREATE` operations are silently discarded in a multi-part write-and-read query
- Dominant language
- C
- Stars
- 4.8k
- Forks
- 523
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 9
Description
**Describe the bug**
A dense set of relationships created earlier in the same Cypher query is not matched by a subsequent two-hop relationship pattern.
The query creates eight nodes and directed relationships between every pair of distinct nodes. Every node should therefore match as the middle node in:
```cypher
(:N)-[:R]->(middle:N)<-[:R]-(:N)
```
However, the query returns `"FAIL"`, indicating that no middle nodes were found.
**How are you accessing AGE (Command line, driver, etc.)?**
* Command line using interactive `psql`
* Executed through `docker exec`
```text
docker exec -it test psql -U postgres -d postgres
```
**What data setup do we need to do?**
Start Apache AGE:
```text
docker run --rm --name test -e POSTGRES_PASSWORD=agepass -p 5432:5432 apache/age:latest
```
Connect using interactive `psql`:
```text
docker exec -it test psql -U postgres -d postgres
```
Load AGE, configure the search path, and create the graph:
```pgsql
LOAD 'age';
SET search_path = ag_catalog, public;
SELECT create_graph('test');
```
No separate graph data setup is required because the affected query creates the nodes and relationships itself.
**What is the necessary configuration info needed?**
* Docker image: `apache/age:latest`
* PostgreSQL: `18.1`
* Apache AGE: `1.7.0`
* AGE extension installed by the Docker image
* `search_path` set to `ag_catalog, public`
* Operating system: WSL2, Ubuntu 24.04.1 LTS
* Installation method: Docker
**What is the command that caused the error?**
```pgsql
SELECT *
FROM cypher('test', $cypher$
UNWIND range(1,8) AS i
CREATE (:N {id:i})
WITH count(*) AS ignored
MATCH (a:N), (b:N)
WHERE a.id <> b.id
CREATE (a)-[:R]->(b)
WITH count(*) AS ignored
MATCH (:N)-[:R]->(middle:N)<-[:R]-(:N)
WITH collect(middle) AS values
RETURN CASE
WHEN size(values) > 0 THEN 'PASS'
ELSE 'FAIL'
END AS value
$cypher$) AS (value agtype);
```
Actual result:
```text
value
--------
"FAIL"
(1 row)
```
**Expected behavior**
The query creates eight nodes and 56 directed relationships.
Every node has multiple incoming relationships, so the middle-node pattern should produce rows and the query should return:
```text
value
--------
"PASS"
(1 row)
```
**Environment (please complete the following information):**
* Apache AGE version: `1.7.0`
* PostgreSQL version: `18.1`
* Docker image: `apache/age:latest`
* Operating system: WSL2, Ubuntu 24.04.1 LTS
* Access method: interactive `psql` through `docker exec`
**Additional context**
The behavior was reproduced twice in clean Docker containers. The query completed without a PostgreSQL error, and the database remained available.
Contributor guide
Research direction
Reproduce the exact Cypher query in the supplied Apache AGE Docker and psql setup, then inspect the multi-part write-and-read execution path to determine why the created nodes and relationships are not visible to the final MATCH. Done means the query returns PASS and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, docker, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100