YGY-001 opened a new issue, #2603:
URL: https://github.com/apache/age/issues/2603
### Environment
- Apache AGE: 1.8.0
- PostgreSQL: 18.6
- Docker image: apache/age:release_PG18_1.8.0
- Access method: psql
### Description
When a query starts with OPTIONAL MATCH and its attached WHERE predicate is
false, the query returns zero rows. I expected one row with null values for
the optional bindings.
Adding an explicit input row before OPTIONAL MATCH preserves that row and
returns null bindings, so the behavior appears specific to OPTIONAL MATCH
at the start of a query.
### Reproduction
Environment setup:
LOAD 'age';
SET search_path = ag_catalog, public;
SELECT create_graph('test');
Create a matching edge:
SELECT * FROM cypher('test', $$
CREATE (:A)-[:R]->(:B)
$$) AS (v agtype);
Run:
SELECT * FROM cypher('test', $$
OPTIONAL MATCH (n)-[r:R]->()
WHERE false
RETURN startNode(r) AS s, endNode(r) AS e
$$) AS (s agtype, e agtype);
### Actual result
The query succeeds but returns zero rows.
### Expected result
The query returns one row with null values:
s | e
null | null
### Control
This query returns one row with null bindings:
SELECT * FROM cypher('test', $$
WITH 1 AS seed
OPTIONAL MATCH (n)-[r:R]->()
WHERE false
RETURN seed, n, r
$$) AS (seed agtype, n agtype, r agtype);
--
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]