-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify the behaviour of deleted elements #332
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few changes introduced in this proposal that may be more or less controversial.
I have highlighted the changes in the comments below.
These semantics effect the `DELETE` statement itself, even if not succeeded by further read statements, since the same element can occur in multiple rows in the driving table. | ||
|
||
|
||
=== Accessing properties of deleted Elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change from current behaviour.
This is the main change that people seem to agree that we want from this change proposal.
|
||
Accessing properties of deleted elements produces a `NULL` value, just like accessing a property from a `NULL` value would. | ||
|
||
=== Pattern matching on deleted Elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change from current behaviour.
Currently pattern matching on NULL
produces 0 rows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we deviate from the "behaves like null" in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proposal in this section is to have this be the behaviour for all nulls.
|
||
Pattern matching on deleted elements produces a single row containing only `NULL` bindings, in the same way as `OPTIONAL MATCH` would. | ||
|
||
=== Deleting deleted Elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as current behaviour, but should still be documented.
|
||
Deleting a deleted element (or any `NULL` value) is a no-op. | ||
|
||
=== Equality of deleted Elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change from current behaviour, where two references to the same element are considered equal even after the element has been deleted.
RETURN same1, n = m AS same2 | ||
---- | ||
|
||
=== Deleted elements in paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a change from current behaviour.
The controversial part of it is that it could be argued that it might be expensive to implement such checking to see if the elements of the path have been deleted. I would argue that since all operations on a path accesses all the elements anyhow, the cost of such checking is negligible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nice thing about this behaviour for paths is that it works really well with the (intended) behaviour of UNWIND
, where for example UNWIND nodes(p) AS n
would produce a single row with n
bound to NULL
if an element of p
was deleted (since p
would be considered NULL
and nodes(NULL)
returns NULL
, and UNWIND NULL AS n
produces a single row with n
bound to NULL
).
It has become evident that there are some inconsistencies and unhelpful behaviour around the handling of deleted elements. This proposal aims to rectify that.
Aims to specify the semantics requested in #263
CIP2018-10-19