Bug in generated SQL when casting EF Core model decimal-column to long in C# LINQ

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
KRU
Posts: 5
Joined: Tue 08 Oct 2019 11:51

Bug in generated SQL when casting EF Core model decimal-column to long in C# LINQ

Post by KRU » Tue 03 Dec 2019 14:37

We are getting an OracleException "ORA-00902: Invalid Datatype" error in the SQL generated by Devart (we are using the latest version, 9.9.887) when casting a decimal-column in an EF Core model to the "long" type in a C# LINQ query.

Code: Select all

using (var db = new MyDbContext())
{
    var res = db.MyDbSet.Select(x => new { ID = (long)x.Id }).ToList();
}
Becomes the following SQL:

Code: Select all

SELECT CAST("x".ID AS int64) AS ID
FROM MY_TABLE "x"
Seeing as "AS int64" is not valid Oracle SQL (at least in our 19c-versioned databases), this is a bit of an issue.

We look forward to the fix to this problem :)

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

Re: Bug in generated SQL when casting EF Core model decimal-column to long in C# LINQ

Post by Shalex » Wed 04 Dec 2019 17:26

Thank you for your report. We have reproduced the issue with EF Core 2.2 and will notify you when it is fixed.

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

Re: Bug in generated SQL when casting EF Core model decimal-column to long in C# LINQ

Post by Shalex » Tue 24 Dec 2019 18:11

The new v9.10.909 includes the fixes:
* The bug with generating SQL when using explicit cast in LINQ queries in EF Core 1/EF Core 2 is fixed
* The bug with redundant CASTs when working with NUMBER, DATE and TIMESTAMP columns in EF Core 1/EF Core 2 is fixed

Post Reply