Postgresql datetimes are not ISO-8601 compliant, but RFC3339

From: Leon Timmermans <fawaka(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Postgresql datetimes are not ISO-8601 compliant, but RFC3339
Date: 2022-02-12 02:17:16
Message-ID: CAHhgV8hKWA8JtWEqzhAj-eA9TenG-iu620ZsaxJnFAYMiE6A2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Postgresql calls its datetime format ISO-8601 in the documentation and in
the DateStyle setting, but it is in fact not ISO compliant, but RFC3339
instead. To quote the latter (which is freely available unlike the ISO
standard):

NOTE: ISO 8601 defines date and time separated by "T".
Applications using this syntax may choose, for the sake of
readability, to specify a full-date and full-time separated by
(say) a space character.

Basically instead of outputting «2022-02-12 02:53:59.55718+01», it should
output «2022-02-12T02:53:59.55718+01» to be compliant. Fortunately it will
accept compliant datetimes as input just fine. I ran into this because I
was feeding these values into a strict ISO-8601 implementation and it
rejected these values.

The solution that I would suggest for the next major release is to add a
new RFC DateStyle with the current behavior and make the ISO setting do the
conformant thing; and on existing release series add RFC as an alias of ISO
to facilitate the transition for people who may rely on the current
behavior.

Regards,

Leon

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2022-02-12 15:37:47 Re: Postgresql datetimes are not ISO-8601 compliant, but RFC3339
Previous Message Troy Frericks 2022-02-11 23:30:40 A bug with the TimeStampTZ data type and the 'AT TIME ZONE' clause