Neo4j: REMOVE property from nodes returned by an expression

Created on 17 Jan 2018  ยท  2Comments  ยท  Source: neo4j/neo4j

Neo4j raises error when I try to remove a property from a node given by an expression.

  • Neo4j version: 3.3.1, 3.2.3
  • Operating system: Debian Linux 9
  • API/Driver: bolt through webUI

Steps to reproduce

  1. Create 2 person nodes KNOWing each other in an empty database
CREATE (:Person {name: 'Alice', age: 23})-[:KNOWS]->(:Person {name:'Bob', age: 24})
  1. Remove the age from the older one of Alice and Bob by running the query:
MATCH (a:Person {name: 'Alice'})-[:KNOWS]->(b:Person {name: 'Bob'})
REMOVE CASE WHEN a.age>b.age THEN a ELSE b END.age
RETURN a, b

Expected behavior

Feedback should indicate that Set 1 property, and return Bob without age, Alice retaining age:

โ•’โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ••
โ”‚"a"                      โ”‚"b"           โ”‚
โ•žโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ก
โ”‚{"name":"Alice","age":23}โ”‚{"name":"Bob"}โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Actual behavior

The following error is raised in Neo4j:

Neo.DatabaseError.Statement.ExecutionFailed

REMOVE RemovePropertyItem(Property(CaseExpression(None,Vector((GreaterThan(Property(Variable(a),PropertyKeyName(age)),Property(Variable(b),PropertyKeyName(age))),Variable(a))),Some(Variable(b))),PropertyKeyName(age))) not supported in cost planner yet

Additional comment

This issue was first raised in opencypher/openCypher#287, where @Mats-SX pointed out that this used to work in Neo4j 2.3 and also in Cypher 2.3 compatibility mode using Neo4j 3.x, i.e. the following query produces the expected result.

CYPHER 2.3
MATCH (a:Person {name: 'Alice'})-[:KNOWS]->(b:Person {name: 'Bob'})
REMOVE CASE WHEN a.age>b.age THEN a ELSE b END.age
RETURN a, b
3.2 3.3 bug team-cypher

All 2 comments

@jmarton Thanks for reporting, this sounds like a bug in our cost planner. We will investigate this as soon as possible.

Best regards Louise, Neo4j Cypher team

@marton A fix for this bug will be included in the next patch releases for 3.2 and 3.3 (3.2.10 and 3.3.3)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apjanke picture apjanke  ยท  6Comments

szarnyasg picture szarnyasg  ยท  4Comments

Shib4 picture Shib4  ยท  5Comments

lassewesth picture lassewesth  ยท  5Comments

noorbakerally picture noorbakerally  ยท  3Comments