Mathieson
Mathieson

Reputation: 1948

Cyper - odd error when creating relationship

I've got the following query, which responds with the very cryptic error message of

"Invalid input 'H': expected 'i/I' (line 2, column 2)"

Here's the query:

CREATE UNIQUE (c:AccountCharge)-[:ACCOUNT_CHARGED]->(a:Account)
WHERE (a.ID = "a7f7def6-8f2b-4b21-bfac-dab2f6e6eaae")
AND (c.ID = "666b1865-e29d-455b-abb0-50d679952543")

Both the nodes exist, and I can't see where there's a break anywhere, but Neo4J does not like it at all.

The query's being created by C# Neo4JClient, but even retyping it manually I still get the same error, so it's not a hidden character or anything.

Upvotes: 5

Views: 2825

Answers (1)

Christophe Willemsen
Christophe Willemsen

Reputation: 20185

WHERE can only be used with the MATCH clause.

The expected I is because for cypher the possible clause after a CREATE is a WITH clause, so the second letter is a I instead of a H.

You should then first MATCH the two nodes and create the unique relationship afterwards

Upvotes: 9

Related Questions