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
10.x: Contains(element) on a range or RangeSet is NULL in SQL for a NULL element (port of #381) #387
The same defect as #381, on release/10.x. Contains(T) on a range or a RangeSet is NULL in SQL when its element is NULL: a negated filter drops the row EF Core keeps, a projection into bool throws, and list.All(x => x.Contains(r.Day!.Value)) selects the NULL rows. Rule (c) reached 10.x in #357, but FalseOverNull in ValueRangesMethodCallTranslator wraps only range and multirange operands, not the element. The code is the same on both lines.
An element is NULL when it comes from the optional side of an outer join, or from a nullable column read with .Value. A value set's Contains(element) already answers false/true, so only the range and RangeSet forms are affected.
Change
Cherry-pick the #381 fix with -x, with its regression test: the element operand is wrapped like a range operand (e IS NOT NULL AND x @> e). It's SQL only. EF Core drops the check for a required element, so that SQL doesn't change.
The probes that found it (OuterJoinProbeTests, NullableOperandPairProbeTests, QuantifierProbeTests, PR #383) are on main only, so the port's own test has to cover the negation, the projection and All.
Release
silent: one row under ### Changed answers in ## [10.2.0], linking this issue and its entry under docs/migration.md#changed-answers-in-1020. Fixed only on release/10.x, so close it by hand (#365).
PR #393 cherry-picks the #381 fix (PR #391) with -x. It adds NullElementTests on this line, because the composition probes are on main only. That covers the negation, the projection and All; with the fix stripped, all of them fail.
Fixed on release/10.x by #393, merged as 03c04e4: Contains(T) over a NULL element is false in a query and its negation true, for a range and a RangeSet, in a filter, a bool projection and All. [10.2.0] has the ### Changed answers row and docs/migration.md its subsection under ## Changed answers in 10.2.0. The RangeSet projection case was added in #394 after the release review. Ships in 10.2.0 (#358). Closed by hand, since Closes acts only on main.
Activity
CaffeinatedCoder commentedon Oct 24, 2026
PR #393 cherry-picks the #381 fix (PR #391) with
-x. It addsNullElementTestson this line, because the composition probes are onmainonly. That covers the negation, the projection andAll; with the fix stripped, all of them fail.Merge pull request #393 from CaffeinatedCoder/fix/387-null-element-co…
test: hold the 10.x NULL-element fixes where a predicate consumes them (
CaffeinatedCoder commentedon Oct 24, 2026
Fixed on
release/10.xby #393, merged as 03c04e4:Contains(T)over a NULL element isfalsein a query and its negationtrue, for a range and aRangeSet, in a filter, aboolprojection andAll.[10.2.0]has the### Changed answersrow anddocs/migration.mdits subsection under## Changed answers in 10.2.0. TheRangeSetprojection case was added in #394 after the release review. Ships in 10.2.0 (#358). Closed by hand, sinceClosesacts only onmain.