Hi!

I'm trying to do some property updates with an OPTIONAL MATCH, and having a 
bit of trouble. It's OK when the OPTIONAL MATCH's pattern matches 
something, but when it doesn't, I get a "ThisShouldNotHappenError" with the 
message "Developer: Stefan claims that: This should be a node or a 
relationship".

For example, given a graph that looks something like this:

(node:TestThing1)-[:rel1]->(node2)-[:rel2]->(node3)

The following works:

MATCH (n:TestThing1) OPTIONAL MATCH n-[:rel1]->x SET x.updated = timestamp()

but the following will throw the aforementioned exception:

MATCH (n:TestThing1) OPTIONAL MATCH n-[:rel2]->x SET x.updated = timestamp()

I would have expected that it would silently do nothing at all when the 
OPTIONAL MATCH condition does not match anything, or to have to explicitly 
specify that the SET should not proceed when "x" is null. As far as I can 
tell there's no way for me to do the latter without affecting "n"'s value.

I am using OPTIONAL MATCH because this is in the context of a larger query, 
which I've omitted here for clarity's sake, but for that reason I can't 
solve this problem by just using a normal MATCH instead.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to