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(null) compared with ±1 in a query still returns no rows #256
#227 (fixing #220) rewrote CompareTo(null) compared with 0, but EF Core's optimizer turns more forms into comparison operators: CompareTo(x) == 1, >= 1, > -1, != -1 and 1 == CompareTo(x). With a null operand they returned 0 of 7 rows on the server against 7 of 7 in memory, where CompareTo(null) is exactly 1. ExecuteUpdate with CompareTo(none) == 1 updated 0 of 7 rows. Non-null operands agree. Found live by the final pre-release analysis on add665c (pass A), at ValueRangesQueryExpressionInterceptor.cs:249: IsZero matches only 0.
It is outside the documented "against 0" sentence, but it translates silently instead of refusing.
Change
Make the rewrite accept -1, 0 and 1, and give the null-operand answer for each operator and constant (CompareTo(null) is 1: == 1, >= 1, > -1, > 0, >= 0, != -1, != 0 are true; == 0, == -1, < 0, <= 0, < 1, <= -1 are false). Or refuse the forms it can't rewrite. The answer must never be silently different.
Done when
RangeOrderParityTests.CompareToInAQuery_ReturnsTheRowsMemoryReturns has the five predicates above, and the 0-forms, with a null operand, and fails with the extension reverted.
Activity