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
EF Core 11 reads an empty captured collection as a bare NULL that PostgreSQL types as text: operator does not exist: text && int4range #290
EmptyCollectionRewriter (#137) gave an empty captured collection of ranges or value sets, sent one parameter per element, a one-row VALUES of typed NULLs under WHERE FALSE, because EF Core 10.0.0's SQL generator refused an empty VALUES. EF Core 11's SqlNullabilityProcessor replaces the empty VALUES parameter itself (dotnet/efcore#37216; behind a switch in a 10.0.x patch), before the plugin's pass runs, with
FROM (SELECTNULLAS"Value"WHERE FALSE) AS w WHERE w."Value" && b."Seats"
The NULL is bare: Npgsql writes a null constant without its type, PostgreSQL types it as text, and the query fails on the server:
Npgsql.PostgresException: 42883: operator does not exist: text && int4range
On net11.0 this fails RangeCollectionContainsTests.AnEmptyCollection*, SetCollectionContainsTests.AnEmptyCollection_*, Ranges_AnswerAsInMemory (416 rows) and ValueSets_AnswerAsInMemory (1088 rows): every Any/Count over an empty captured list of ranges or sets throws, where 10.x answers false/0. The old rewriter never sees the empty VALUES on EF Core 11 and is a no-op there. Loud, not silent.
Change
The rewriter matches EF Core 11's shape — a table-less SELECT of null constants under WHERE FALSE — and casts each constant whose type is a registered range or set type to its store type (NULL::int4range), the mapping EF Core already attached from the parameter's element mapping. Other types keep EF Core's SQL (EmptyCollectionGuardTests). Translation tests pin the new SQL; the integration tests of the answers are unchanged.
changed the title [-]EF Core 11 reads an empty captured collection itself: remove `EmptyCollectionRewriter`[/-][+]EF Core 11 reads an empty captured collection as a bare NULL that PostgreSQL types as `text`: `operator does not exist: text && int4range`[/+]on Oct 19, 2026
"Behind a switch in a 10.0.x patch" is EF Core 10.0.2 and later: dotnet/efcore#37248 (milestone 10.0.2) backported #37216, and Microsoft.EntityFrameworkCore.Issue37216 first appears in the 10.0.2 Relational assembly. Npgsql EF 10.0.1–10.0.3 require EF Core ≥ 10.0.4, so the 10.x line fails today for every consumer on a current provider, not when some future patch ships. Measured 2026-10-19 on the 10.0.0 code with EF Core 10.0.13 / Npgsql EF 10.0.3: the same 4 translation and 5 integration failures as here, every 42883 shape, and the off switch restores the 10.0.0 behaviour completely. Filed as #302 under the 10.0.1 epic (#296); the 10.x port has to keep the empty-VALUES path for the floor, which this fix dropped because EF Core 11 never produces it.
Activity
[-]EF Core 11 reads an empty captured collection itself: remove `EmptyCollectionRewriter`[/-][+]EF Core 11 reads an empty captured collection as a bare NULL that PostgreSQL types as `text`: `operator does not exist: text && int4range`[/+]CaffeinatedCoder commentedon Oct 19, 2026
"Behind a switch in a 10.0.x patch" is EF Core 10.0.2 and later: dotnet/efcore#37248 (milestone 10.0.2) backported #37216, and
Microsoft.EntityFrameworkCore.Issue37216first appears in the 10.0.2 Relational assembly. Npgsql EF 10.0.1–10.0.3 require EF Core ≥ 10.0.4, so the 10.x line fails today for every consumer on a current provider, not when some future patch ships. Measured 2026-10-19 on the 10.0.0 code with EF Core 10.0.13 / Npgsql EF 10.0.3: the same 4 translation and 5 integration failures as here, every42883shape, and the off switch restores the 10.0.0 behaviour completely. Filed as #302 under the 10.0.1 epic (#296); the 10.x port has to keep the empty-VALUESpath for the floor, which this fix dropped because EF Core 11 never produces it.