Skip to content

Cypher: only first case seems to be considered in subroutine when using UNION #3772

Description

@Orkie

Sorry, last one for today! I have been trying to get one particular query working and working through the issues one by one.

# returns no results (wrong, neo4j returns success2 = 1)
WITH [] as toRemove
CALL {
  WITH toRemove WITH toRemove
  WHERE SIZE(toRemove) > 0
  RETURN 2 AS success2
  UNION
  WITH toRemove WITH toRemove
  WHERE SIZE(toRemove) = 0
  RETURN 1 AS success2
}
RETURN success2

# returns success2 = 2 (correct)
WITH ["a"] as toRemove
CALL {
  WITH toRemove WITH toRemove
  WHERE SIZE(toRemove) > 0
  RETURN 2 AS success2
  UNION
  WITH toRemove WITH toRemove
  WHERE SIZE(toRemove) = 0
  RETURN 1 AS success2
}
RETURN success2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions