Wrong code generation when querying nullable booleans
Posted: Thu 07 Apr 2022 13:37
With the property NullableBoolean being a nullable boolen
and the column NullableBoolean being a nullable NUMBER(1)
the query
translates to
which is invalid SQL because
is not a boolean expression.
and the column NullableBoolean being a nullable NUMBER(1)
the query
Code: Select all
Context.SomeTable.Where(t => !(t.NullableBoolean ?? false))
Code: Select all
FROM SomeTable s
WHERE NOT (COALESCE(s.NullableBoolean, 0))
Code: Select all
NOT (COALESCE(s.NullableBoolean, 0))