Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apoc.refactor.cloneNodes() not compatible with (existence + unique) or node key constraints #2780

Closed
InverseFalcon opened this issue Apr 20, 2022 · 0 comments · Fixed by #2845

Comments

@InverseFalcon
Copy link
Collaborator

Expected Behavior (Mandatory)

Execution of apoc.refactor.cloneNodes() (and other clone operations) should be able to succeed even when existence and node key constraints are on the nodes in question, provided that the outcome of the refactoring should not violate the constraints

Actual Behavior (Mandatory)

The refactoring fails, producing an error indicating a constraint violation. This appears to be because the refactoring first creates empty nodes with the given labels and then later populates their properties, tripping on the existence requirements of the constraints.

Note that when ONLY an existence constraint is present the refactoring will succeed, but if either existence + unique constraints are present on the same properties, or a NODE KEY constraint is present, the attempt will fail.

We may need to reorder the operations such that the labels are applied after properties are set, instead of before.

How to Reproduce the Problem

Steps (Mandatory)

  1. Use :play movies from the browser to create the sample graph in an empty db.
  2. Execute CREATE CONSTRAINT ON (p:Movie) ASSERT (p.title, p.released) IS NODE KEY
  3. Execute the following:
MATCH (m:Movie) 
WITH m 
LIMIT 5
CALL apoc.refactor.cloneNodes([m], true) YIELD input, output 
RETURN output

The error will occur.

Alternately, create both a unique constraint and an existence constraint on the same property and attempt the clone operation, the same kind of error should occur

Specifications (Mandatory)

Currently used versions:

Versions

  • Neo4j: 4.3.10, 4.4.4
  • Neo4j-Apoc: 4.3.x.x, 4.4.0.3
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this issue May 3, 2022
…ocedures internally handle errors instead of throwing them, leaving half-created results
vga91 added a commit that referenced this issue May 20, 2022
… errors instead of throwing them, leaving half-created results (#2845)
neo4j-oss-build pushed a commit that referenced this issue May 20, 2022
… errors instead of throwing them, leaving half-created results (#2845)
vga91 pushed a commit that referenced this issue May 20, 2022
… errors instead of throwing them, leaving half-created results (#2845) (#2921)
neo4j-oss-build added a commit that referenced this issue May 20, 2022
… errors instead of throwing them, leaving half-created results (#2845) (#2921)
vga91 pushed a commit that referenced this issue May 25, 2022
… errors instead of throwing them, leaving half-created results (#2845) (#2921) (#2923)
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this issue May 25, 2022
…ocedures internally handle errors instead of throwing them, leaving half-created results (neo4j-contrib#2845)
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this issue May 25, 2022
…ocedures internally handle errors instead of throwing them, leaving half-created results (neo4j-contrib#2845)
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this issue May 26, 2022
…ocedures internally handle errors instead of throwing them, leaving half-created results (neo4j-contrib#2845)
vga91 added a commit that referenced this issue May 27, 2022
… errors instead of throwing them, leaving half-created results (#2845)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant