-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid ansi string fixed length Parameter value passed to query when server side select includes parameter #330
Comments
Thanks @troglas for reporting and the complete test case. I've been able to reproduce your error and filed a bug (36045692) for the Oracle EF Core team to review and resolve. |
The same problem is with nchar (stringFixedLength) example: (same main code as in description) var entity = new B30TEST();
entity.Tschar = "ts";
entity.Index = 667;
entity.Tsnchar = "tsn";
db.B30TestRepo.Add(entity);
db.SaveChanges();
var result = db.B30TestRepo.Where(x => x.Tsnchar == entity.Tsnchar).Select(x => new { Val = entity.Tsnchar, val2 = x.Tsbool }).ToList();
Debug.Assert(result.Count == 1); // This fails! - record not found Log output
while the :entity_Tsnchar_0 value should be:
|
Thanks! We'll address both issues in the same bug. |
The ODP.NET dev team has completed their investigation. This bug is not reproducible with Oracle EF Core 7 NuGet (7.21.8 - 7.21.12) and also not reproducible with the internal Oracle EF Core 8 version we have. We can replicate this issue with Oracle EF Core 6 NuGet (6.21.120). This is a relational layer issue in EF Core 6, in which parameter names are getting reused based on the variable names used in LINQ. Due to that, the type mapping of a parameter gets evaluated only once (in the customer case, entity_Tschar_0 is evaluated as .NET string type mapping (VARCHAR2) but the WHERE condition requires the parameter to be evaluated as CHAR type mapping which is why the query does not return any data). This issue got resolved in EF core 6 as a fix of reusing the same parameter in query: dotnet/efcore#23271 But it also introduces another issue like what you reported in which different parameter names are required if same variable is used in LINQ. So MS again improved this fix in EF Core 7: We suggest using below workaround for EF Core 6 version or upgrade to Oracle EF Core 7 or EF Core 8 versions:
Workaround Example:
|
Hi Oracle Team,
Invalid query parameter value is passed to query when server side select contains the filter value and some other column from entity.
See that the filter query is run on char(80) column so the parameter value should be passed to the query like
example:
Problem
The filter column type is char(80) and the parameter value passed is
Looking at the log I see this:
Expected:
while the parameter value should be
Full Code Example and db definition of the table
csproj
The text was updated successfully, but these errors were encountered: