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
{{ message }}
Repository navigation
CompareTo against a null range in an EF predicate returns no rows; memory returns every row #220
area/rangesRange unions, variants and the shape enginesbugSomething isn't workingpackage/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQLseverity/lowCosmetic, message or documentation-level differencesilentAnswers wrongly without throwing — fixes go in the next major, never deferred
CompareTo against a null range in an EF predicate returns no rows, while the same predicate in memory returns every row. The docs say "null sorts before every range" (docs/ranges.md, range order). EF Core's generic CompareTo rewrite turns r.Seats.CompareTo(probe) > 0 into WHERE r."Seats" > NULL, which is never true. >= behaves the same. Found by the pre-tag analysis (#179) on origin/main 3ce68d9. A live probe printed server rows = 0, memory rows = 1.
This breaks claim E45-compareto-runs-as-comparison-operator ("the rows returned match the same predicate … in memory").
Change
One of:
rewrite a CompareTo comparison whose operand may be null so it agrees with memory (x > NULL is true for every non-null x in memory, so > 0 and >= 0 become col > x OR x IS NULL, and < 0, <= 0, == 0 with a null operand become false), in the query interceptor where the other range rewrites live; or
document that a null operand compares as SQL NULL in a query, next to the ORDER BY NULLS note, and narrow E45 to say so.
The first keeps the "same answer in memory and in SQL" promise. The second is honest but adds a carve-out.
Done when
RangeOrderParityTests.CompareToInAQuery_ReturnsTheRowsMemoryReturns has a null-operand case for every comparison, which fails with the fix reverted (or, for the documentation route, E45 and the doc state the SQL rule and a test holds it).
area/rangesRange unions, variants and the shape enginesbugSomething isn't workingpackage/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQLseverity/lowCosmetic, message or documentation-level differencesilentAnswers wrongly without throwing — fixes go in the next major, never deferred
Activity