Page 1 of 1

Wrong code generation when querying nullable booleans

Posted: Thu 07 Apr 2022 13:37
by FranklySpeaking
With the property NullableBoolean being a nullable boolen
and the column NullableBoolean being a nullable NUMBER(1)

the query

Code: Select all

Context.SomeTable.Where(t => !(t.NullableBoolean ?? false))
translates to

Code: Select all

FROM SomeTable s
WHERE NOT (COALESCE(s.NullableBoolean, 0))
which is invalid SQL because

Code: Select all

NOT (COALESCE(s.NullableBoolean, 0))
is not a boolean expression.

Re: Wrong code generation when querying nullable booleans

Posted: Thu 05 May 2022 10:12
by Shalex
Sorry for the delayed response. We have reproduced the issue and will notify you when it is fixed.

Re: Wrong code generation when querying nullable booleans

Posted: Mon 04 Jul 2022 07:22
by DmitryGm
dotConnect for Oracle 10.0.0 is released.
https://www.devart.com/dotconnect/oracle/download.html

The bug with the wrong SQL generation in LINQ to Entities when querying nullable boolean in EF Core 3, EF Core 5, and EF Core 6 is fixed

New correct code:

Code: Select all

(COALESCE(s.NullableBoolean, 0)) = 0