Repository navigation
Description
In a WHERE clause, (true) is parsed as the single-node pattern (true), not as the boolean literal in parentheses. After WITH, that pattern predicate never matches, so WHERE (true) removes every row and WHERE NOT (true) keeps every row. After MATCH, the same text is rejected with InvalidArgumentType: Single node pattern is not a valid predicate in WHERE (from the check in CypherSemanticValidator). The same literal without parentheses works (WITH 1 AS x WHERE true RETURN x returns [1]), and so does RETURN (true) AS x.
Neo4j 2026.08.1 returns, for the seven queries in order: [1], [], [1], [2, 3], [2, 3], [2, 3], and [1].
Repro
javac -cp 'lib/*' -d cls ParenthesizedLiteral.java
java -Xmx8g -XX:+UseCompactObjectHeaders --add-modules=jdk.incubator.vector --enable-native-access=ALL-UNNAMED -cp 'lib/*:cls' ParenthesizedLiteral /tmp/ParenthesizedLiteral-dblib/ holds the engine jar and its dependencies. On Temurin 21, use the same command without -XX:+UseCompactObjectHeaders.
import com.arcadedb.database.Database;
import com.arcadedb.database.DatabaseFactory;
import com.arcadedb.query.sql.executor.ResultSet;
import java.util.ArrayList;
import java.util.List;
public class ParenthesizedLiteral {
public static void main(String[] args) {
Database db = fresh(args[0]);
System.out.println("ArcadeDB " + com.arcadedb.Constants.getRawVersion() + " (" + com.arcadedb.Constants.getBuildNumber() + "), Java "
+ System.getProperty("java.version"));
db.transaction(() -> db.command("opencypher", "CREATE (:N {id: 1}), (:N {id: 2}), (:N {id: 3})"));
String[] queries = {
"WITH 1 AS x WHERE (true) RETURN x",
"WITH 1 AS x WHERE NOT (true) RETURN x",
"WITH 1 AS x WHERE NOT (false) RETURN x",
"MATCH (n:N) WITH n WHERE n.id > 1 AND (true) RETURN n.id AS id ORDER BY id",
"MATCH (n:N) WITH n WHERE n.id > 1 AND true RETURN n.id AS id ORDER BY id",
"MATCH (n:N) WHERE n.id > 1 AND (true) RETURN n.id AS id ORDER BY id",
"MATCH (n:N) WHERE (n.id = 1) OR (false) RETURN n.id AS id ORDER BY id" };
for (String q : queries)
System.out.println(q + " -> " + rows(db, q));
db.close();
}
static String rows(Database db, String q) {
List<String> out = new ArrayList<>();
try (ResultSet rs = db.query("opencypher", q)) {
rs.stream().forEach(r -> out.add(r.toJSON().toString()));
} catch (Exception e) {
return e.getClass().getSimpleName() + ": " + e.getMessage();
}
return out.toString();
}
static Database fresh(String path) {
DatabaseFactory factory = new DatabaseFactory(path);
if (factory.exists())
factory.open().drop();
return factory.create();
}
}Output on main at cecb369df9 (2026-10-03), embedded, on Temurin 25 with compact object headers (the engine jar's build stamp names 04bb03ebec, the newest commit in cecb369df9 that is not a merge). Temurin 21 prints the same lines apart from the Java version on the first line.
ArcadeDB 26.10.1-SNAPSHOT (04bb03ebec07fce19101595d65ca1e3bdf516755), Java 25.0.4
WITH 1 AS x WHERE (true) RETURN x -> []
WITH 1 AS x WHERE NOT (true) RETURN x -> [{"x":1}]
WITH 1 AS x WHERE NOT (false) RETURN x -> [{"x":1}]
MATCH (n:N) WITH n WHERE n.id > 1 AND (true) RETURN n.id AS id ORDER BY id -> []
MATCH (n:N) WITH n WHERE n.id > 1 AND true RETURN n.id AS id ORDER BY id -> [{"id":2}, {"id":3}]
MATCH (n:N) WHERE n.id > 1 AND (true) RETURN n.id AS id ORDER BY id -> CommandParsingException: InvalidArgumentType: Single node pattern is not a valid predicate in WHERE
MATCH (n:N) WHERE (n.id = 1) OR (false) RETURN n.id AS id ORDER BY id -> CommandParsingException: InvalidArgumentType: Single node pattern is not a valid predicate in WHERE
Versions affected: main cecb369df9, main 66541f57d9 (2026-10-02), main 417314c18 (2026-09-17), and 26.9.1 print the same lines, on Temurin 25 and Temurin 21.
Expected: a parenthesized literal is the literal: the seven queries return [{"x":1}], [], [{"x":1}], [{"id":2}, {"id":3}], [{"id":2}, {"id":3}], [{"id":2}, {"id":3}], and [{"id":1}].
Activity
lvca commentedon Oct 4, 2026
Confirmed and fixed in #9158 (26.10.1). A parenthesized
true,falseornullinWHEREis now the literal, not a node pattern. All seven queries return the Neo4j results.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(opencypher): code-point string functions, simple CASE list/map WH…
tae898 commentedon Oct 4, 2026
Verified the #9158 merge
eba27561b8on upstream main with the issue's reproduction, unchanged, against0bb737d458, main before the PR (the two merges in between, #9163 and #9118, change other code), on Temurin 25 with-XX:+UseCompactObjectHeadersand on Temurin 21. All seven queries now return Neo4j 2026.08.1's rows, on both JDKs:0bb737d458JDK 250bb737d458JDK 21eba27561b8JDK 25eba27561b8JDK 21WITH 1 AS x WHERE (true) RETURN x[1][][][1][1]WITH 1 AS x WHERE NOT (true) RETURN x[][1][1][][]WITH 1 AS x WHERE NOT (false) RETURN x[1][1][1][1][1]MATCH (n:N) WITH n WHERE n.id > 1 AND (true) ...[2, 3][][][2, 3][2, 3]MATCH (n:N) WITH n WHERE n.id > 1 AND true ...(control)[2, 3][2, 3][2, 3][2, 3][2, 3]MATCH (n:N) WHERE n.id > 1 AND (true) ...[2, 3][2, 3][2, 3]MATCH (n:N) WHERE (n.id = 1) OR (false) ...[1][1][1]"parse error" is
CommandParsingException: InvalidArgumentType: Single node pattern is not a valid predicate in WHERE. Main at417314c18d, named in the issue, prints the same lines as0bb737d458on both JDKs.A second check on the same three nodes plus one
Rrelationship also matches Neo4j on both JDKs: afterMATCH,WHERE (null),WHERE (TRUE),WHERE (False),WHERE n.id = 1 OR (true), andWHERE (n)-[:R]->() AND (true)now return Neo4j's rows (all were the same parse error),WITH 1 AS x WHERE ((true))now returns[1](was[]), andWITH 1 AS x WHERE NOT (null)now returns no row (was[1]). Pattern predicates are unchanged and still right:WHERE (n)-[:R]->(),WHERE NOT (n)-[:R]->(), andWHERE (n.id > 1)return the same rows on both builds.On the random test graphs behind the issue, the 128 queries with a parenthesized
true,false, ornullinsideWHEREthat failed to parse on0bb737d458now return Neo4j's rows on both JDKs. Across all 11,316 queries of those graphs, the only answers that changed between0bb737d458andeba27561b8are these and the simpleCASEand string function ones fixed by the same PR (#8996, #8998); no answer that matched Neo4j before changed.Thanks for the quick fix!
fix(opencypher): code-point string functions, simple CASE list/map WH…