Skip to content

Commit

Permalink
Add ALL keyword to RETURN clause as part of GQL compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
gem-neo4j committed Dec 20, 2024
1 parent f850924 commit 80d4f1c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ The only way to guarantee row order in Neo4j is to use xref:clauses/order-by.ado
| 14.11
| <return statement>
| xref:clauses/return.adoc[`RETURN`]
| GQL defines the option to specify `RETURN ALL` (functionally equivalent to using `RETURN` on its own).
This is currently not available in Cypher.
|

| 16.2
| <limit clause>
Expand Down
23 changes: 23 additions & 0 deletions modules/ROOT/pages/clauses/return.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,26 @@ The `Movie` node `'Man of Tai Chi'` is returned by the query, but only once (wit
d|Rows: 1
|===

[[return-all-results]]
== RETURN ALL

Returning all results can also be accomplished by explicitly including `ALL` in the `RETURN`.
The `RETURN ALL` keyword was introduced as part of Cypher's xref:appendix/gql-conformance/index.adoc[], and using it is functionally the same as using simple `RETURN`.

.Query
[source, cypher]
----
MATCH (p:Person {name: 'Keanu Reeves'})-->(m)
RETURN ALL m
----

The same node is returned twice, as there are two relationships connecting to it from `'Keanu Reeves'`.

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| m
| {"title":"Man of Tai Chi","released":2013}+
| {"title":"Man of Tai Chi","released":2013}+
d|Rows: 1
|===
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@ Several xref:clauses/transaction-clauses.adoc#query-listing-transactions[`SHOW
* The current query-related columns — `currentQuery`, `currentQueryId`, `parameters`, `planner`, `runtime`, `indexes`, `currentQueryStartTime`, `currentQueryElapsedTime`, `currentQueryCpuTime`, `currentQueryIdleTime`, and `currentQueryStatus` — now return `null` when no query is executing.
|===

=== New features

[cols="2", options="header"]
|===
| Feature
| Details

a|
label:functionality[]
label:new[]
[source, cypher, role=noheader]
----
MATCH (n)
RETURN ALL n.prop AS prop
----
| The keyword `ALL` can now be added after a xref:clauses/return.adoc#return-all-results[RETURN] as the explicit form of a `RETURN` without duplicate removal.

|===

[[cypher-deprecations-additions-removals-5.26]]
== Neo4j 5.26

Expand Down

0 comments on commit 80d4f1c

Please sign in to comment.