Skip to content

docs: a YearMonthRange column can't load an exclusive infinity - #271

Merged
CaffeinatedCoder merged 2 commits into
mainfrom
docs/258-yearmonth-exclusive-infinity
Oct 19, 2026
Merged

CaffeinatedCoder merged 2 commits into
mainfrom
docs/258-yearmonth-exclusive-infinity

Conversation

@CaffeinatedCoder

@CaffeinatedCoder CaffeinatedCoder commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Closes #258 (part 2; the parity session takes part 1, the CompareTo message).

Problem

A YearMonthRange column holding daterange '[2026-01-01,infinity)' throws InvalidOperationException when it loads ("The date range bound 9999-12-30 is not the last day of a month"). This is older than 10.0.0 and fails loudly, but docs/efcore.md's advice on rows other tools write named only DateRange and LocalDateRange.

Change

I chose to document it rather than read it as an unbounded month end. [x,infinity) holds every day up to 9999-12-30 (#117), which ends part-way through December 9999. The two possible month readings both change the row's value:

  • [x, 9999-12] saves back as [x,infinity], a different row.
  • [x, 9999-11] drops days the server's range holds.

#117 declined the same guess for dates, because it made reads disagree with the server's own algebra. The month-alignment rule refuses any range that covers part of a month, and this is one, so the loud failure stays.

  • docs/efcore.md, "Rows written by other tools": a paragraph beside the DateRange/LocalDateRange advice. It says that both exclusive forms ([x,infinity) and (-infinity,x)) throw, and that the absent and inclusive forms load ([2026-01,9999-12], [2026-01,)).
  • New claim E63, held by the live test below.
  • A Docs: line under 10.0.0 in the root changelog and the NodaTime EF Core package changelog.

Tests

  • TimeAndYearMonthIntegrationTests.YearMonthRange_AnOpenEndWrittenByAnotherTool_LoadsOrFailsLoudly (live) loads five spellings written into a YearMonthRange column by SQL. daterange('2026-01-01', NULL) loads as [2026-01,), […,infinity] as [2026-01,9999-12], and [-infinity,2026-02-01) as [-9998-01,2026-01]. [2026-01-01,infinity) throws InvalidOperationException "…not the last day of a month", and (-infinity,2026-02-01) throws "…not the first day of a month".
  • Loosening MonthOfLastDay so it accepts any day fails the infinity) row.
  • dotnet test: conventions 399 and the new live test 5/5, all green.

🤖 Generated with Claude Code

daterange '[2026-01-01,infinity)' holds every day up to 9999-12-30
(#117), which ends part-way through a month, so a YearMonthRange column
holding it throws InvalidOperationException when it loads; (-infinity,x)
fails the same way at its start. Reading it as the whole last month
would save the row back as infinity], a different value, which is the
guess #117 declined for dates, so the loud failure stays and is now
documented beside the DateRange and LocalDateRange advice, with E63.

TimeAndYearMonthIntegrationTests loads each spelling of an open end from
a YearMonthRange column: absent and inclusive load, the two exclusive
forms throw naming the partial month. Loosening the month-alignment
check fails the infinity) row.

Part of #258

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 10.0.0 milestone Oct 19, 2026
@CaffeinatedCoder CaffeinatedCoder added documentation Improvements or additions to documentation area/ranges Range unions, variants and the shape engines package/nodatime Affects CodoMetis.ValueRanges.NodaTime package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL labels Oct 19, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 6441540 into main Oct 19, 2026
@CaffeinatedCoder
CaffeinatedCoder deleted the docs/258-yearmonth-exclusive-infinity branch October 19, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ranges Range unions, variants and the shape engines documentation Improvements or additions to documentation package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/nodatime Affects CodoMetis.ValueRanges.NodaTime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A YearMonthRange column can't load an exclusive infinity)

1 participant