Skip to content

10.x: the empty-root rewrite casts EF Core's _ord column to the range type on EF Core 10.0.2 and later (port of #319) #325

Closed

Description

@CaffeinatedCoder

Problem

The same defect as #319, on release/10.x. When EF Core replaces an empty captured list with its own SELECT … WHERE FALSE (10.0.2 and later, dotnet/efcore#37216), TypeTheNulls casts EF Core's _ord ordering column to the range type.

Measured on release/10.x at 3ed738e with -p:EfFloat=10.0.13 -p:NpgsqlEfFloat=10.0.3, for db.Bookings.Select(b => empty.Where(w => w.Overlaps(b.Seats)).FirstOrDefault()):

FROM (
    SELECT NULL::int4range AS _ord, NULL::int4range AS "Value"
    WHERE FALSE
) AS e
WHERE e."Value" && b."Seats"
ORDER BY e._ord

On the EF Core 10.0.0 floor, OneRowOfNulls writes the same column as 0: FROM (VALUES (0, NULL::int4range)) AS e(_ord, "Value").

This is latent, as described in #319: no row exists and ORDER BY over a range NULL is valid, so nothing fails today. It shipped in 10.1.0 with the #302 fix.

Change

Cherry-pick the #319 fix with -x, with its test. On this branch the test runs on the newest-patch leg (#297), since the floor never reaches TypeTheNulls.

Release

Not silent; no answer changes. It goes to whichever 10.x release picks it up.

Activity

  1. added
    bugSomething isn't working
    area/range-setRangeSet and multirange algebra
    area/value-setsValue set families and wrapper arities
    package/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQL
    package/efcore-nodatimeAffects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime
    severity/lowCosmetic, message or documentation-level difference
    on Oct 19, 2026
  2. added this to the 10.2.0 milestone on Oct 24, 2026
  3. CaffeinatedCoder commented on Oct 24, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Moved into 10.2.0 (epic #358) on 2026-10-24. The fix is small, and #319 lands on main first.

  4. CaffeinatedCoder commented on Oct 24, 2026

    @CaffeinatedCoder
    OwnerAuthor

    PR #390 cherry-picks the #319 fix (PR #389) with -x. The test pins both EF Core paths. On 10.0.13 it fails with the fix stripped; on the floor it can't, because the floor never reaches TypeTheNulls. Close this by hand after the merge, since Closes doesn't act on release/10.x.

  5. added a commit that references this issue on Oct 24, 2026
  6. CaffeinatedCoder commented on Oct 24, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Fixed on release/10.x by PR #390, merge commit 9af5842 (a cherry-pick of 474fc44 from PR #389, which fixed #319 on main). It ships in 10.2.0 (#358). Closed by hand, since Closes doesn't act on release/10.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    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

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions