Showing results for 
Search instead for 
Did you mean: 

All predicate returning true on empty list in cypher


While debugging some generated cypher queries from graphql, I realized that the all predicate may not be working as expected. Below is a much simpler query to demonstrate my point.

with [] as sample_list return all(b in sample_list where b) - this returns true


This appears to conflict with the following from neo4j documention on the all predicate:

"The function all() returns true if the predicate holds for all elements in the given list. null is returned if the list is null or all of its elements are null." - link

Is this desired behavior? Or is the all predicate not working properly since the list is null?

Neo4j version: 4.2.5
Browser: 4.2.6


I think it's working correctly. All elements (zero) are true.

I guess all(x in [] WHERE true) == none(x in [] where true)