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
main: the empty-root rewrite casts EF Core's _ord column to the range type (NULL::int4range AS _ord) #319
area/range-setRangeSet and multirange algebraarea/value-setsValue set families and wrapper aritiesbugSomething isn't workingpackage/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQLpackage/efcore-nodatimeAffects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTimeseverity/lowCosmetic, message or documentation-level difference
EmptyCollectionRewriter casts every NULL constant of EF Core's empty query root whose CLR type is a registered range or value set type. EF Core gives the constant of its _ord ordering column that type too, so _ord is cast to the range type. Measured on main at 5f08625 with a translation probe:
SELECT (
SELECT e."Value"FROM (
SELECTNULL::int4range AS _ord, NULL::int4range AS"Value"WHERE FALSE
) AS e
WHERE e."Value" && b."Seats"ORDER BYe._ordLIMIT1)
FROM"Bookings"AS b
The same query over a non-empty list writes FROM (VALUES (0, @full1), (1, @full2)) AS f(_ord, "Value"), an integer _ord. On release/10.x the EF Core 10.0.0/10.0.1 path writes 0 for it (OneRowOfNulls).
This is latent. Under WHERE FALSE no row exists, and ORDER BY over a range-typed NULL is valid SQL, so nothing fails today. A shape in which EF Core compares _ord with an integer would fail on the server, for the empty list only, with operator does not exist: int4range = integer.
Found by the review of PR #292 on 2026-10-19, and reproduced since.
Change
Leave _ord out of the cast in TypeTheNulls (match the projection alias, as OneRowOfNulls does on 10.x) and write it as an integer, the type it has when the list has elements. Assert the whole subquery of the FirstOrDefault shape in RangeCollectionTranslationTests, and prove the test by reverting the change.
Release
Not silent: no answer changes. #327 asks whether the cast belongs in the type mappings instead. The port to release/10.x is #325.
Fixed in PR #389. _ord is now 0, and the whole FirstOrDefault statement is pinned; the test was proven by reverting the fix. The 10.x port is PR #390 (#325).
area/range-setRangeSet and multirange algebraarea/value-setsValue set families and wrapper aritiesbugSomething isn't workingpackage/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQLpackage/efcore-nodatimeAffects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTimeseverity/lowCosmetic, message or documentation-level difference
Activity
CaffeinatedCoder commentedon Oct 24, 2026
Re-evaluated 2026-10-24: the port, #325, is now in 10.2.0 (epic #358), so this
mainfix comes before the 10.2.0 tag.CaffeinatedCoder commentedon Oct 24, 2026
Fixed in PR #389.
_ordis now0, and the wholeFirstOrDefaultstatement is pinned; the test was proven by reverting the fix. The 10.x port is PR #390 (#325).Merge pull request #389 from CaffeinatedCoder/fix/319-ord-cast