You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@indrajitjadeja the fix in #32510 only corrected the length on the type mapping; this is a general type mapping inference fix that isn't SQL Server-specific (even if the original bug manifested specifically in SQL Server). I'm still not clear on how it exactly it affects the Oracle SQL translation - can you please open a new issue with a clear minimal, runnable repro and the SQL generated in 8.0.1 and 8.0.2?
requires inferring of type mapping, the right SqlConstantExpression does not have a TypeMapping thus the value of inferredSize becomes null and it calls _typeMappingSource.FindMapping on string CLR type with Unicode and Oracle provider returns NVARCHAR2 as type mapping with 2000 default size.
now when the right part of the binary expression gets evaluated:
the left Sql Binary Expression part already has 2000 as a size and the right SqlColumnEpxression has 5 as a size which sets the inferredSize value to 2005 and it calls _typeMappingSource.FindMapping on String CLR type with Unicode and Oracle provider returns NCLOB as type mapping.
In the case of the Oracle provider with string CLR type, an additional call to the _typeMappingSource.FindMapping method based on the inferred size results in incorrect type mapping combinations, despite the fact that each SqlColumnEpxression has already been assessed with the correct type mapping.
provider and version information
EF Core version: 8.0.2
Database provider: Oracle.EntityFrameworkCore 8.21.121
Target framework: .NET 8.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.7.4
The text was updated successfully, but these errors were encountered:
In the case of the Oracle provider with string CLR type, an additional call to the _typeMappingSource.FindMapping method based on the inferred size results in incorrect type mapping combinations
Doesn't this indicate an issue with the Oracle provider where the call to FindMapping is returning an invalid mapping?
Doesn't this indicate an issue with the Oracle provider where the call to FindMapping is returning an invalid mapping?
For the Oracle Provider, the size parameter was the only reason why the FindMapping method call from SqlExpressionFactory.ApplyTypeMappingOnSqlBinary() encounters a problem.
However, the relational layer also calls the FindMapping method for each property when the model properties are initialized and finalized, and the Oracle provider returns appropriate type mappings.
Unlike the SQL Server's VARCHAR2 datatype, which supports max as size, the Oracle VARCHAR2 does not support max as size due to its limited character size support, as explained in this document.
Oracle EF Core Provider has the following combinations based on the size parameter:
For a model property of string CLR type
When size is not configured and Unicode is true ( the default case for a string property)
Oracle provider uses the maximum allowed size of 2000 and maps it to NVARCHAR2(2000) datatype
When size is not configured and Unicode is false
Oracle provider uses the maximum allowed size of 4000 and maps it to the VARCHAR2 (4000) datatype
When size is configured >2000 and Unicode is true
Oracle provider maps it to NCLOB datatype
When size is configured >4000 and Unicode is false
Oracle provider maps it to CLOB datatype
For Oracle Provider, the previous behavior (<8.0.2) of inferring the type mapping based on the left and right expressions (usually the first expression in the list) was adequate.
With reference to the below comment on #32520
Minimal repro:
Application using Oracle.EntityFrameworkCore 8.21.121 with Oracle.EntityFrameworkCore 8.0.1 generates the following SQL without any error:
Application using Oracle.EntityFrameworkCore 8.21.121 with Oracle.EntityFrameworkCore 8.0.2 generates the following SQL:
which throws the below error:
Debug information
In the oracle provider, depending on the size parameter, a string CLR type maps to either VARCHAR2/NVARCHAR2 or CLOB/NCLOB store types.
out of the whole binary expression:
when the left part of the binary expression:
requires inferring of type mapping, the right SqlConstantExpression does not have a TypeMapping thus the value of inferredSize becomes null and it calls _typeMappingSource.FindMapping on string CLR type with Unicode and Oracle provider returns NVARCHAR2 as type mapping with 2000 default size.
now when the right part of the binary expression gets evaluated:
the left Sql Binary Expression part already has 2000 as a size and the right SqlColumnEpxression has 5 as a size which sets the inferredSize value to 2005 and it calls _typeMappingSource.FindMapping on String CLR type with Unicode and Oracle provider returns NCLOB as type mapping.
In the case of the Oracle provider with string CLR type, an additional call to the _typeMappingSource.FindMapping method based on the inferred size results in incorrect type mapping combinations, despite the fact that each SqlColumnEpxression has already been assessed with the correct type mapping.
provider and version information
EF Core version: 8.0.2
Database provider: Oracle.EntityFrameworkCore 8.21.121
Target framework: .NET 8.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.7.4
The text was updated successfully, but these errors were encountered: