Skip to content

Commit

Permalink
Added superfluous optional notification (#175)
Browse files Browse the repository at this point in the history
Notification from [OPTIONAL CALL
PR](neo-technology/neo4j#26755).

---------

Co-authored-by: Reneta Popova <[email protected]>
  • Loading branch information
JoelBergstrand and renetapopova authored Sep 17, 2024
1 parent 723874e commit f1d09ca
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/ROOT/pages/changelogs.adoc
Original file line number Diff line number Diff line change
@@ -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.24

**New:**

[source, status codes, role="noheader"]
-----
Neo.ClientNotification.Statement.RedundantOptionalProcedure
Neo.ClientNotification.Statement.RedundantOptionalSubquery
-----

== Neo4j 5.23

From version 5.23, Neo4j has a new GqlStatusObject API in addition to the existing Notification API.
Expand Down
155 changes: 155 additions & 0 deletions modules/ROOT/pages/notifications/all-notifications.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3544,6 +3544,161 @@ RETURN *
======
=====

[#_neo_clientnotification_statement_redundantoptionalprocedure]
=== Redundant optional procedure

.Notification details
[cols="<1s,<4"]
|===
|Neo4j code
m|Neo.ClientNotification.Statement.RedundantOptionalProcedure
|Title
a|The use of `OPTIONAL` is redundant when the procedure calls a void procedure.
|Description
|The use of `OPTIONAL` is redundant as `CALL %s` is a void procedure.
|Category
m|GENERIC
|GQLSTATUS code
m|03N61
|Status description
a|info: redundant optional procedure. The use of `OPTIONAL` is redundant as `CALL %s` is a void procedure.
|Classification
m|GENERIC
|SeverityLevel
m|INFORMATION
|===

.Redundant use of `OPTIONAL` in a procedure call
[.tabbed-example]
=====
[.include-with-neo4j-code]
======
Query::
+
[source,cypher]
----
OPTIONAL CALL db.createLabel("A")
----

Description of the returned code::
The use of `OPTIONAL` is redundant as `CALL db.createLabel` is a void procedure.

Suggestions for improvement::
If the intended behavior of the query is to use a void procedure, the `OPTIONAL` keyword can be removed without impacting the query.
+
[source,cypher]
----
CALL db.createLabel("A")
----
======
[.include-with-GQLSTATUS-code]
======
Query::
+
[source,cypher]
----
OPTIONAL CALL db.createLabel("A")
----
Returned GQLSTATUS code::
03N61

Returned status description::
info: redundant optional procedure. The use of `OPTIONAL` is redundant as `CALL db.createLabel` is a void procedure.

Suggestions for improvement::
If the intended behavior of the query is to use a void procedure, the `OPTIONAL` keyword can be removed without impacting the query.
+
[source,cypher]
----
CALL db.createLabel("A")
----
======
=====

[#_neo_clientnotification_statement_redundantoptionalsubquery]
=== Redundant optional subquery

.Notification details
[cols="<1s,<4"]
|===
|Neo4j code
m|Neo.ClientNotification.Statement.RedundantOptionalSubquery
|Title
a|The use of `OPTIONAL` is redundant when `CALL` is a unit subquery.
|Description
|The use of `OPTIONAL` is redundant as `CALL` is a unit subquery.
|Category
m|GENERIC
|GQLSTATUS code
m|03N62
|Status description
a|info: redundant optional subquery. The use of `OPTIONAL` is redundant as `CALL` is a unit subquery.
|Classification
m|GENERIC
|SeverityLevel
m|INFORMATION
|===

.Redundant use of `OPTIONAL` in a `CALL` subquery
[.tabbed-example]
=====
[.include-with-neo4j-code]
======
Query::
+
[source,cypher]
----
UNWIND [1, 2, 3] AS x
OPTIONAL CALL (x) {
CREATE({i:x})
}
----

Description of the returned code::
Optional is redundant in the case of a unit subquery. The use of `OPTIONAL` on unit subqueries have no effect and can be removed.

Suggestions for improvement::
If the intended behavior of the query is for the subquery not to return any values, the `OPTIONAL` keyword can be removed without impacting the query.
+
[source,cypher]
----
UNWIND [1, 2, 3] AS x
CALL (x) {
CREATE({i:x})
}
----
======
[.include-with-GQLSTATUS-code]
======
Query::
+
[source,cypher]
----
UNWIND [1, 2, 3] AS x
OPTIONAL CALL (x) {
CREATE({i:x})
}
----

Returned GQLSTATUS code::
03N62

Description of the returned code::
info: redundant optional subquery. The use of `OPTIONAL` is redundant as `CALL` is a unit subquery.

Suggestions for improvement::
If the intended behavior of the query is for the subquery not to return any values, the `OPTIONAL` keyword can be removed without impacting the query.
+
[source,cypher]
----
UNWIND [1, 2, 3] AS x
CALL (x) {
CREATE({i:x})
}
----
======
=====

[#_neo_clientnotification_statement_parameternotprovided]
=== Parameter missing

Expand Down

0 comments on commit f1d09ca

Please sign in to comment.