-
Notifications
You must be signed in to change notification settings - Fork 62
Select Cypher version #1123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select Cypher version #1123
Conversation
…cs-cypher into select_version
…cs-cypher into select_version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be a surprise that I have several comments XD
.Create a database with Cypher 5 as the default language | ||
[source, cypher] | ||
---- | ||
CREATE DATABASE my_database DEFAULT LANGUAGE CYPHER 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have linked back to these sections from the operations manual documentation of these commands. There doesn't seem much point documenting it twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all sections related to database administration should go to the Operations manual, and here, we can add just one link.
*Existing user databases:* `CYPHER 5` + | ||
*New user databases default:* `CYPHER 5` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add something like this for the remote alias case I mentioned on slack (in addition to having a short sentence about it somewhere as we discussed)
*Existing user databases:* `CYPHER 5` + | |
*New user databases default:* `CYPHER 5` | |
*Existing user databases:* `CYPHER 5` + | |
*Existing non-constituent remote database aliases:* `CYPHER 5` + | |
*New user databases and non-constituent remote database aliases default:* `CYPHER 5` |
(if yes, then we should also update the other two rows in the table)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we decided not to care about aliases on this page and leave that for the operations manual
…cs-cypher into select_version
|
||
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. | ||
This can be done on any Neo4j database. | ||
|
||
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 LTS release (unless a query is prepended with `CYPHER 25`, which overrides this default). | ||
Any changes introduced after 5.26 will not affect the semantics of the query. | ||
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 **TBC** release (unless a query is prepended with `CYPHER 25`, which overrides this default). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this bit seems more odd when considering CYPHER 5 is the default, it feels more like it's pointing out a difference to the default (probably due to being added to do just that before :P)
For information about Cypher 5, see the link:https://neo4j.com/docs/cypher-manual/5/introduction/[Cypher 5 Manual]. | ||
|
||
[NOTE] | ||
Although Cypher 5 queries are currently supported on Neo4j 2025.06+ databases, they will eventually need to be migrated to Cypher 25, as support for Cypher 5 will be discontinued in a future release (anticipated no earlier than two additional server LTS cycles). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we give a time horizon for when Cypher 5 will be discontinued? Or at least a no earlier than? As we say people are going to have to migrate eventually, it's useful for customers to know by when they need to allocate work to make it happen.
====== | ||
===== | ||
|
||
Selecting `CYPHER 25` ensures that all queries run on that database 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.06 or later (unless a query is prepended with `CYPHER 5`, which overrides this default). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selecting `CYPHER 25` ensures that all queries run on that database 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.06 or later (unless a query is prepended with `CYPHER 5`, which overrides this default). | |
Selecting `CYPHER 25` ensures that all queries run on that database 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.06 or later (unless a query is xref:selection-query-cypher-version[prepended with `CYPHER 5`], which overrides this default). |
To select the Cypher version of a query, prepend it with `CYPHER <language version>`. | ||
This selection will override the default language for the database the query is executed against, and allows you to either work with Cypher 25 features in a database that has Cypher 5 as the default language, or to continue running your Cypher 5 queries on a database that has Cypher 25 as the default language. | ||
|
||
Queries run with Cypher 5 will eventually need to be updated to Cypher 25 as support for Cypher 5 will be discontinued in the future (anticipated no earlier than two additional server LTS cycles). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, time horizon.
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.06 or later. | ||
|
||
Selecting `CYPHER 5` ensures that the query will be executed using the language as it existed at the time of the Neo4j 2025.05 release. | ||
Any changes introduced after the 2025.05 release will not affect the query. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this literally mean that no changes at all will go into Cypher 5 after 25 is out? If one takes this too literally it means no bugfixes or any form of improvement. I'd find clearer a rephrasing along the lines of using the language in its LTS form
.
|
||
For example, APOC 2025.06 removed Cypher 25 support of the procedure `apoc.create.uuids()`, meaning it is not available to queries running Cypher 25. | ||
However, it can still be used on APOC 2025.06 if queries are prepended with `CYPHER 5`, or if the database’s default version is set to `CYPHER 5`. | ||
In this case, Neo4j will use APOC and Cypher as they existed at the time of the 2025.05 release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
…cs-cypher into select_version
Thanks for the documentation updates. The preview documentation has now been torn down - reopening this PR will republish it. |
Operations manual PRs mentioned in this PR: - neo4j/docs-operations#2153 - neo4j/docs-operations#2116 TODO: Add clarifying note on Additions page --------- Co-authored-by: Stefano Ottolenghi <[email protected]>
Operations manual PRs mentioned in this PR: - neo4j/docs-operations#2153 - neo4j/docs-operations#2116 TODO: Add clarifying note on Additions page --------- Co-authored-by: Stefano Ottolenghi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this has been merged but I anyway wanted to take a look at what it ended up like before looking at the operations manual one and the additions/deprecations/removal page updates.
And of course I found some things :P It's mainly the two comments around needed privileges that actually needs some updates as at least one of them is straight up lying and one feels incomplete.
To select a default Cypher version when creating 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. | ||
|
||
[NOTE] | ||
Setting the default language requires the link:{neo4j-docs-base-uri}/operations-manual/current/authentication-authorization/dbms-administration/#access-control-dbms-administration-database-management[`SET DATABASE DEFAULT LANGUAGE` privilege]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only applies for the ALTER DATABASE command. For CREATE DATABASE and CREATE COMPOSITE DATABASE commands only the CREATE DATABASE/CREATE COMPOSITE DATABASE privileges are needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might not need the note at all since it should only say that to create you need privilege to create, which isn't anything new, in difference to that alter case that has new/separate privileges 🤷
.Cypher 25 | ||
[source,cypher] | ||
---- | ||
CREATE DATABASE actors DEFAULT LANGUAGE CYPHER 25 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CREATE DATABASE actors DEFAULT LANGUAGE CYPHER 25 | |
CREATE DATABASE actors SET DEFAULT LANGUAGE CYPHER 25 |
This is optional, I prefer having the SET 🤷
SET was added as an optional keyword in the Cypher 25 version of CREATE DATABASE (for all sub-clauses) and isn't available in Cypher 5
To alter the default Cypher version on an existing 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. | ||
|
||
[NOTE] | ||
Altering the default language requires the link:{neo4j-docs-base-uri}/operations-manual/current/authentication-authorization/dbms-administration/#access-control-dbms-administration-database-management[`SET DATABASE DEFAULT LANGUAGE` privilege]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only applies for standard and system database, for composite databases you'll need the ALTER COMPOSITE DATABASE privilege instead (it doesn't have a lower level privilege like the standard database case does).
*Existing user databases:* `CYPHER 5` + | ||
*New user databases default:* `CYPHER 5` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we decided not to care about aliases on this page and leave that for the operations manual
Operations manual PRs mentioned in this PR:
TODO: Add clarifying note on Additions page