Wrong code generation when querying nullable booleans

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
FranklySpeaking
Posts: 1
Joined: Wed 06 Apr 2022 15:07

Wrong code generation when querying nullable booleans

Post by FranklySpeaking » 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

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Wrong code generation when querying nullable booleans

Post by Shalex » Thu 05 May 2022 10:12

Sorry for the delayed response. We have reproduced the issue and will notify you when it is fixed.

DmitryGm
Devart Team
Posts: 152
Joined: Fri 11 Dec 2020 10:27

Re: Wrong code generation when querying nullable booleans

Post by DmitryGm » Mon 04 Jul 2022 07:22

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

Post Reply