Repository navigation
Description
Problem
The fixes for #302 (10.x) and #290 (11 line) type the plugin's NULLs by recognising EF Core's output shapes. EmptyCollectionRewriter matches a table-less SELECT … WHERE FALSE whose projections are all NULL constants, and on 10.x also the older empty VALUES. The root cause is lower down: Npgsql writes a null constant without its type, and PostgreSQL resolves a bare NULL as text against the polymorphic range and array operators (42883).
Matching the shape has two costs:
- Any other place where EF Core puts a range- or set-typed
NULLconstant into SQL hits the same42883, and the rewriter doesn't see it. EF Core already changed this shape once in a patch (EF Core 10: InvalidOperationException doing primitive list join when list is empty dotnet/efcore#37216), and 10.x:Any/Countover an empty captured list of ranges or value sets fails with42883: operator does not exist: text && int4rangeon EF Core 10.0.2 and later (dotnet/efcore#37216) #302 was found by a failing consumer query, not by a test. - Everything of the plugin's type in that projection is cast, including a column EF Core typed wrongly. That is main: the empty-root rewrite casts EF Core's
_ordcolumn to the range type (NULL::int4range AS _ord) #319 / 10.x: the empty-root rewrite casts EF Core's_ordcolumn to the range type on EF Core 10.0.2 and later (port of #319) #325's_ord.
Found by the 10.1.0 review on 2026-10-19 (as an altitude finding).
Question
Can the plugin's range and set type mappings write a typed null literal themselves (NULL::int4range, NULL::text[])? Then every null constant of the plugin's types would be typed wherever it appears, and the rewriter would reduce to the empty-VALUES case EF Core 10.0.0/10.0.1 needs. To answer it:
- Read where Npgsql renders a null constant (whether
GenerateSqlLiteral(null)reaches the mapping, or the generator writesNULLitself). - Check what a typed null changes elsewhere:
IS NULL,COALESCEandCASEbranches,ExecuteUpdatesetters, and theto_jsonb(NULL)refusal whose message says theNULLis untyped (fix: name the property path when refusing a value set setter written through jsonb_set_lax (10.x) #313). - Run the integration suites on both lines and on the floor and newest-patch legs.
Release
Internal; no answer should change. If it is done, on both lines.
Activity