Repository navigation
fix: value set Union and Remove over a NULL operand are NULL in a query, on 10.x (port of #360, #395) - #445
Merged
CaffeinatedCoder merged 1 commit intoOct 25, 2026
Conversation
…ry (#360) array_cat and array_remove aren't strict: array_cat(NULL, '{z}') is {z} and array_remove('{a}', NULL) is {a}. Both were declared as propagating nullability, so a filter's `== null` selected the row while a projection loaded the other operand. Each call is now CASE WHEN a IS NULL OR b IS NULL THEN NULL ELSE f(a, b) END, with the function declared as propagating nothing and never NULL (it is reached only with both operands non-NULL). EF Core folds the test away for a required column, a non-null parameter and a constant, so their SQL is the bare call. ValueSetSqlGuard follows the union through the CASE as before. ValueSetNullOperandParityTests holds it on every route to a NULL operand, registered as an oracle with a seed; the 24 candidates the composition sweeps had registered against #360 are removed. (cherry picked from commit 9b5ed69) Ported to release/10.x for #395. The changelog row goes under [10.3.0] ### Changed answers and the migration text under Changed answers in 10.3.0; the 10.2.0 known difference is removed, and the seed names ValueSetNullOperandParityTests alone, since this line has none of the composition sweeps. Found-By: OT Defect-Class: SQL Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 25, 2026
Closed
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 #395
Port of #360 (PR #443), cherry-picked with
-x.Problem
The same defect as #360, on
release/10.x: a value setUnion(array_cat) andRemove(array_remove) were declared NULL exactly when an operand is NULL, but neither function is strict. So a projection loaded the other operand (r.MaybeTags.Union(o)loadedofor a NULLMaybeTags,r.Tags.Remove(r.Label)loadedTagsfor a NULLLabel) whileWhere(… == null)selected the row. 10.2.0 named it underdocs/efcore.md#known-differences-in-1020.Change
ValueSetsMethodCallTranslator: the Value set Union is declared NULL only for a NULL operand, but array_cat isn't strict: a filter and a projection disagree on a NULL column #360 fix as it is onmain:CASE WHEN a IS NULL OR b IS NULL THEN NULL ELSE f(a, b) END, the inner function declared as propagating nothing. Required columns, non-null parameters and constants keep the bare call.ValueSetNullOperandParityTests(integration) comes with it unchanged: this line has none of the composition sweeps that found it onmain, so it is the regression test here. Registered inoracles.json; the seed names only this oracle on 10.x. ClaimE75holds the newdocs/efcore.mdbullet.CHANGELOG.mdand the EF Core changelog get a### Changed answersrow under[10.3.0]linking 10.x: value set Union and Remove over a NULL operand project a value instead of NULL (port of #360) #395 and the new Changed answers in 10.3.0 section, which holds the migration text frommainwith "Before 10.3.0".[10.3.0]instead of[11.0.0-preview.1]'s Breaking) anddocs/migration.md(10.x has## Changed answers in 10.2.0, not## Migration from v10.x).Tests
EFCore.PostgreSQL.IntegrationTestssuite (302), the EF translation tests (330) and the conventions tests (420) pass.dotnet run tools/oracles.cs seedscatches the seed on this line.ValueSetsMethodCallTranslatorchange reverted torelease/10.x's file, bothValueSetNullOperandParityTeststests fail for the expected reason, e.g.r.MaybeTags.Union(r.Tags) Select, row 1: server {a,b}, rule (c) NULL.🤖 Generated with Claude Code