Subject: | Inconsistent behavior of null in multi-value comparison |
ORM creates an abstraction from Database and maps objects to database rows. Besides this, ORM provides a mechanism(QueryBuilder) to query objects from database in an abstracted way. QueryBuilder makes an excellent job and helps us to write queries easily. So, we write ATTRNAME => VALUE1 for single value comparison and "ATTRNAME => [VALUE1, VALUE2]" for multi-value comparison. With a single value comparison we do not care about NULLs, "ATTRNAME => undef" just works, but when we add additional value to comparison like "ATTRNAME => [undef, VALUE2]" it stops working. This behavior is not expected and looks inconsistent. It would be very nice to have multi-value comparison working correctly with undef(NULL). I know that the behavior is described in the documentation but what are the reason for it?