Skip to content

Commit 75b37fe

Browse files
Add errors for unsupported combinations with path modes (#399)
New error codes (and one message update) for path mode semantic checking --------- Co-authored-by: Reneta Popova <[email protected]>
1 parent 325d78f commit 75b37fe

File tree

6 files changed

+115
-2
lines changed

6 files changed

+115
-2
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@
326326
**** xref:errors/gql-errors/42N57.adoc[]
327327
**** xref:errors/gql-errors/42N58.adoc[]
328328
**** xref:errors/gql-errors/42N59.adoc[]
329+
**** xref:errors/gql-errors/42N60.adoc[]
330+
**** xref:errors/gql-errors/42N61.adoc[]
329331
**** xref:errors/gql-errors/42N62.adoc[]
330332
**** xref:errors/gql-errors/42N63.adoc[]
331333
**** xref:errors/gql-errors/42N64.adoc[]

modules/ROOT/pages/errors/gql-errors/42I39.adoc

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
1+
:page-role: new-2025.11
12
= 42I39
23

34
== Status description
4-
error: syntax error or access rule violation - invalid use of shortest path function. Mixing the `{ <<fun>> }` function with path selectors or explicit match modes is not allowed.
5+
error: syntax error or access rule violation - invalid use of shortest path function. Mixing the `{ <<fun>> }` function with path selectors, explicit match modes, or explicit path modes is not allowed.
6+
7+
== Example scenario
8+
For example, in the following query `REPEATABLE ELEMENTS` is used with the `shortestPath()` function:
9+
10+
[source,cypher]
11+
----
12+
MATCH p = ACYCLIC shortestPath((:A)-[:R*0..10]->(:B))
13+
WHERE any(x IN nodes(p) WHERE x:X)
14+
RETURN p
15+
----
16+
This will result in an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001], with a cause detailed in xref:errors/gql-errors/42I39.adoc[42I39] and the following status description:
17+
18+
[source]
19+
----
20+
error: syntax error or access rule violation - invalid use of shortest path function. Mixing the `shortestPath()` function with path selectors, explicit match modes, or explicit path modes is not allowed.
21+
----
22+
23+
== Possible solution
24+
Replace `shortestPath()` with the `SHORTEST 1` path selector, and `allShortestPaths()` with the `SHORTEST ALL` path selector.
25+
26+
For example, the query above can be rewritten as:
27+
28+
[source,cypher]
29+
----
30+
MATCH p = SHORTEST 1 ACYCLIC (:A)-[:R*0..10]->(:B)
31+
WHERE any(x IN nodes(p) WHERE x:X)
32+
RETURN p
33+
----
534

635
ifndef::backend-pdf[]
736
[discrete.glossary]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
:page-role: new-2025.11
2+
= 42N60
3+
4+
== Status description
5+
error: syntax error or access rule violation - unsupported combination of match mode and path mode. `REPEATABLE ELEMENTS` with `{ <<pathMode>> }` path mode is not supported.
6+
7+
== Example scenario
8+
For example, in the following query `REPEATABLE ELEMENTS` is used with the `TRAIL` path mode:
9+
10+
[source,cypher]
11+
----
12+
MATCH REPEATABLE ELEMENTS p = TRAIL (:A)-[:R]->{,10}(:B)
13+
RETURN p
14+
----
15+
This will result in an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001], with a cause detailed in xref:errors/gql-errors/42N60.adoc[42N60] and the following status description:
16+
17+
[source]
18+
----
19+
error: syntax error or access rule violation - unsupported combination of match mode and path mode. `REPEATABLE ELEMENTS` with `TRAIL` path mode is not supported.
20+
----
21+
22+
ifndef::backend-pdf[]
23+
[discrete.glossary]
24+
== Glossary
25+
26+
include::partial$glossary.adoc[]
27+
endif::[]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
:page-role: new-2025.11
2+
= 42N61
3+
4+
== Status description
5+
error: syntax error or access rule violation - unsupported mixing of different path modes. Mixing `{ <<pathModeList>> }` in the same graph pattern is not supported. Split the pattern into separate `MATCH` clauses instead.
6+
7+
== Example scenario
8+
For example, in the following query `TRAIL` and `ACYCLIC` are used:
9+
10+
[source,cypher]
11+
----
12+
MATCH p = ACYCLIC (a:A)-[:P]->+(b:B),
13+
q = TRAIL (b)-[:Q]->+(a)
14+
RETURN p, q
15+
----
16+
This will result in an error with GQLSTATUS xref:errors/gql-errors/42001.adoc[42001], with a cause detailed in xref:errors/gql-errors/42N61.adoc[42N61] and the following status description:
17+
18+
[source]
19+
----
20+
error: syntax error or access rule violation - unsupported mixing of different path modes. Mixing `ACYCLIC` and `TRAIL` in the same graph pattern is not supported. Split the pattern into separate `MATCH` clauses instead.
21+
----
22+
23+
== Possible solution
24+
Split the graph pattern into separate `MATCH` clauses and use predicates to enforce relationship uniqueness across the set of paths.
25+
26+
For example, the above query can be rewritten as:
27+
28+
[source,cypher]
29+
----
30+
MATCH p = ACYCLIC (a:A)-[r1:P]->+(b:B)
31+
MATCH q = TRAIL (b)-[r2:Q WHERE NOT r2 IN r1]->+(a)
32+
RETURN p, q
33+
----
34+
35+
Here the predicate `NOT r2 IN r1` ensures that the relationships in path `q` do not overlap with those in path `p`, replicating the effect of Cypher's default match mode `DIFFERENT RELATIONSHIPS`.
36+
37+
ifndef::backend-pdf[]
38+
[discrete.glossary]
39+
== Glossary
40+
41+
include::partial$glossary.adoc[]
42+
endif::[]

modules/ROOT/pages/errors/gql-errors/index.adoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,9 +977,10 @@ Status description:: error: syntax error or access rule violation - invalid use
977977

978978
Status description:: error: syntax error or access rule violation - invalid use of `RETURN`. `RETURN ...` can only be used at the end of a query or subquery.
979979

980+
[role=label--new-2025.11]
980981
=== xref:errors/gql-errors/42I39.adoc[42I39]
981982

982-
Status description:: error: syntax error or access rule violation - invalid use of shortest path function. Mixing the `{ <<fun>> }` function with path selectors or explicit match modes is not allowed.
983+
Status description:: error: syntax error or access rule violation - invalid use of shortest path function. Mixing the `{ <<fun>> }` function with path selectors, explicit match modes, or explicit path modes is not allowed.
983984

984985
=== xref:errors/gql-errors/42I40.adoc[42I40]
985986

@@ -1337,6 +1338,16 @@ Status description:: error: syntax error or access rule violation - unsupported
13371338

13381339
Status description:: error: syntax error or access rule violation - variable already defined. Variable `{ <<variable>> }` already declared.
13391340

1341+
[role=label--new-2025.11]
1342+
=== xref:errors/gql-errors/42N60.adoc[42N60]
1343+
1344+
Status description:: error: syntax error or access rule violation - unsupported combination of match mode and path mode. `REPEATABLE ELEMENTS` with `{ <<pathMode>> }` path mode is not supported.
1345+
1346+
[role=label--new-2025.11]
1347+
=== xref:errors/gql-errors/42N61.adoc[42N61]
1348+
1349+
Status description:: error: syntax error or access rule violation - unsupported mixing of different path modes. Mixing `{ <<pathModeList>> }` in the same graph pattern is not supported. Split the pattern into separate `MATCH` clauses instead.
1350+
13401351
=== xref:errors/gql-errors/42N62.adoc[42N62]
13411352

13421353
Status description:: error: syntax error or access rule violation - variable not defined. Variable `{ <<variable>> }` not defined.

modules/ROOT/partials/glossary.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
[[param]]$param:: Parameter name, for example, `$pattern`.
8282
[[paramList]]$paramList:: A list of parameters, for example `$pattern, $prop`.
8383
[[pat]]$pat:: Pattern, for example, `(:Person)`.
84+
[[pathMode]]$pathMode:: GPM path mode, for example, `ACYCLIC`.
85+
[[pathModeList]]$pathModeList:: A list of GPM path modes, for example, `TRAIL, ACYCLIC`.
8486
[[port]]$port:: Port name, for example, `6362`.
8587
[[portList]]$portList:: A list of port names, for example, `6362, 6000, 7000`.
8688
[[pos]]$pos:: A position, for example, in a sequence, for example, `2`

0 commit comments

Comments
 (0)