Closed ranma42 closed 4 months ago
The invalid query optimization is caused by a misconfiguration of the nullability in https://github.com/dotnet/efcore/blob/16acc463c92b02bec09993db592ef4216a7a0766/src/EFCore.Sqlite.Core/Query/Internal/Translators/SqliteHexMethodTranslator.cs#L64-L69
I can provide a PR that fixes this (and adds tests ;) ). I am also investigating other similar issues around nullability (starting from misconfiguration of function expressions, but also other null propagation/mis-handling cases).
Would it make sense to open a "meta-issue" to track them together?
Breaking change note: https://github.com/dotnet/EntityFramework.Docs/pull/4739
The definition of the
Unhex
method does not account for the case where thehex()
SQLite function returnsNULL
. This can happen even for non-null inputs, if they contain unexpected characters and/or if the length of the input is not even.An example program that showcases the bug is:
Outpur
The program emits the following output:
The last two elements of the
bad
collection have theRaw
field set tonull
, even though the.Where
filter explicitly excluded that case.Include provider and version information
EF Core version: 8.0.6 Database provider: Microsoft.EntityFrameworkCore.Sqlite Target framework: .NET 8.0 Operating system: Linux (/WSL) IDE: Visual Studio Code 1.89.1