You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "zihaozeng0021 (via GitHub)" <gi...@apache.org> on 2025/12/26 15:23:31 UTC
[I] `WHERE 1 IN []` is silently evaluated to `WHERE true` [age]
zihaozeng0021 opened a new issue, #2290:
URL: https://github.com/apache/age/issues/2290
### Note
This looks closely related to issue #2289, but it doesn’t seem to be the same underlying problem, so I opened a new report.
### Configuration
AGE Version: `apache/age:latest` (pulled 2025-12-26)
Operating System: WSL2 – Ubuntu 24.04.1 LTS
Installation Method: Docker
---
### Steps to reproduce
1. Start AGE via Docker
```
docker run \
--name age \
-p 5455:5432 \
-e POSTGRES_USER=postgresUser \
-e POSTGRES_PASSWORD=postgresPW \
-e POSTGRES_DB=postgresDB \
-d \
apache/age:latest
```
2. Connect with psql
```
PGPASSWORD='postgresPW' psql -h localhost -p 5455 -U postgresUser -d postgresDB
```
3. Run the following query
Set up:
```
CREATE EXTENSION IF NOT EXISTS age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;
SELECT create_graph('test');
SELECT * FROM cypher('test', $$ CREATE (:N) RETURN 1 $$) AS (x agtype);
```
First Control Query (`WHERE true`):
```
postgresDB=# SELECT count(*)
FROM cypher('test', $$
MATCH (n:N)
WHERE true
RETURN n
$$) AS (n agtype);
count
-------
1
(1 row)
```
Second Control Query (`WHERE false`):
```
postgresDB=# SELECT count(*)
FROM cypher('test', $$
MATCH (n:N)
WHERE false
RETURN n
$$) AS (n agtype);
count
-------
0
(1 row)
```
Third Control Query (`WHERE 1 IN []` throws an error):
```
postgresDB=# SELECT *
FROM cypher('test', $$
WITH 1 AS x
WHERE 1 IN []
RETURN x AS v
$$) AS (v agtype);
ERROR: cache lookup failed for type 0
LINE 2: FROM cypher('test', $$
^
```
The buggy query:
```
postgresDB=# SELECT count(*)
FROM cypher('test', $$
MATCH (n:N)
WHERE 1 IN []
RETURN n
$$) AS (n agtype);
count
-------
1
(1 row)
```
---
### Expected behaviour
The buggy query should behave the same as the second control query.
However, since `1 IN []` is currently problematic (reported in issue #2289), the buggy query should instead behave the same as the third control query under this condition.
### Actual behaviour
The buggy query behaves the same as the first control 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: dev-unsubscribe@age.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] `WHERE 1 IN []` is silently evaluated to `WHERE true` [age]
Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani closed issue #2290: `WHERE 1 IN []` is silently evaluated to `WHERE true`
URL: https://github.com/apache/age/issues/2290
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] `WHERE 1 IN []` is silently evaluated to `WHERE true` [age]
Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #2290:
URL: https://github.com/apache/age/issues/2290#issuecomment-3740252698
@zihaozeng0021 Actually, your 3rd control query has the incorrect output and PR #2294 resolves it causing the latter 2 queries to provide the correct results.
**3rd query correct result**
```
psql-17.4-5432-pgsql=# SELECT count(*)
psql-17.4-5432-pgsql-# FROM cypher('test', $$
psql-17.4-5432-pgsql$# MATCH (n:N)
psql-17.4-5432-pgsql$# WHERE 1 IN []
psql-17.4-5432-pgsql$# RETURN n
psql-17.4-5432-pgsql$# $$) AS (n agtype);
count
-------
0
(1 row)
```
**buggy query correct result**
```
psql-17.4-5432-pgsql=# SELECT *
psql-17.4-5432-pgsql-# FROM cypher('test', $$
psql-17.4-5432-pgsql$# WITH 1 AS x
psql-17.4-5432-pgsql$# WHERE 1 IN []
psql-17.4-5432-pgsql$# RETURN x AS v
psql-17.4-5432-pgsql$# $$) AS (v agtype);
v
---
(0 rows)
psql-17.4-5432-pgsql=#
```
--
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: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org