Skip to content

Commit 7caf410

Browse files
Lojjsrenetapopova
authored andcommitted
Improve 42NAA docs:
- Mention parameters as the recommended approach - Change example to use CREATE ALIAS instead of CREATE DATABASE - Make it clearer which example queries only applies to Cypher 25
1 parent e5f5a76 commit 7caf410

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,51 @@ error: syntax error or access rule violation - incorrectly formatted graph refer
66
== Explanation
77
As of Cypher 25, database names and aliases cannot include name parts that are quoted individually.
88
Either the whole name must be quoted, or the whole name must be unquoted.
9+
A recommended approach, which is consistent between different commands and Cypher versions, is to send in the database name or alias as a parameter rather than a string literal.
910

1011
== Example scenario
11-
For example, try to create a database with :
12+
For example, try to create a database with
1213

1314
[source,cypher]
1415
----
15-
CREATE DATABASE `foo`.`bar`
16+
CYPHER 25 CREATE ALIAS `foo`.`bar` FOR DATABASE baz
1617
----
1718

18-
An error will be thrown with GQLSTATUS 42NAA and the status description:
19+
An error will be thrown with GQLSTATUS 42NAA and the status description
1920

2021
[source]
2122
----
2223
error: syntax error or access rule violation - incorrectly formatted graph reference. Incorrectly formatted graph reference '`foo`.`bar`'. Expected a single quoted or unquoted identifier. Separate name parts should not be quoted individually.
2324
----
2425

25-
In this example scenario, the correct quoting would either be
26+
In this example scenario, the preferred way is to send in the alias name as a parameter
27+
28+
.Parameters
29+
[source, parameters]
30+
----
31+
{
32+
"aliasName": "foo.bar"
33+
}
34+
----
35+
36+
.Query
37+
[source, cypher]
38+
----
39+
CREATE ALIAS $aliasName FOR DATABASE baz
40+
----
41+
42+
Alternatively, if a string literal is used, the correct quoting for Cypher 25 would either be
2643

2744
[source,cypher]
2845
----
29-
CREATE DATABASE `foo.bar`
46+
CYPHER 25 CREATE ALIAS `foo.bar` FOR DATABASE baz
3047
----
3148

3249
or
3350

3451
[source,cypher]
3552
----
36-
CREATE DATABASE foo.bar
53+
CYPHER 25 CREATE ALIAS foo.bar FOR DATABASE baz
3754
----
3855

3956
ifndef::backend-pdf[]

0 commit comments

Comments
 (0)