Breaking change in property WHERE evaluation - seems to treat as collection

MATCH (o:Organization)-[profile:ORG_ADMIN]-(u:User)
WHERE  toLower(u.firstName) CONTAINS toLower('a')
RETURN u

This fails telling me
Expected a string value for toLower, but got: StringArray[Nechemia, Mendi, Shainy, Chana, Yosef Y., Chanie, Menachem, Aaron, Levi, Menachem Mendel]; consider converting it to a string with toString().

However, this runs without any issue:

MATCH (u:User)
WHERE  toLower(u.firstName) CONTAINS toLower('a')
RETURN u

This issue may have just started within the past few days. And was definitely not happening earlier.

Also, this works when using distinct, but not without

 MATCH (u:User)
          WHERE  toLower(u.firstName) CONTAINS toLower('a') and exists((:Organization)-[:ORG_ADMIN]-(u))
with distinct u
  match (u)-[profile:ORG_ADMIN]-(:Organization)
          RETURN u {
              .*,
              profile: profile {.*}
          } AS u

I've inspected the firstName column and indeed it contains text only values (no Arrays)

This is running on AuraDB Professional

@ycadaner

are there any details as to what version of Neo4j this was encountered upon?

also, I can reproduce the error on Neo4j 2025.01 with the following

create (o:Organization)-[:ORG_ADMIN]->(u:User) set u.firstName='Mike';
create (o:Organization)-[:ORG_ADMIN]->(u:User) set u.firstName='Joe';
create (o:Organization)-[:ORG_ADMIN]->(u:User) set u.firstName='Rob';
create (o:Organization)-[:ORG_ADMIN]->(u:User) set u.firstName=["sue","mary","jill"];

and thus

 MATCH (o:Organization)-[profile:ORG_ADMIN]-(u:User)
             WHERE  toLower(u.firstName) CONTAINS toLower('a')
             RETURN u;
+---+
| u |
+---+
Expected a string value for `toLower`, but got: StringArray[sue, mary, jill]; consider converting it to a string with toString().

but also

MATCH (u:User)
             WHERE  toLower(u.firstName) CONTAINS toLower('a')
             RETURN u;
+---+
| u |
+---+
Expected a string value for `toLower`, but got: StringArray[sue, mary, jill]; consider converting it to a string with toString().

This is running on AuraDB Professional

@ycadaner

but isnt the error message telling. i.e. you are attemting to perform a toLower() on an array which is not possible. No different than trying to perform a toLower() on a integer field.

and not that it should matter but are you expecting to have :User nodes with a firstName that is an array?

and I tested on 5.12.0, a release from many many months back, and one that i had previously installed and see no change, for example

@neo4j> create (o:Organization)-[:ORG_ADMIN]->(u:User) set u.firstName=["sue","mary","jill"];
0 rows
ready to start consuming query after 1314 ms, results consumed after another 0 ms
Added 2 nodes, Created 1 relationships, Set 1 properties, Added 2 labels


@neo4j> MATCH (o:Organization)-[profile:ORG_ADMIN]-(u:User)
                     WHERE  toLower(u.firstName) CONTAINS toLower('a')
                     RETURN u;
+---+
| u |
+---+
Expected a string value for `toLower`, but got: StringArray[sue, mary, jill]; consider converting it to a string with toString().


@neo4j> MATCH (u:User)
                     WHERE  toLower(u.firstName) CONTAINS toLower('a')
                     RETURN u;
+---+
| u |
+---+
Expected a string value for `toLower`, but got: StringArray[sue, mary, jill]; consider converting it to a string with toString().
@neo4j>

Right, but my issue does work when running the second query.

@ycadaner

and when you run

MATCH (u:User)
WHERE  toLower(u.firstName) CONTAINS toLower('a')
RETURN u

do you get the node which has the array value of [Nechemia, Mendi, Shainy, Chana, Yosef Y., Chanie, Menachem, Aaron, Levi, Menachem Mendel]

I just tried on a Aura instance running 5.27.0, the latest and still am unable to recreate the issue you describe