zihaozeng0021 opened a new issue, #2493:
URL: https://github.com/apache/age/issues/2493
**Describe the bug**
A query creates three nodes and then performs an `OPTIONAL MATCH` guarded by
an always-true empty `COUNT` subquery predicate. All three nodes are persisted,
but none are visible to the later match in the same query.
**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?**
```text
docker run --rm --name test -e POSTGRES_PASSWORD=agepass -p 5432:5432
apache/age:latest
```
```pgsql
LOAD 'age';
SET search_path = ag_catalog, public;
SELECT create_graph('test');
```
No separate graph data setup is required.
**What is the necessary configuration info needed?**
* Docker image: `apache/age:latest`
* PostgreSQL: `18.1`
* Apache AGE: `1.7.0`
* `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 [1,2,3] AS i
CREATE (:U {id:i})
WITH count(*) AS ignored
OPTIONAL MATCH (a:U)
WHERE COUNT { UNWIND [] AS x RETURN x } >= 0
OPTIONAL MATCH (z:U {missing:true})
RETURN count(*) AS rows,
count(a) AS bound,
count(z) AS downstream
$cypher$) AS (rows agtype, bound agtype, downstream agtype);
```
Actual result:
```text
rows | bound | downstream
-----+-------+-----------
1 | 0 | 0
```
A separate control query after completion returns:
```text
persisted
---------
3
```
**Expected behavior**
The empty `COUNT` subquery evaluates to zero, so its predicate is true. The
first `OPTIONAL MATCH` should bind all three created nodes, producing `rows=3,
bound=3, downstream=0`.
**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 failure was reproduced twice in clean Docker containers. The three nodes
are stored successfully but are not visible to the later `OPTIONAL MATCH` in
the same query.
--
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]