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
[email protected]