Page 1 of 1

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

Posted: Tue 03 Dec 2019 14:37
by KRU
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 :)

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

Posted: Wed 04 Dec 2019 17:26
by Shalex
Thank you for your report. We have reproduced the issue with EF Core 2.2 and will notify you when it is fixed.

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

Posted: Tue 24 Dec 2019 18:11
by Shalex
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