Skip to content

Shift/Expand turn a bound that stands for ±infinity into a finite date #224

Closed

Description

@CaffeinatedCoder

Problem

Shift/Expand move a bound that stands for PostgreSQL ±infinity as if it were an ordinary date. A column holding [2026-01-01,infinity) loads as [2026-01-01,9999-12-30] (the #117 read rule). .Shift(-1) then saves [2025-12-31,9999-12-30), a finite range. PostgreSQL's own upper(r) - 1 keeps infinity. A tsrange […,infinity) saves as 9999-12-30 23:59:59.999999. A live probe confirmed all three. docs/efcore.md says MaxValue "stands for" infinity, but under these two operations it doesn't. Found by the pre-tag analysis (#179). Silent when written back.

Decision (maintainer, 2026-10-18)

On the temporal types whose extremes stand for ±infinity, Shift and Expand leave a bound at MinValue/MaxValue where it is, as infinity ± d stays infinite in PostgreSQL. The types are DateRange, DateTimeRange, DateTimeOffsetRange, and the NodaTime temporal ranges whose store mapping uses infinity (check YearMonthRange). A move that would carry a finite bound past an extreme still throws OverflowException. Integer and float ranges are unchanged: their extremes are ordinary values.

Check the interaction with the read rule from #117: a bound that loaded from infinity must come back as the same extreme, so a round trip through Shift(d).Shift(-d) stays the identity.

Done when

  • docs/ranges.md (Shift/Expand) and docs/efcore.md state the rule.
  • A claim holds it.
  • A live test shows that a row read from [x,infinity), shifted and saved, still reads upper_inf/infinity from PostgreSQL, and fails with the rule removed.

Activity

  1. added this to the 10.0.0 milestone on Oct 18, 2026
  2. added
    bug
    silent
    area/ranges
    package/nodatime
    on Oct 18, 2026
  3. added
    package/efcore
    package/core
    severity/medium
    on Oct 18, 2026
  4. CaffeinatedCoder commented on Oct 18, 2026

    @CaffeinatedCoder
    OwnerAuthor

    Fixed in #238. One part of the done-when can't hold as written: a daterange with an exclusive infinity) comes back finite from a plain save, moved or not. It loads as [x,9999-12-30], and the plugin writes that as [x,9999-12-31), the behaviour #117 settled by documenting. For that form the live test (InfinityShiftRoundTripTests) holds that the moved row saves exactly as the unmoved one does. The tsrange, tstzrange, daterange [x,infinity] and [-infinity,x] and NodaTime rows still hold infinity after a shift and save. A closed date range's end the day before the maximum counts as infinity) and stays, which fixes the issue's first example in memory.

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/rangesbugpackage/corepackage/efcorepackage/nodatimeseverity/mediumsilent

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions