| From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
|---|---|
| To: | Kacper Kuras <kacperkuras(at)hotmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Subject: ISO 8601 expanded years (±YYYYY) rejected on input, though the same dates print fine |
| Date: | 2026-09-09 14:40:08 |
| Message-ID: | 98da1912-ded0-4248-a149-463b8713feec@aklaver.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 9/8/26 7:21 AM, Kacper Kuras wrote:
> Hello,
>
> I maintain a PostgreSQL driver and have been mapping date values between it and
> Kotlin, where the standard library emits ISO 8601 with the expanded year
> representation for years outside 0001..9999. That is where I ran into something
> I would like to understand before I write it down as intended behaviour.
>
> The documentation describes DateStyle 'ISO' as ISO 8601. ISO 8601 represents
> years outside 0001..9999 with an explicit sign and more than four digits
> (+10000, -0001). PostgreSQL accepts neither form on input, although it holds
> and prints the same values happily.
>
>
> The first is the leading sign. 5874897-12-31 is inside what a date holds -
> PostgreSQL stores it and prints it back - but the ISO spelling of the same
> value is refused, and the error suggests why: the '+' appears to be read as the
> start of a time zone displacement rather than as the sign of an expanded year.
> So this is not a range limitation, it is the parser reaching a different
> conclusion about what the character means.
>
> I am happy to be told this is known and deliberate; I could not find it stated
> and wanted to check before treating it as such.
See below for more information:
https://www.postgresql.org/docs/current/datetime-input-rules.html
>
> Thanks,
> Kacper Kuras
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | dinesh kumar | 2026-09-09 16:52:21 | Re: FATAL Idle transaction timeout - TRX Commit |
| Previous Message | Merlin Moncure | 2026-09-08 16:22:43 | Re: FATAL Idle transaction timeout - TRX Commit |