Skip to content

Cypher: relationship inline WHERE is ignored entirely on variable-length patterns #5490

Closed

Description

@robfrank

ArcadeDB version

26.8.1-SNAPSHOT, main at 74f776d (i.e. with #5460, #5480 and #5481 merged).

Environment

  • Query language: Cypher (OpenCypher engine)
  • Reproduced from an engine unit test against an embedded database

Description

A relationship inline WHERE predicate on a variable-length pattern is discarded outright. The
predicate has no effect on the result at all: WHERE false and WHERE true return the same rows.

The fixed-length spelling of the same predicate works correctly (fixed by #5460), and the
variable-length property map spelling works correctly, so the gap is specific to the inline
WHERE slot on variable-length patterns.

Because the predicate is silently ignored rather than rejected, queries return too many rows
with no error.

Steps to reproduce

CREATE (a:A {v:1}), (b:A {v:10}), (c:A {v:2});
MATCH (a:A {v:1}), (b:A {v:10}), (c:A {v:2})
CREATE (a)-[:E {tag:'ok', w:5}]->(b), (a)-[:E {tag:'bad', w:99}]->(c);

Only one of the two edges has tag = 'ok', so the expected count is 1.

-- correct (fixed length)
MATCH (a:A {v:1})-[r:E WHERE r.tag = 'ok']->(x:A) RETURN count(r) AS c;
-- c = 1

-- BUG: variable length, predicate ignored
MATCH (a:A {v:1})-[r:E*1..1 WHERE r.tag = 'ok']->(x:A) RETURN count(*) AS c;
-- c = 2
-- expected: c = 1

Proof that the predicate is dropped, not mis-evaluated

Query fragment Result Expected Verdict
-[r:E*1..1 WHERE r.tag = 'ok']-> 2 1 BUG
-[r:E*1..2 WHERE r.tag = 'ok']-> 2 1 BUG
-[r:E*1..1 WHERE false]-> 2 0 BUG (conclusive)
-[r:E*1..1 WHERE true]-> 2 2 OK
-[r:E*1..1 {tag:'ok'}]-> (property map) 1 1 OK
-[r:E*1..1]-> + clause WHERE all(e IN r WHERE e.tag = 'ok') 1 1 OK

WHERE false returning 2 rows is conclusive: the predicate never reaches the traversal.

Notes

Activity

  1. added this to the 26.8.1 milestone on Jul 28, 2026
  2. self-assigned this
    on Jul 28, 2026
  3. added a commit that references this issue on Jul 28, 2026
  4. added a commit that references this issue on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions