Repository navigation
Neo4j: isNull and isNotNull on an association test the relationship - #16836
borinquenkid wants to merge 15 commits into
Conversation
An association is stored as a relationship, so n.parent IS NULL is true for every node. isNull now becomes NOT (n)-[:PARENT]->(:Folder) and isNotNull the pattern itself. Plain properties and relationship entities are unchanged. Fixes #16584 Claude-Session: https://claude.ai/code/session_01Dmki4SQGwRSj8pRJ5KCWyX
jdaugherty
left a comment
There was a problem hiding this comment.
For a criterion on the root entity the fix does what it says. isNull / isNotNull return the right rows on a to-one, a to-many, the inverse side of a bidirectional association and an association to a relationship entity, and so do findAllBy<Association>IsNull, findAllBy<Association>(null), where { association == null }, not { }, or { } and deleteAll(). Without the main change three of the four features of IsNullAssociationSpec fail, and with it the Neo4j core suite passes.
What has to change before this goes in:
- Criteria nested in an association resolve the property on the wrong entity. One query that was right on 8.0.x now returns wrong rows, and the nested form of #16584 is not fixed.
- The change in results needs an upgrade note.
- The relationship entity guard and most branches of the new pattern have no test.
#16583 carries its own copy of this change for 9.0.x, written inline in both handlers, with an Embedded exclusion and a RelationshipMappingSpec feature that this PR does not have. Both edit the same lines, so the merge up will conflict unless the copy in #16583 is dropped once this one is merged.
| CypherExpression handle(GraphPersistentEntity entity, Query.IsNull criterion, CypherBuilder builder, String prefix) { | ||
| String relationship = associationRelationshipPattern(entity, criterion.property, prefix) | ||
| if (relationship != null) { | ||
| return new CypherExpression("NOT ${relationship}") |
There was a problem hiding this comment.
This changes the rows existing queries return, so it needs a section in the Grails 8 upgrade guide (grails-doc/src/en/guide/upgrading/upgrading80x.adoc), also when the earlier result was a bug. For GORM for Neo4j the note has to cover:
isNullon an association returned every instance and now returns only those without the relationship;isNotNullreturned none and now returns those with it.- The same holds for
findAllBy<Association>IsNull/IsNotNull,findAllBy<Association>(null), thecountByforms, andwhere { association == null }/!= null. - On a to-many association,
isNullnow means the collection has no element. deleteAll()andupdateAll()follow the query:Pet.where { owner == null }.deleteAll()deleted every pet on 8.0.x and now deletes only the pets without an owner.
It should also say how to get the earlier rows back, which is to remove the criterion.
| CypherExpression handle(GraphPersistentEntity entity, Query.IsNotNull criterion, CypherBuilder builder, String prefix) { | ||
| String relationship = associationRelationshipPattern(entity, criterion.property, prefix) | ||
| if (relationship != null) { | ||
| return new CypherExpression("${relationship}") |
There was a problem hiding this comment.
Nit: new CypherExpression(relationship). The GString adds nothing.
| if (entity.isRelationshipEntity()) { | ||
| return null | ||
| } |
There was a problem hiding this comment.
No test reaches this branch: the Neo4j core suite passes with these three lines removed. Without them CastMember.createCriteria().list { isNull('from') } fails with Type mismatch: expected Node but was Relationship, because the pattern starts at the relationship variable (NOT (r)-[]->(:Movie)). Please add a feature that runs isNull and isNotNull on from and to of a relationship entity, for example in RelationshipMappingSpec.
| if (entity.isRelationshipEntity()) { | ||
| return null | ||
| } | ||
| PersistentProperty property = entity.getPropertyByName(propertyName) |
There was a problem hiding this comment.
entity is not always the entity the criterion belongs to. AssociationQueryHandler dispatches the criteria nested in an association with the entity it was given and only switches the prefix, so inside owner { ... } this lookup runs against the class the query started from. With Pet { Owner owner; Kind kind } and Owner { String kind; Address address }:
Pet.createCriteria().list { owner { isNull('kind') } }returned the pets whose owner has nokindon 8.0.x (m_0.kind IS NULL). Herekindresolves to the associationPet.kind, the condition becomesNOT (m_0)-[:KIND]->(:Kind), and every pet with an owner comes back;isNotNull('kind')returns nothing. A null test on a plain property that worked is now wrong whenever the root class has an association of the same name.owner { isNull('address') }andPet.where { owner.address == null }still renderm_0.address IS NULLand return every pet with an owner, becausePethas noaddress. That is Neo4j: isNull on an association matches every node #16584 one level down, and this change does not reach it.
One way to fix both: in AssociationQueryHandler, dispatch the nested criteria with association.associatedEntity instead of entity, keeping entity when the association targets a relationship entity. With that, both queries return the right rows and the Neo4j core suite still passes. Please add a feature for each of the two cases to IsNullAssociationSpec.
| return null | ||
| } | ||
| PersistentProperty property = entity.getPropertyByName(propertyName) | ||
| if (property instanceof Association && !(property instanceof Basic)) { |
There was a problem hiding this comment.
Not blocking: Embedded is an Association and not a Basic, so a null test on an embedded property now renders NOT (n)-[:HOME]->(:Address). An embedded component is flattened onto the owner's node and never has a relationship, so by the javadoc above this method should return null for it. The rows are the same as before (all for isNull, none for isNotNull), so nothing regresses, but please add Embedded to the exclusion.
| * the relationship and not for a property of the node. | ||
| */ | ||
| @Issue('16584') | ||
| class IsNullAssociationSpec extends Neo4jGormDatastoreSpec { |
There was a problem hiding this comment.
The spec exercises one shape, a unidirectional to-one to the same class. The null test now goes through formatAssociationPatternFromExisting, and these branches have no feature:
- the reversed pattern of a bidirectional many-to-one (
(n)<-[:ITEMS]-(:Shelf)), - a to-many,
- an association to a relationship entity (
(n)<-[]-(:Celeb)forMovie.cast), - the
Basicexclusion inassociationRelationshipPattern.
The first three return the right rows when I run them, so this is missing coverage and not a defect. Please add features for them.
jamesfredley
left a comment
There was a problem hiding this comment.
Not approved. A nested isNull resolves the property on the root, so a scalar on the joined entity is tested as the root's relationship. An embedded component is treated as a relationship and the query throws.
…entity
A criterion nested in an association block was dispatched with the entity the query
started from, so isNull inside owner { } looked the property up on the wrong class:
a plain property of the same name as an association of the root was tested as a
relationship, and an association of the owner, which the root does not have, was
tested as a property. The nested criteria are now dispatched with the associated
entity, as for an association to a relationship entity they keep the entity given.
An embedded component is stored on the node and stays a property null test; it was
rewritten to a relationship pattern and failed in the cast of its entity.
Tests for the nested cases, the reversed pattern of a bidirectional many-to-one, a
to-many, a basic collection, an embedded component, an association to a relationship
entity and the ends of a relationship entity. The upgrade guide gets a note.
Claude-Session: https://claude.ai/code/session_01Dmki4Tgxp7dLBhzpe2xT93
|
Pushed 5f50268. By thread: Nested criteria: AssociationQueryHandler dispatches the criteria of an association block with the associated entity, and keeps the entity it was given when the association targets a relationship entity. owner { isNull('kind') } now tests the owner's plain property, and owner { isNull('address') } tests the owner's association. Features for both, with isNotNull, and one for an association of the root entity beside a nested block. This is also james's comment on the property resolved on the root. Upgrade note: section 90 of the Grails 8 upgrade guide, with isNull and isNotNull, the finder and where forms, to-many, nested blocks, deleteAll and updateAll, and how to get the earlier rows back. Embedded: the relationship pattern excludes Embedded as well as Basic. Without the exclusion an embedded component's null test fails in the cast of its entity, as james found; a feature runs isNull and isNotNull on one. Tests: the reversed pattern of a bidirectional many-to-one, a to-many, a basic collection, an association to a relationship entity (Movie.cast) and isNull and isNotNull on from and to of CastMember. I mutated the nested dispatch, the Embedded exclusion and the relationship entity guard, and a feature fails for each. The GString nit is done. I did not add the where { owner.address == null } form: in the spec the where closure did not resolve the nested path, so the nested block form carries both cases. On #16583: its copy of this change is for 9.0.x; it should be dropped when this one merges up. |
jamesfredley
left a comment
There was a problem hiding this comment.
Not approved. A null test inside a relationship-entity block treats a scalar as the owning node's association, and Neo4j rejects the query. A nested isNull on a node association now uses the joined entity. An embedded component is no longer treated as a relationship. Threads PRRT_kwDOAAfRJ860EUgW and PRRT_kwDOAAfRJ860EUgp resolved.
…perties A null test inside a block on an association to a relationship entity looked the property up on the node the block is on, so a relationship property with the same name as an association of the node built a relationship pattern from a relationship variable, which Neo4j rejects. The builder now records the variable of a relationship, and the null test there stays a property test. Claude-Session: https://claude.ai/code/session_01Dmki4Tgxp7dLBhzpe2xT93
|
@jamesfredley Fixed in 4271678, on top of 5f50268.
Not changed here: |
jamesfredley
left a comment
There was a problem hiding this comment.
Not approved. A nested comparison uses the block entity's id mapping, so a query that used to match returns no rows. A null test on a relationship entity's scalar now tests that property. Thread PRRT_kwDOAAfRJ860U6b- resolved.
| if (criterion.entity instanceof RelationshipPersistentEntity) { | ||
| builder.addRelationshipVariable(nextPrefix) | ||
| } | ||
| return dispatchCriterion(aq.criteria, nested, builder, nextPrefix) |
There was a problem hiding this comment.
customer { eq('account', account) } now compares the customer's id column. Customer uses a snowflake id and Account uses a native id, so the comparison looks for id and matches no order. It used to compare the account's id. Use the target of account for that comparison.
…entity A comparison with an association, eq or ne on a property that leads to another node, formatted the identity of the node it reached with the identity mapping of the entity that owns the association. With a snowflake id on the owner and a native id on the associated entity the comparison looked for the wrong identity and matched nothing, inside an association block and on the entity itself. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
@jamesfredley Fixed in 1da133a, on top of 4271678. You were right, and it was wider than the block:
|
jamesfredley
left a comment
There was a problem hiding this comment.
A nested comparison on the associated entity now uses that entity's identity mapping. Not approving. A relationship criterion inside the block still uses the owner's mapping, so a query that used to match returns no rows.
| // recorded as a relationship: the properties are those of the relationship, which has no | ||
| // relationship of its own to test. | ||
| PersistentEntity associated = association.associatedEntity | ||
| GraphPersistentEntity nested = associated instanceof GraphPersistentEntity && |
There was a problem hiding this comment.
Input: a native-id root, a snowflake-id owner, and idEq on a native-id relationship inside that owner block. The relationship criterion uses the owner's identity mapping, so a query that used to match returns no rows. Use the relationship's own mapping for identity and comparison criteria, not only for null tests.
…the relationship entity A block on an association to a relationship entity declares a variable for the relationship and now records the relationship entity with it. A criterion on that variable takes the identity and the plain properties from that entity, so idEq and an equality on the identity compare ID(relationship) when the relationship has a native id and its owner a snowflake one, and not the owner's identifier property. An association of the relationship, and a property it has no mapping for, stay with the block's entity. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
@jamesfredley fixed in 0ad7f66. A block on an association to a relationship entity now records the relationship entity with its variable, and a criterion on that variable takes its identity and plain properties from that entity. For your input (a native-id root, a snowflake-id owner,
|
jamesfredley
left a comment
There was a problem hiding this comment.
Not approving. A scalar property of a relationship, such as total, is no longer qualified, so the query throws.
# Conflicts: # grails-doc/src/en/guide/upgrading/upgrading80x.adoc
…ariable Only the identity of a relationship in a block uses the relationship entity; other properties stay with the entity of the block so that total compares as m_0.total.
jamesfredley
left a comment
There was a problem hiding this comment.
Not approving. A scalar property of a relationship is still unqualified, so the query throws. A null check on a relationship also matches a different relationship type.
| if (entity.isRelationshipEntity() || builder.isRelationshipVariable(prefix)) { | ||
| return null | ||
| } | ||
| PersistentProperty property = entity.getPropertyByName(propertyName) |
There was a problem hiding this comment.
A movie connected to a celebrity only by a different relationship type satisfies isNotNull('cast') and fails isNull('cast'). The pattern does not name the relationship type. Include that type.
…mes the relationship type The pattern of an association to a relationship entity had no type, so a node connected to another by a relationship of a different type counted as having the association: isNotNull matched it and isNull did not. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…rionScope Seventeen criterion handlers each took the entity, the builder and the variable and worked out for themselves where a property is: Equals and the comparison handler each carried a copy of the association, relationship end and type resolution, and Between and the property comparison wrote the variable in front of the name by hand, so they ignored the identity and relationship rules. CriterionScope holds the entity, the variable and the query, and answers what a property refers to, what a null test on an association looks like, and which scope the block of an association opens. A handler asks it and only says what it compares. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
@jamesfredley pushed ff5c7e3. Your last review's two findings:
ff5c7e3 moves the decision about what a property refers to into one class, |
jamesfredley
left a comment
There was a problem hiding this comment.
Not approving. A disjunction that also tests membership of an association drops the rows that match the other branch. A range on a relationship property whose name starts with to or from is still unqualified.
| int paramNumber = addBuildParameterForCriterion(builder, entity, criterion) | ||
| GraphPersistentEntity graphPersistentEntity = (GraphPersistentEntity) entity | ||
| String lhs | ||
| String lhs = scope.reference(criterion.property) |
There was a problem hiding this comment.
or { eq('name', 'three'); inList('owner', [a.id]) }, with pet three having no owner and pet one belonging to a. The list returns only one. three is dropped before the name test can keep it. Do not require the association for the whole query.
| int paramNumberFrom = builder.addParam(mappingContext.convertToNative(criterion.from)) | ||
| int parmaNumberTo = builder.addParam(mappingContext.convertToNative(criterion.to)) | ||
| new CypherExpression("\$$paramNumberFrom<=${prefix}.$criterion.property and ${prefix}.$criterion.property<=\$$parmaNumberTo") | ||
| String property = scope.property(criterion.property) |
There was a problem hiding this comment.
between('total', 0L, 5L) on a relationship entity throws. The comparison uses total instead of r.total. Keep an ordinary relationship property qualified with its relationship variable.
…nship, whatever the owner has under the same name A property name in the block of an association to a relationship entity was looked up on the entity that owns the relationship, so a comparison on a name that is an association of the owner (Owner.address against Link.address, a string) matched a node and the query threw. The scope of a relationship block is now the relationship entity itself, with the nodes at its ends recorded for the from and to blocks inside it, and CriterionScope.forCriterion, which only worked around the wrong scope, is gone. RelationshipPersistentEntity.formatProperty treated every name that starts with 'from' or 'to' as an end node, so a relationship property like 'total' was never qualified. It now matches the end itself or something of it. RelationshipBlockMatrixSpec runs 12 criteria on three properties (an association of the owner, a property of a different type, a property only the relationship has) from the root of a query and from a nested block, plus the from and to blocks inside a relationship block. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
@jamesfredley reproduced and fixed in 12e1fcc. Cause. A block on an association to a relationship entity kept the entity that owns the relationship as its scope. With Fix. The scope of a relationship block is now the relationship entity itself. The nodes at its two ends are recorded on the scope, so a A second bug the same cells exposed. Matrix, not a single case. Neo4j core suite: 753 tests, 0 failures. |
jamesfredley
left a comment
There was a problem hiding this comment.
Not approving. A disjunction that also tests membership of an association still drops the rows that match the other branch. A self-referential relationship also filters the wrong end.
| return associated.formatId(association.name) | ||
| } | ||
| String target = "m_${builder.getNextMatchNumber()}" | ||
| builder.addMatch(entity.formatAssociationPatternFromExisting(association, '', variable, target)) |
There was a problem hiding this comment.
or { eq('name', 'Other'); inList('parent', [other.id]) }, with Other having no parent. The list returns only the child. Other is dropped before the name test can keep it. Do not require the association for the whole query.
There was a problem hiding this comment.
Fixed in 6bb0d55. Inside an or, an association reference no longer adds a required MATCH. A to-one reference is read in place with head([pattern | id]), and an association block is an existence test, size([pattern WHERE conditions | 1]) > 0. A node without the association is a null the branch does not match, so the other branches can still keep it. (The embedded server's driver rejects EXISTS { }, hence the pattern comprehensions.) Your or { eq('name','Other'); inList('parent', [other.id]) } case is in RelationshipBlockMatrixSpec, with the other criteria in or (block, eq, in, isNull, isNotNull).
Known limit: a to-many reference compared inside or still uses the required match, because a comprehension can read only one node. Blocks and null tests on to-many associations are fine.
The same behavior is documented for Hibernate ("accounts that have either performed transactions OR were recently created"), and the same bug on Hibernate 5 and 7 is in #16924, with fixes in #16930 and #16931.
| RelationshipPersistentEntity relationshipEntity = (RelationshipPersistentEntity) block.entity | ||
| builder.addRelationshipVariable(variable, relationshipEntity) | ||
| // the node that owns the block is the end its entity is the relationship's, unless it is the other way round | ||
| boolean incoming = entity.is(relationshipEntity.to.associatedEntity) && !entity.is(relationshipEntity.from.associatedEntity) |
There was a problem hiding this comment.
links { from { eq('name', 'Alice') } } on a relationship whose ends are the same type filters the receiving node. Alice as the origin is missing. Use the direction of the association.
There was a problem hiding this comment.
Fixed in 6bb0d55. matchForRelationshipEntity treated the owner as the receiving end whenever the owner was the to type, even when it was also the from type, while CriterionScope.into computed the opposite. For a relationship between the same type they disagreed. The owner is now the receiving end only when it is to and not from, so a self-referential relationship is outgoing from from, like alice.knows. links { from { eq('name', 'Alice') } } now filters the origin. The matrix has self-referential from and to block cells.
Two existing IsNullAssociationSpec expectations encoded the old backwards direction (the bond test, and isNull/isNotNull('feuds')). I changed them to the direction of the association, and the new owners in the bond test are explicit (with-set, with-unset). Please check those two.
… and enter a self-referential relationship from its origin
An association block, or a reference to a to-one association, added a required
match to the query, so inside or { } a node without the association was dropped
before the other branch could keep it. In a disjunction the block is now an
existence test over a pattern comprehension and a to-one reference reads the
node where it stands, so nothing narrows the rows the other branches see.
For a relationship between two nodes of one type the owner was taken as the
receiving end, so a block entered the relationship backwards and from/to named
the wrong node. The owner is at the receiving end only when it is not also the
origin, as navigating the association of an instance does.
RelationshipBlockMatrixSpec gains a combinator axis, an owner without the
association, and a self-referential relationship.
Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…ociated entity A null test in the block matched the entities without the association, because the left join gives null for the missing one. The block now also requires the row of the join on a left join. The shared block cases skip Neo4j until #16836 is merged. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
…ociated entity A null test in the block matched the entities without the association, because the left join gives null for the missing one. The block now also requires the id of the joined alias. The shared block cases skip Neo4j until #16836 is merged. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
jamesfredley
left a comment
There was a problem hiding this comment.
Not approving. A disjunction that tests membership of a collection still drops the rows that match the other branch.
| if (entity.isRelationshipEntity() && RelationshipPersistentEntity.isRelationshipAssociation(association)) { | ||
| return associated.formatId(association.name) | ||
| } | ||
| if (builder.inDisjunction && found instanceof ToOne) { |
There was a problem hiding this comment.
or { eq('name', 's2'); inList('items', [i1.id]) }, where s2 has no items. The list returns only the shelf that has i1. s2 is dropped before the name test can keep it. Do not require the collection for the whole query.
There was a problem hiding this comment.
Fixed in 9de206c. The disjunction case was one cell of a class: a criterion on a collection (inList, eq, the comparisons) took a required match of the collection, in any or or not. It is now read in place and holds when some element satisfies it, so s2 reaches the name branch. isEmpty and isNotEmpty on an association had the same family of problem (they tested a node property that does not exist) and now test the relationship, like isNull.
CollectionAssociationMatrixSpec covers 10 criteria in 6 contexts (top level, either side of an or, an and in an or, an or in an and, not), from the root and from a nested block: 120 cases, and 28 of the first 36 failed before the change. The whole Neo4j core suite passes (906 tests, 0 failures).
…fies it, in any context In a disjunction or a negation a criterion on a collection of nodes took a required match of the collection, which dropped the nodes that have none before the other branches could keep them. The collection is now read where it stands as the identities of its elements, so inList, eq and the comparison criteria hold when some element satisfies them. isEmpty and isNotEmpty on an association test the relationship, as isNull and isNotNull already do, instead of the length of a node property that does not exist. CollectionAssociationMatrixSpec covers 10 criteria in 6 contexts (top level, either side of a disjunction, a conjunction in a disjunction, a disjunction in a conjunction, a negation) from the root and from a nested block, with the expected rows worked out from the fixture by one oracle. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
| String pattern = entity.formatAssociationPatternFromExisting(association, '', variable, local) | ||
| return "head([${pattern} | ${associated.formatId(local)}])".toString() | ||
| } | ||
| String target = "m_${builder.getNextMatchNumber()}" |
There was a problem hiding this comment.
Shelf s1 has one item i1. inList('items', [i1.id]) twice should return s1. It returns nothing. Each criterion adds another relationship pattern, and those patterns are combined into one match that cannot reuse the only relationship. A collection criterion should hold when some element satisfies it, including when the same element satisfies two of them.
…fies it, in any context Answers the review of #16836: two criteria that one element satisfies found nothing outside a disjunction, because each added a relationship pattern to one MATCH and Cypher does not let two patterns share a relationship. Every collection criterion now reads its members where the collection stands; the grid gains a pairs dimension. Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
Answers the second sentence of the review: two criteria that one element satisfies. A criterion on a collection now always reads its members where the collection stands, so two criteria no longer need two relationships in one
Not addressed in this commit: the first sentence of the review ( |
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. A criterion on a collection holds when the only element satisfies it twice. A criterion on a relationship endpoint still names a variable that was never bound.
| if (found instanceof Association && !(found instanceof Basic)) { | ||
| Association association = (Association) found | ||
| GraphPersistentEntity associated = (GraphPersistentEntity) association.associatedEntity | ||
| if (entity.isRelationshipEntity() && RelationshipPersistentEntity.isRelationshipAssociation(association)) { |
There was a problem hiding this comment.
links { eq('to', target) } should match the links that end at that target. The query names to, and that name was never bound, so the query fails. Use the variable the block already bound for that end.
…he node the block bound for it
eq('to', target) in a block on a relationship named the end by the property name, a Cypher variable the query never bound, so
the query failed with Variable `to` not defined. The end is now the variable the block bound for that end (the node the
block was entered from, or the one it reaches), and the pattern's own name when the relationship is the root of the query.
RelationshipBlockIdentitySpec gains rows for to and from, equal and not equal, beside another criterion, in a disjunction,
and with the relationship as the root of the query.
Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
|
Thank you, you are right: an end of a relationship in a block was named by the property name, The end is now the variable the block bound for it: the node the block was entered from, or the node it reaches, as
This branch is the base of #17011, which will take it on its next update. |
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. An outgoing relationship end is compared through the node the block bound. A type comparison and a null test on that end still name a variable that was never bound.
| // the node reached is of the associated entity, whose identity may be mapped differently | ||
| return associated.formatId(target) | ||
| } | ||
| if (entity.isRelationshipEntity() && name == RelationshipPersistentEntity.TYPE) { |
There was a problem hiding this comment.
links { eq('type', 'COLLINK') } should match the links of that type. The query names r, and the block bound the relationship as another variable, so the owner is dropped. Use the variable the block already bound.
Fixes #16584
Fixes #14512
An association is stored as a relationship, so
n.parent IS NULLis true for every node andisNull('parent')matched all of them. On an association,isNullnow compiles toNOT (n)-[:PARENT]->(:Folder)andisNotNullto the pattern itself. Plain properties and relationship entities are unchanged.IsNullAssociationSpecruns the reproduction from the issue plusisNotNull, a combination with a property criterion and the unchanged plain-property case. Three of its four features fail without the change.Once this merges, the
@PendingFeatureIfNeo4j marker onUniqueConstraintNullGroupValueSpecin #16583 can be removed.https://claude.ai/code/session_01Dmki4SQGwRSj8pRJ5KCWyX