Repository navigation
fix: Contains(T) over a NULL element is false in a query (10.x, #387) - #393
Merged
CaffeinatedCoder merged 1 commit intoOct 24, 2026
Merged
Conversation
Rule (c) guarded a NULL range, multirange or value set operand, but not the element. Over the optional side of an outer join, or a nullable column read with .Value, r."Period" @> e was NULL: the negation dropped the row EF Core keeps for its own comparisons, a projection into bool threw, and All over a captured list selected the NULL rows. The predicate wrapper now checks the element too (e IS NOT NULL AND ...); EF Core drops the check for a required element. Found-By: OT Defect-Class: SQL Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit c976194)
This was referenced Oct 24, 2026
10.x: Contains(element) on a range or RangeSet is NULL in SQL for a NULL element (port of #381)
#387
Closed
CaffeinatedCoder
enabled auto-merge
October 24, 2026 20:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #387
This is the 10.x port of #381 for 10.2.0 (#358). It is
git cherry-pick -xof c976194 from PR #391.Problem
Rule (c) reached 10.x in #357, but its predicate wrapper guarded only the range and multirange operands. When the element of
Contains(T)was NULL (the optional side of an outer join, or a nullable column read with.Value):boolthrew;list.All(x => x.Contains(e))selected the NULL rows.Change
FalseOverNullalso wraps the element operand, ase IS NOT NULL AND …. This is the same code as onmain. Required elements keep their SQL.candidates.json: kept 10.x's version. The Contains(element) on a range or RangeSet is NULL in SQL for a NULL element: the negation drops the row EF Core keeps, and a projection into bool throws #381 candidates were registered by the composition sweeps (PR test: composition sweeps — outer joins, nullable operand pairs, quantifiers, repeated execution, filtered aggregates, declared nullability (#375–#380) #383), which are onmainonly.### Changed answersrow under[10.2.0]in the root, EF Core and EF Core NodaTime changelogs. Each row links this issue anddocs/migration.md#changed-answers-in-1020.docs/migration.mdrows land under "Changed answers in 10.2.0".NullElementTests(integration), because 10.x has none of the composition probes. It covers a filter, its negation andRangeSet, a projection, andAllwith its negation. It's registered on claim E71.Tests
NullOperandTranslationTests.ANullableElement_IsCheckedForNull(SQL pins).NullElementTests.Both pass, and with the fix stripped all four fail.
-p:EfFloat=10.0.13 -p:NpgsqlEfFloat=10.0.3.Closesdoesn't act onrelease/10.x, so close #387 by hand after the merge. #388 is stacked on this PR.🤖 Generated with Claude Code