Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Comma appended to subquery parameter object for Cypher directive scalar field results in Cypher syntax error #204

Closed
johnymontana opened this issue Feb 22, 2019 · 4 comments

Comments

@johnymontana
Copy link
Member

With these type definitions:

totalSurface: Float 
  @cypher (
    statement: "MATCH (:Tract)<-[r:SURFACE_OWNERSHIP]-(this) return sum(r.net_surface_acres)"
  )
  totalMinerals: Float 
  @cypher (
    statement: "MATCH (:Tract)<-[r:MINERAL_OWNERSHIP]-(this) return sum(r.net_mineral_acres)"
  )

the generated Cypher query includes an extra comma at the end of the Cypher parameters object passed to apoc.cypher.runFirstColumn, resulting in a Cypher Syntax error:

MATCH (`owner`:`Owner` ) RETURN `owner` { .name ,totalSurface: apoc.cypher.runFirstColumn("MATCH (:Tract)<-[r:SURFACE_OWNERSHIP]-(this) return sum(r.net_surface_acres)", {this: owner, }, false),totalMinerals: apoc.cypher.runFirstColumn("MATCH (:Tract)<-[r:MINERAL_OWNERSHIP]-(this) return sum(r.net_mineral_acres)", {this: owner, }, false)} AS `owner` SKIP 0

{this: owner, } should be {this: owner}

This appears to have been introduced in v2.4.0

See discussion from Neo4j community forum.

@MuddyBootsCode
Copy link

I'd like to add that this error occurred with every query in our schema that had the @cypher directive. Not a single one would work.

@johnymontana
Copy link
Member Author

@MuddyBootsCode There should be a fix for this in v2.4.1. Could you give it a try and let us know if it resolves the problem?

@terrypan
Copy link

Having faced the same situation, v2.4.1 does fix the issue for me. Cheers @johnymontana

@iPwnPancakes
Copy link

@MuddyBootsCode and I are working on the same product. We are on 2.4.2 and I can confirm it is indeed working! Good stuff!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants