WHERE clauses on relationship's properties cause Neo.DatabaseError.Statement.ExecutionFailed

Hello everyone, I just ran into an error that I cannot understand. It's easier to replicate than to explain.

(Version: 5.3.0 Enterprise edition)

Create the nodes and relationships:

CREATE (patient:Patient)
SET patient.id = 'Patient/1'
SET patient.birthDate = '1992-10-09'

CREATE (patient_name:HumanName)
SET patient_name.id = 'Patient/1_name'
SET patient_name.given = 'Biagio'

CREATE (patient)-[patient_name_p:PROPERTY {name: 'name'}]->(patient_name)

CREATE (practitioner:Practitioner)
SET practitioner.id = 'Practitioner/1'

CREATE (practitioner_name:HumanName)
SET practitioner_name.id = 'Practitioner/1_name'
SET practitioner_name.given = 'Sarah'

CREATE (practitioner)-[practitioner_name_p:PROPERTY {name: 'name'}]->(practitioner_name)

CREATE (patient)-[generalPractitioner:RELATIONSHIP {name: 'generalPractitioner'}]->(practitioner)

This query raises an error:

MATCH (patient)-[patient_name_p:PROPERTY]->(patient_name)
WHERE
((patient:Patient) AND
(patient_name_p.name='name'))
AND
((patient_name.prefix='Biagio' OR patient_name.use='Biagio' OR patient_name.given='Biagio' OR patient_name.text='Biagio' OR patient_name.family='Biagio' OR patient_name.suffix='Biagio'))
RETURN patient.id

This is the output:
error Neo.DatabaseError.Statement.ExecutionFailed

Cannot invoke "org.neo4j.internal.kernel.api.RelationshipDataAccessor.properties(org.neo4j.internal.kernel.api.PropertyCursor, org.neo4j.storageengine.api.PropertySelection)" because "this.v3_relationships" is null

However, this query works just fine:

MATCH (patient)-[patient_name_p:PROPERTY]->(patient_name)
WHERE
patient:Patient
AND
((patient_name.prefix='Biagio' OR patient_name.use='Biagio' OR patient_name.given='Biagio' OR patient_name.text='Biagio' OR patient_name.family='Biagio' OR patient_name.suffix='Biagio'))
RETURN patient.id

And this as well:

MATCH (patient)-[patient_name_p:PROPERTY]->(patient_name)
WHERE
((patient:Patient) AND
(patient_name_p.name='name'))
AND
(patient_name.given='Biagio')
RETURN patient.id

It seems like the thing that raises the error is combining the clause on the relationship PROPERTY's attribute "name" with the one on non-existing attributes on the patient_name.

But if I run one or the other, it works.

Does anyone have any idea how to fix this? I must query both.

Thanks in advance

Then might it be an OS-related problem? I’m on M1 mbp running the latest macOS version. And I freshly installed neo4j desktop twice and got the same result. I guess I’ll fix it either by using v4 or trying out a docker image

I used Neo4j Desktop version 1.5.6 and Neo4j 5.3. All the three queries produced exactly same result. I did't get any error.

Okay I just found out that this works just fine in version 4.4.16. Not sure if this is an inteded behaviour for version 5.3.0 or a bug.