Skip to content

on_create_set() with set() generates invalid cypher #332

@aekobear

Description

@aekobear

I'm trying to merge a node, set a property if a new node was created, and set another property regardless of create or match. The cypher for this works perfectly:

MERGE (t:Thing { name: 'something' })
ON CREATE SET t.created = 'yes'
SET t.foo = 'bar'

However, the neo4j-core Query:

q.merge(t: { Thing: { name: 'something' } })
  .on_create_set(t: { created: 'yes' })
  .set(t: { foo: 'bar' })

generates the cypher:

MERGE (t:Thing { name: 'something' })
SET t.foo = 'bar'
ON CREATE SET t.created = 'yes'

which is invalid because ON CREATE must immediately follow MERGE.

Runtime information:

Neo4j database version: 3.5.6 (Community)
neo4j-core gem version: 9.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions