Repository navigation
docs: a YearMonthRange column can't load an exclusive infinity - #271
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #258 (part 2; the parity session takes part 1, the
CompareTomessage).Problem
A
YearMonthRangecolumn holdingdaterange '[2026-01-01,infinity)'throwsInvalidOperationExceptionwhen 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 onlyDateRangeandLocalDateRange.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.
DateRange/LocalDateRangeadvice. 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,)).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 aYearMonthRangecolumn 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)throwsInvalidOperationException"…not the last day of a month", and(-infinity,2026-02-01)throws "…not the first day of a month".MonthOfLastDayso it accepts any day fails theinfinity)row.dotnet test: conventions 399 and the new live test 5/5, all green.🤖 Generated with Claude Code