Search code examples
cyphermemgraphdbopencypher

Can reserved keyword be used as variable in Memgraph?


I'm starting to learn Cypher. I've read the openCypher specification, and I've spun up few different graph databases that use Cypher. At the moment I'm running Memgraph inside Docker.

Here is my query that works just fine

MATCH (p:Park)
WITH COLLECT(p) AS parks
CALL tsp.solve(parks) YIELD sources, destinations
WITH RANGE(0, SIZE(sources)-1) AS rows, sources, destinations
UNWIND rows AS unwind
RETURN sources[unwind] AS source, destinations[unwind] AS destination

The part that works, but I think that it shouldn't work is UNWIND rows AS unwind.

Under openCypher specification reserved keywords can't be variable names, but that's possible inside Memgraph.

If names of cypher commands/clauses are reserved, I shouldn't be able to use them as variable names. Am I right?


Solution

  • This is indeed a bug. I've checked the Memgraph GitHub issues, and this one is already reported.