You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/queries/select-version.adoc
+34-7Lines changed: 34 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,27 +5,33 @@
5
5
Users can specify the version of Cypher in which they want to run their queries, choosing between Cypher 5 and Cypher 25.
6
6
The Cypher version can be set for individual queries or as the default language for a database.
7
7
8
+
[[cypher-versions-explained]]
8
9
== Cypher 5, Cypher 25, and Neo4j explained
9
10
10
11
Starting in 2025, the Neo4j server transitioned to a calendar-based versioning system.
11
12
This means Neo4j will no longer use its previous semantic versioning and release pattern (e.g., 5.25, 5.26).
12
13
Instead, releases from 2025 onwards will follow a *YYYY.MM* format, beginning with version 2025.01 released in January 2025, followed by 2025.02 released in February 2025, and so on.
13
14
14
-
Cypher 25 is introduced alongside Neo4j 2025.02 and is the default language for databases running version 2025.02 or later.
15
-
However, users running Neo4j version 2025.02 or later can choose to run their queries using the previous version of Cypher: Cypher 5.
15
+
Cypher 25 is introduced alongside Neo4j 2025.03 and is the default language for newly created databases running version 2025.03 or later.
16
+
However, users running Neo4j version 2025.03 or later can choose to run their queries using the previous version of Cypher: Cypher 5.
16
17
If so, Neo4j will use Cypher as it existed at the time of the Neo4j 5.26 long-term support release.
17
18
19
+
[NOTE]
20
+
Databases migrating to Neo4j 2025.03+ from earlier versions will continue to use Cypher 5 as their default language.
21
+
To change the default language on such databases, see xref:queries/select-version.adoc#alter-default-cypher-version[Alter the default Cypher version for a database] below.
22
+
18
23
For information about updates to Cypher in different Neo4j versions, see xref:deprecations-additions-removals-compatibility.adoc[].
19
24
For information about Cypher 5, see the link:https://neo4j.com/docs/cypher-manual/5/introduction/[Cypher 5 Manual].
20
25
26
+
[[selection-query-cypher-version]]
21
27
== Select the Cypher version for queries
22
28
23
29
To select the Cypher version of a query, prepend it with `CYPHER <language version>`.
24
30
25
31
Selecting `CYPHER 5` ensures that the query will be executed using the language as it existed at the time of the Neo4j 5.26 long-term support release.
26
-
Any changes introduced in Neo4j 2025.02 or later will not affect the query.
32
+
Any changes introduced in Neo4j 2025.03 or later will not affect the query.
27
33
28
-
Selecting `CYPHER 25` ensures that the query will be executed using the language as it exists in the version of Neo4j that the database is currently running, provided it is on Neo4j 2025.02 or later.
34
+
Selecting `CYPHER 25` ensures that the query will be executed using the language as it exists in the version of Neo4j that the database is currently running, provided it is on Neo4j 2025.03 or later.
29
35
30
36
Below are two examples showing the two versions of Cypher behaving differently.
31
37
@@ -104,6 +110,24 @@ SHOW CONSTRAINTS YIELD name, type
104
110
If a database has specified a default Cypher version, it is possible to set a different Cypher version for individual queries.
105
111
For example, if a database is created with Cypher 5 as its default language, prepending a query run on that database with `CYPHER 25` ensures the query uses Cypher 25.
106
112
113
+
[[procedures-and-functions]]
114
+
=== Procedures and functions
115
+
116
+
link:{neo4j-docs-base-uri}/operations-manual/current/procedures[Procedures] and xref:functions/index.adoc[functions] (including built-in and link:{neo4j-docs-base-uri}/apoc/current/[APOC]) are tied to a specific Cypher language version.
117
+
Therefore, procedures and functions in Neo4j 2025.03+ and APOC 2025.03+ (both of which have Cypher 25 as their default language), may behave differently depending on what version of Cypher is used.
118
+
119
+
For example, APOC 2025.03 removed Cypher 25 support of the procedure `apoc.create.uuids()`, meaning it is not available to queries running Cypher 25.
120
+
However, it can still be used on APOC 2025.03 if queries are prepended with `CYPHER 5`, or if the database’s default version is set to `CYPHER 5`.
121
+
In this case, Neo4j will use APOC and Cypher as they existed at the time of the 5.26 long-term support (LTS) release.
122
+
123
+
.Using a procedure removed in Cypher 25 with APOC 2025.03+
124
+
[source, cypher]
125
+
----
126
+
CYPHER 5
127
+
CALL apoc.create.uuids(10)
128
+
----
129
+
130
+
[[cypher-selection-with-other-query-options]]
107
131
=== Combine Cypher version selection with other query options
108
132
109
133
It is possible to combine Cypher version selection with other xref:planning-and-tuning/query-tuning.adoc[query options].
@@ -117,9 +141,10 @@ MATCH (n:Person)
117
141
RETURN n.name
118
142
----
119
143
144
+
[[select-default-cypher-version]]
120
145
== Select the default Cypher version when creating a database
121
146
122
-
Databases created on Neo4j 2025.02 or later will have Cypher 25 as their default language.
147
+
Databases created on Neo4j 2025.03 or later will have Cypher 25 as their default language.
123
148
This is true for the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/#manage-database-systems[system, standard, and composite] Neo4j databases.
124
149
125
150
To select a different default Cypher version for a database, add `DEFAULT LANGUAGE <language version>` to the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/[`CREATE DATABASE`] statement.
@@ -129,22 +154,23 @@ This can be done on any Neo4j database.
129
154
Selecting a default Cypher version on a database requires the `SET DEFAULT LANGUAGE` privilege.
130
155
131
156
Selecting `CYPHER 5` as the default database language ensures that every query run on that database uses the language as it existed at the time of the Neo4j 5.26 long-term support release.
132
-
Any changes introduced in Neo4j 2025.02 or later will not affect the query.
157
+
Any changes introduced in Neo4j 2025.03 or later will not affect the semantics of the query.
133
158
134
159
.Create a database with Cypher 5 as the default language
135
160
[source, cypher]
136
161
----
137
162
CREATE DATABASE my_database DEFAULT LANGUAGE CYPHER 5
138
163
----
139
164
140
-
Selecting `CYPHER 25` ensures that the query will be executed using the language as it exists in the version of Neo4j that the database is currently running, provided it is on Neo4j 2025.02 or later.
165
+
Selecting `CYPHER 25` ensures that the query will be executed using the language as it exists in the version of Neo4j that the database is currently running, provided it is on Neo4j 2025.03 or later.
141
166
142
167
.Create a database with Cypher 25 as the default language
143
168
[source, cypher]
144
169
----
145
170
CREATE DATABASE my_new_database DEFAULT LANGUAGE CYPHER 25
146
171
----
147
172
173
+
[[alter-default-cypher-version]]
148
174
== Alter the default Cypher version for a database
149
175
150
176
To alter the default Cypher version on a database, add `SET DEFAULT LANGUAGE <language version>` to the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/alter-databases/[`ALTER DATABASE`] command.
@@ -164,6 +190,7 @@ ALTER DATABASE my_new_database SET DEFAULT LANGUAGE CYPHER 5
164
190
ALTER DATABASE my_database SET DEFAULT LANGUAGE CYPHER 25
165
191
----
166
192
193
+
[[show-cypher-versions]]
167
194
== Show the Cypher version of databases
168
195
169
196
The Cypher version of a database can be seen using the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/listing-databases/[`SHOW DATABASES`] command as follows:
0 commit comments