Cypher - What is the deference between myNode <> NULL and myNode IS NOT NULL?

Viewed 4227

I have two test queries

CREATE (a:TEST)
DELETE a
WITH a
WHERE a <> NULL
RETURN (a:TEST)

Which returns

Added 1 label, created 1 node, deleted 1 node, statement completed in 0 ms.

And

CREATE (a:TEST)
DELETE a
WITH a
WHERE a IS NOT NULL
RETURN (a:TEST)

Which returns

Node with id 1738 has been deleted in this transaction

According to the documentation, "<>" is the inequality operator. So my understanding is that "a <> NULL" and "a IS NOT NULL" are equivalent in Cypher. At the very least, I would expect "a IS NOT NULL" to be the more reliable filter (as it is its own dedicated compare operator). This seems like it might be an edge case bug of creating and deleting a node in the same transaction, but the documentation on IS NOT NULL doesn't say anything beyond (implied) "it is an operator", so this could be intentional if there is a subtle deference.

So why does a <> NULL work when a IS NOT NULL doesn't? AKA, What is the deference between these two comparisons?

I am using Cypher version 3.1, and Neo4j version 3.1.1

1 Answers
Related