#13987·neo4j

Two `IN` predicates that are individually true for the same value combine to `false` under `AND`

Author: ting668Created Sep 21, 2026Updated Sep 21, 2026
Labelsbugteam-cypherGithub IssueFuzzy Bug2 Bug

Reporter: ting668

Neo4j Version: 2026.08.1 (Community edition; also checked on 5.26.30, the current 5.26 LTS patch) Operating System: Linux (WSL2), inside a Docker container Installation Method: Docker image neo4j:2026.08.1 API/Driver: cypher-shell (Bolt, in-container)

Description

While testing Neo4j using an intuitive approach inspired by attribute constraints, I found that two IN predicates that are individually true for the same value combine to false when connected with AND. Number equality across INTEGER and FLOAT makes 0 = 0.0 true, and each IN test on its own returns TRUE for the value 0. Combining two true conjuncts with AND must therefore stay TRUE; instead the conjunction flips to FALSE, which is consistent with the two IN predicates being merged into one predicate whose combined list membership check no longer matches the value that both original lists matched. The contradiction is internal to the same query: a = TRUE, b = TRUE, a AND b = FALSE.

Steps to reproduce

Note: The queries below are a minimized, simplified example reproducing the bug.

Buggy query (no data needed):

cypher
WITH 0 AS v
RETURN v IN [0] AS a,
       v IN [0.0] AS b,
       v IN [0] AND v IN [0.0] AS combined;

Expected behavior

Both conjuncts are TRUE for v = 0, so their conjunction must be TRUE:

a = TRUE, b = TRUE, combined = TRUE

Actual behavior

The conjunction is returned as FALSE although both conjuncts are TRUE (observed on 2026.08.1 and 5.26.30 via cypher-shell):

a = TRUE, b = TRUE, combined = FALSE

As a control, the individual pieces behave correctly:

cypher
RETURN 0 = 0.0 AS eq_across_types;
WITH 0 AS v RETURN v IN [0.0] AS b_only;
eq_across_types = TRUE

b_only = TRUE

This also affects queries over stored data. Setup and buggy query:

cypher
CREATE (:N {uid:'zero',v:0});
CREATE (:N {uid:'one',v:1});

MATCH (n:N) WHERE n.v IN [0] AND n.v IN [0.0]
RETURN n.uid AS uid ORDER BY uid;

Expected behavior: v = 0 is in [0] and in [0.0], so the conjunction keeps the row:

uid = "zero"

Actual behavior: no rows are returned:

(no rows)

This suggests that the two IN predicates are being merged into a single predicate whose combined list membership check no longer matches the value that each original list matched, so a conjunction of two satisfied predicates evaluates to FALSE. This is consistent with the IN-predicate merging optimization introduced in #10277 (which rewrites x IN [1,2,3] AND x IN [2,3,4] into x IN [2,3]); its combined-membership check appears not to handle lists whose elements are equal across INTEGER and FLOAT.