neo4j/community — Issue #258: Escaping characters in a Cypher query
Author: peterneubauer
Created: 2012-02-17 16:23:17+00:00
State: open
Labels: bug, cypher

Filed by @ducky427 as https://github.com/neo4j/cypher-plugin/issues/5

I am using Neo4j server v1.6 and when I do a query of the sort through the Neo4j shell,

START n=node(3) MATCH (n)-[:KNOWS]->(a) WHERE (a.name = "Adam "S"") RETURN a

I get a SyntaxException: Unclosed parenthesis. There is a double quotes around A. I am using the same datamodel as in the Neo4j docs section 15.6.

I've tried the following and they haven't worked as well.

START n=node(3) MATCH (n)-[:KNOWS]->(a) WHERE (a.name = "Adam \"S\"") RETURN a
START n=node(3) MATCH (n)-[:KNOWS]->(a) WHERE (a.name = "Adam \\"S\ \"") RETURN a

I know I could try the following and it would work:

START n=node(3) MATCH (n)-[:KNOWS]->(a) WHERE (a.name = 'Adam "S"') RETURN a

So I replaced the outer double quotes with a single quotes. By what if the content had both types of quotes in it? Then I am back at the original problem.

Cheers