-
Notifications
You must be signed in to change notification settings - Fork 193
Description
Memgraph version
3.6.1
Environment
Operating System: window 11
Installation Method: Docker
API: Docker
Describe the bug
When executing the following query on an empty graph:
OPTIONAL MATCH (n0)
WITH n0 AS alias0
WHERE false
MERGE (alias0) <-[:rt0]- (alias0)
RETURN *;
Memgraph incorrectly succeeds, returning:
No data returned.
Because the graph is empty, OPTIONAL MATCH (n0) already binds alias0 to NULL.
After WHERE false, all rows are removed and alias0 is still NULL.
According to Cypher semantics, MERGE must not accept NULL as a node variable.
It should raise a type error such as:
Expected a vertex for 'alias0', but got null.
Memgraph only raises this error when the WHERE false line is removed.
Expected behavior
Even in an empty graph, MERGE should validate its inputs and fail when the node variable is NULL.
The command should error with:
Expected a vertex for 'alias0', but got null.
Actual behavior
Memgraph silently succeeds and returns:
No data returned.