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
@@ -77,8 +77,6 @@ It will be updated to say `Node property uniqueness constraints added: 1` in a f
77
77
.Create a relationship property uniqueness constraint on a single property label:new[Introduced in 5.7]
78
78
======
79
79
80
-
A relationship property uniqueness constraint ensures that certain relationships have a set of specified properties whose combined value is unique when all properties exist on the relationship.
81
-
82
80
.Create a constraint requiring `SEQUEL_OF` relationships to have unique `order` properties
83
81
[source, cypher]
84
82
----
@@ -212,8 +210,6 @@ It is not possible to create composite existence constraints on several properti
212
210
.Create a node property existence constraint
213
211
======
214
212
215
-
A node property existence constraint ensures that certain nodes have a specified property.
216
-
217
213
.Create a constraint requiring `Author` nodes to have a `name` property
218
214
[source, cypher]
219
215
----
@@ -233,8 +229,6 @@ Added 1 constraint.
233
229
.Create a relationship property existence constraint
234
230
======
235
231
236
-
A relationship property existence constraint ensures that certain relationships have a certain property.
237
-
238
232
.Create a constraint requiring `WROTE` relationships to have a `year` property
239
233
[source, cypher]
240
234
----
@@ -321,8 +315,6 @@ It is not possible to create composite property type constraints on several prop
321
315
.Create a node property type constraint
322
316
======
323
317
324
-
A node property existence constraint ensures that certain nodes have a specified property.
325
-
326
318
.Create a constraint requiring `title` properties on `Movie` nodes to be of type `STRING`
327
319
[source, cypher]
328
320
----
@@ -331,7 +323,7 @@ FOR (movie:Movie) REQUIRE movie.title IS :: STRING
331
323
----
332
324
333
325
.Result
334
-
[queryresult]
326
+
[source, queryresult]
335
327
----
336
328
Added 1 constraint.
337
329
----
@@ -340,8 +332,6 @@ Added 1 constraint.
340
332
.Create a relationship property type constraint
341
333
======
342
334
343
-
A relationship property existence constraint ensures that certain relationships have a certain property.
344
-
345
335
.Create a constraint requiring `order` properties on `PART_OF` relationships to be of type `INTEGER`
346
336
[source, cypher]
347
337
----
@@ -505,8 +495,6 @@ For the full command syntax to create a key constraint, see xref:constraints/syn
505
495
.Create a node key constraint on a single property
506
496
======
507
497
508
-
A node key constraint ensures that certain nodes have a set of specified properties whose combined value is unique and all properties in the set are present.
509
-
510
498
.Create a constraint requiring `Director` nodes to have a unique `imdbId` property as a node key.
511
499
[source, cypher]
512
500
----
@@ -526,9 +514,6 @@ Added 1 constraint.
526
514
.Create a relationship key constraint on a single property label:new[Introduced in 5.7]
527
515
======
528
516
529
-
A relationship key constraint ensures that certain relationships have a set of defined properties whose combined value is unique.
530
-
It also ensures that all properties in the set are present.
531
-
532
517
.Create a constraint requiring `OWNS` relationships to have a unique `ownershipId` property as a relationship key
533
518
[source, cypher]
534
519
----
@@ -578,9 +563,6 @@ Added 1 constraint.
578
563
.Create a composite relationship key constraint label on multiple properties label:new[Introduced in 5.7]
579
564
======
580
565
581
-
A relationship key constraint ensures that certain relationships have a set of defined properties whose combined value is unique.
582
-
It also ensures that all properties in the set are present.
583
-
584
566
.Create a constraint requiring `KNOWS` relationships to have a unique combination of `since` and `how` properties as a relationship key
585
567
[source, cypher]
586
568
----
@@ -636,6 +618,7 @@ Added 2 labels, created 2 nodes, set 6 properties, created 1 relationship.
636
618
637
619
638
620
[role=label--new-5.16]
621
+
[[create-constraint-with-parameter]]
639
622
=== Create a constraint with a parameter
640
623
641
624
All constraint types can be created with a parameterized name.
=== Multiple constraints on the same property combinations
697
680
698
681
Some constraint types are allowed on the same label/relationship type and property combination.
@@ -838,11 +821,17 @@ There are no valid index configuration values for the constraint-backing range i
838
821
=== Handling existing constraints when creating a constraint
839
822
840
823
Creating an already existing constraint will fail.
824
+
This includes:
825
+
826
+
* Creating a constraint identical to a constraint already in the database.
827
+
* Creating a constraint with a different name but on the same schema as a constraint already in the database.
828
+
* Creating a constraint with the same name but on a different schema as a constraint already in the database.
829
+
841
830
To avoid such an error, `IF NOT EXISTS` can be added to the `CREATE` command.
842
831
This will ensure that no error is thrown and that no constraint is created if any other constraint with the given name, or another constraint on the same constraint type and schema, or both, already exists.
843
832
As of Neo4j 5.17, an informational notification is instead returned showing the existing constraint which blocks the creation.
844
833
845
-
.Create a relationship property uniqueness constraint when a constraint with the same name exists
834
+
.Create a relationship property uniqueness constraint when an identical constraint already exists
846
835
======
847
836
848
837
.Create a constraint requiring all `SEQUEL_OF` relationships to have unique `order` properties
@@ -864,85 +853,78 @@ Because the same constraint already exists, nothing will happen:
864
853
[source]
865
854
----
866
855
`CREATE CONSTRAINT sequels IF NOT EXISTS FOR ()-[e:SEQUEL_OF]-() REQUIRE (e.order) IS UNIQUE` has no effect.
867
-
`CONSTRAINT sequels FOR ()-[e:SEQUEL_OF]-() REQUIRE (e.order, e.seriesTitle) IS UNIQUE` already exists.
856
+
`CONSTRAINT sequels FOR ()-[e:SEQUEL_OF]-() REQUIRE (e.order) IS UNIQUE` already exists.
0 commit comments