Обсуждение: Postgresql datetimes are not ISO-8601 compliant, but RFC3339

Поиск
Список
Период
Сортировка

Postgresql datetimes are not ISO-8601 compliant, but RFC3339

От
Leon Timmermans
Дата:
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

Re: Postgresql datetimes are not ISO-8601 compliant, but RFC3339

От
"David G. Johnston"
Дата:
On Friday, February 11, 2022, Leon Timmermans <fawaka@gmail.com> wrote:
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.


This is indeed what we document.  It is not going to change.  It is not a bug, just a choice that you disagree with.

David J.