Skip to content

Commit a0b3a06

Browse files
authored
Update docs to clarify that IF NOT EXISTS check for both databases and database aliases (#2573)
catching all graph references and not just within their own category also fix other minor things I noticed
1 parent 8b25ec9 commit a0b3a06

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,10 @@ SHOW ALIAS `northwind` FOR DATABASE
316316

317317
The `CREATE ALIAS` command is optionally idempotent, with the default behavior to fail with an error if the database alias already exists.
318318
To work around this, you can append `IF EXISTS` or `OR REPLACE` to the command.
319-
Both check for any remote or local database aliases.
319+
Both check for any remote or local database aliases with the given name, `IF NOT EXISTS` also check for existing databases with the given name.
320320

321321
* Appending `IF NOT EXISTS` to the command.
322-
This ensures that no error is returned and nothing happens should the database alias already exist.
322+
This ensures that no error is returned and nothing happens should a database or database alias with that name already exist.
323323
+
324324
.Query
325325
[source, cypher]
@@ -328,7 +328,7 @@ CREATE ALIAS `northwind` IF NOT EXISTS FOR DATABASE `northwind-graph-2021`
328328
----
329329

330330
* Appending `OR REPLACE` to the command.
331-
This means that if the database alias already exists, it will be replaced with the new one.
331+
This means that if a database alias with that name already exists, it will be replaced with the new one.
332332
+
333333
.Query
334334
[source, cypher]
@@ -417,7 +417,7 @@ FOR DATABASE
417417

418418
You can also use `IF EXISTS` or `OR REPLACE` when creating remote database aliases.
419419
It works the same way as described in the <<_use_if_exists_or_or_replace_when_creating_database_aliases, Use `IF EXISTS` or `OR REPLACE` when creating database aliases>> section.
420-
Both check for any remote or local database aliases.
420+
Both check for any remote or local database aliases (with `IF NOT EXISTS` also checking for databases).
421421

422422

423423
[[alias-management-create-remote-database-alias-driver-settings]]

modules/ROOT/pages/database-administration/composite-databases/create-composite-databases.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Composite databases are managed using Cypher(R) administrative commands.
88
Note that it is not possible to modify access options or database topologies for composite databases as these are inherited from the constituent databases.
99
For information about modifying access options, see xref:database-administration/standard-databases/alter-databases.adoc#manage-databases-alter[Alter database access mode].
10-
For information about about topologies for databases, see xref:clustering/setup/deploy.adoc#cluster-example-create-databases-on-cluster[Create databases in a cluster].
10+
For information about topologies for databases, see xref:clustering/setup/deploy.adoc#cluster-example-create-databases-on-cluster[Create databases in a cluster].
1111

1212
Drivers and client applications connect to composite databases just like standard databases.
1313
For more information, see the manuals for the different link:{neo4j-docs-base-uri}/create-applications/[Neo4j drivers and applications].
@@ -18,8 +18,8 @@ For more information, see the manuals for the different link:{neo4j-docs-base-ur
1818
Composite databases can be created using `CREATE COMPOSITE DATABASE`.
1919

2020
Composite database names are subject to the same rules as xref:database-administration/standard-databases/naming-databases.adoc[standard databases].
21-
One difference is however that the deprecated syntax using dots without enclosing the name in backticks is not available.
22-
Both dots and dashes need to be enclosed within backticks when using composite databases.
21+
One difference is however that in Cypher 5, the syntax using dots without enclosing the name in backticks is not available.
22+
Both dots and dashes need to be enclosed within backticks when using composite databases in Cypher 5.
2323

2424
[NOTE]
2525
====
@@ -66,7 +66,7 @@ For information about creating aliases in composite databases, see xref:database
6666
The `CREATE COMPOSITE DATABASE` command is optionally idempotent, with the default behavior to fail with an error if the database already exists.
6767
There are two ways to circumvent this behavior.
6868

69-
First, appending `IF NOT EXISTS` to the command ensures that no error is returned and nothing happens should the database already exist.
69+
First, appending `IF NOT EXISTS` to the command ensures that no error is returned and nothing happens should a database or database alias with the given name already exist.
7070

7171
.Query
7272
[source, cypher]
@@ -87,6 +87,7 @@ CREATE OR REPLACE COMPOSITE DATABASE inventory
8787
This is equivalent to running `DROP DATABASE inventory IF EXISTS` followed by `CREATE COMPOSITE DATABASE inventory`.
8888

8989
The behavior of `IF NOT EXISTS` and `OR REPLACE` apply to both standard and composite databases (e.g. a composite database may replace a standard database or another composite database).
90+
`IF NOT EXISTS` also catches if any database aliases with the given name exists and does nothing instead of throwing an error on existing alias sharing the name.
9091

9192
[NOTE]
9293
====

modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ In this example, all three cluster members have returned `03N85 (Neo.ClientNotif
334334
The `CREATE DATABASE` command is optionally idempotent, with the default behavior to fail with an error if the database already exists.
335335
There are two ways to circumvent this behavior.
336336

337-
First, appending `IF NOT EXISTS` to the command ensures that no error is returned and that nothing happens if the database already exists.
337+
First, appending `IF NOT EXISTS` to the command ensures that no error is returned and that nothing happens if a database or database alias with the given name already exist.
338338

339339
[source, cypher]
340340
----
@@ -366,6 +366,7 @@ RETURN createStatement AS statement
366366
----
367367

368368
The behavior of `IF NOT EXISTS` and `OR REPLACE` apply to both standard and composite databases (e.g. a composite database may replace a standard database or another composite database).
369+
`IF NOT EXISTS` also catches if any database aliases with the given name exists and does nothing instead of throwing an error on existing alias sharing the name.
369370

370371
[NOTE]
371372
====

0 commit comments

Comments
 (0)