From c9fc3c1773b366e15bdd4ebb00b25358f226db4c Mon Sep 17 00:00:00 2001 From: Gustav Hedengran Date: Mon, 13 Feb 2023 11:33:03 +0100 Subject: [PATCH 1/3] Add RepeatedRelationshipReference and provide example --- modules/ROOT/pages/changelogs.adoc | 10 +++++ .../notifications/all-notifications.adoc | 38 ++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/changelogs.adoc b/modules/ROOT/pages/changelogs.adoc index 93a1e165..f569c243 100644 --- a/modules/ROOT/pages/changelogs.adoc +++ b/modules/ROOT/pages/changelogs.adoc @@ -1,6 +1,16 @@ :description: This page lists all changes to status codes per Neo4j version. = Changes to status codes per Neo4j version +== Neo4j 5.5 + + +**New:** + +[source, status codes, role="noheader"] +----- +Status.Statement.RepeatedRelationshipReference +----- + == Neo4j 5.0 **New:** diff --git a/modules/ROOT/pages/notifications/all-notifications.adoc b/modules/ROOT/pages/notifications/all-notifications.adoc index c275fb36..9c8f1f1a 100644 --- a/modules/ROOT/pages/notifications/all-notifications.adoc +++ b/modules/ROOT/pages/notifications/all-notifications.adoc @@ -1042,4 +1042,40 @@ a|The query used a procedure that generated a warning. m|WARNING |Category m|GENERIC -|=== \ No newline at end of file +|=== + +[#_neo_clientnotification_statement_repeatedrelationshipreference] +=== Neo.ClientNotification.Statement.RepeatedRelationshipReference + +.Notification category details +[cols="<1s,<4"] +|=== +|Code +m|Neo.ClientNotification.Statement.RepeatedRelationshipReference +|Title +a|The query returns no results because a relationship variable is bound more than once. +|Severity +m|WARNING +|Category +m|GENERIC +|=== + +.Binding a relationship variable more than once. +==== +Query:: ++ +[source,cypher] +---- +MATCH (:A)-[r]->(), ()-[r]->(:B) RETURN r +---- +Description of the returned code:: +A relationship is referenced more than once in the query, which leads to no results because relationships must not occur more than once in each result. (Relationship `r` was repeated) + +Suggestions for improvement:: +In order to find all relationships which have a start node with label `A` and end node with label `B`, it could be rewritten to the following: ++ +[source, cypher, role="noplay"] +---- +MATCH (:A)-[r]->(:B) RETURN r +---- +==== From 1d053e94d254061a2a0e2f99612ae51918a8c5e5 Mon Sep 17 00:00:00 2001 From: Gustav Hedengran Date: Mon, 13 Feb 2023 13:47:05 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: LinneaAndersson --- modules/ROOT/pages/changelogs.adoc | 2 +- modules/ROOT/pages/notifications/all-notifications.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ROOT/pages/changelogs.adoc b/modules/ROOT/pages/changelogs.adoc index f569c243..9a733cfd 100644 --- a/modules/ROOT/pages/changelogs.adoc +++ b/modules/ROOT/pages/changelogs.adoc @@ -8,7 +8,7 @@ [source, status codes, role="noheader"] ----- -Status.Statement.RepeatedRelationshipReference +Neo.ClientNotification.Statement.RepeatedRelationshipReference ----- == Neo4j 5.0 diff --git a/modules/ROOT/pages/notifications/all-notifications.adoc b/modules/ROOT/pages/notifications/all-notifications.adoc index 9c8f1f1a..8502e001 100644 --- a/modules/ROOT/pages/notifications/all-notifications.adoc +++ b/modules/ROOT/pages/notifications/all-notifications.adoc @@ -1045,7 +1045,7 @@ m|GENERIC |=== [#_neo_clientnotification_statement_repeatedrelationshipreference] -=== Neo.ClientNotification.Statement.RepeatedRelationshipReference +=== Neo.ClientNotification.Statement.RepeatedRelationshipReference (when run on version 5.5 or newer) .Notification category details [cols="<1s,<4"] From 16cc1d3639b9856c95c0034754068f649cb7780d Mon Sep 17 00:00:00 2001 From: Gustav Hedengran Date: Tue, 14 Feb 2023 11:43:01 +0100 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Reneta Popova --- modules/ROOT/pages/notifications/all-notifications.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/notifications/all-notifications.adoc b/modules/ROOT/pages/notifications/all-notifications.adoc index 8502e001..e0fa576c 100644 --- a/modules/ROOT/pages/notifications/all-notifications.adoc +++ b/modules/ROOT/pages/notifications/all-notifications.adoc @@ -1072,7 +1072,7 @@ Description of the returned code:: A relationship is referenced more than once in the query, which leads to no results because relationships must not occur more than once in each result. (Relationship `r` was repeated) Suggestions for improvement:: -In order to find all relationships which have a start node with label `A` and end node with label `B`, it could be rewritten to the following: +Use one pattern to match all relationships that start with a node with the label `A` and end with a node with the label `B`: + [source, cypher, role="noplay"] ----