Repository navigation
Fix BCE NodaTime SQL literal formatting - #4023
Merged
Merged
Conversation
Use PostgreSQL year-of-era notation and a BC suffix for BCE scalar, range and multirange SQL literals while preserving ISO JSON serialization. Add paired SQL and JSON date/time coverage. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 233c3a0c-6558-4c6a-86f8-d65a5488801b
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues, and focused regression coverage exercises the affected paths; tests were not executed.
No open issues 🎉
What changed in this PR
Fixes #3532 by generating PostgreSQL-compatible BCE NodaTime SQL literals while preserving ISO JSON formatting and infinity handling.
Changes:
- Uses year-of-era formatting with a
BCsuffix for BCE dates and timestamps. - Applies formatting to legacy Instant mappings, ranges, and multiranges.
- Adds SQL/JSON regression coverage for NodaTime and BCL date/time mappings.
| File | Description |
|---|---|
| test/EFCore.PG.Tests/Storage/NpgsqlTypeMappingTest.cs | Adds paired BCL SQL/JSON tests. |
| test/EFCore.PG.Tests/Storage/NpgsqlNodaTimeTypeMappingTest.cs | Covers BCE literals, ranges, multiranges, and JSON preservation. |
| src/EFCore.PG.NodaTime/Storage/Internal/TimestampTzZonedDateTimeMapping.cs | Formats BCE zoned timestamps. |
| src/EFCore.PG.NodaTime/Storage/Internal/TimestampTzOffsetDateTimeMapping.cs | Separates BCE SQL formatting from JSON. |
| src/EFCore.PG.NodaTime/Storage/Internal/TimestampTzInstantMapping.cs | Adds shared Instant SQL formatting. |
| src/EFCore.PG.NodaTime/Storage/Internal/TimestampLocalDateTimeMapping.cs | Formats BCE local timestamps without changing JSON. |
| src/EFCore.PG.NodaTime/Storage/Internal/LegacyTimestampInstantMapping.cs | Reuses Instant SQL formatting. |
| src/EFCore.PG.NodaTime/Storage/Internal/IntervalRangeMapping.cs | Formats BCE interval bounds. |
| src/EFCore.PG.NodaTime/Storage/Internal/DateMapping.cs | Adds BCE date SQL formatting while preserving JSON. |
| src/EFCore.PG.NodaTime/Storage/Internal/DateIntervalRangeMapping.cs | Reuses date SQL formatting for interval bounds. |
Review effort: Balanced
This was referenced Oct 18, 2026
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport #4023 (00b5456) to 10.0. Format BCE NodaTime SQL literals with year-of-era notation and a BC suffix while preserving JSON serialization and infinity behavior. Fixes #3532 Co-authored-by: Copilot App <[email protected]> Copilot-Session: ad20383a-8f78-4bcc-955b-1c00522588b0
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport #4023 to 9.0, preserving ISO JSON serialization and infinity handling while formatting BCE SQL literals with year-of-era and BC. (cherry picked from commit 00b5456) Co-authored-by: Copilot App <[email protected]> Copilot-Session: 113c1bef-4117-4954-bc8c-8da076bdf6c1
roji
added a commit
that referenced
this pull request
Oct 18, 2026
Backport #4023 (00b5456) to hotfix/8.0.12. Preserve ISO JSON serialization and infinity handling, adapt test placement and LocalDateTime extrema to the 8.0 branch, and cover the original 384 BCE date. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 23da65c3-017a-4188-99fc-477970542012
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.
BCE NodaTime values currently generate ISO SQL literals with negative years or year zero, which PostgreSQL rejects. Format SQL literals using year-of-era notation and a
BCsuffix, including timestamps, legacy Instant mappings, ranges, and multiranges.Keep JSON serialization in its existing ISO format and preserve infinity handling. Add paired SQL/JSON coverage for NodaTime and BCL date/time mappings, plus BCE range and multirange coverage.
BCE JSON-to-date casts remain a pre-existing limitation: JSON formatting and query translation are unchanged by this fix.
Fixes #3532