On 2023-11-13 12:27 +0100, Roman Frołow wrote: > It seems I was wrong. > Now T is mandatory in ISO8601 and from RFC3339 it seems this requirement is > relaxed.
Right. RFC 3339 is from 2002 and it references ISO 8601:1988 where T was optional. (Until today I didn't even know about the 2019 edition.) RFC 3339 made the separator mandatory and also permitted any character. Also SQL only uses part of ISO 8601 (without specifying a particular edition), namely the definition of UTC and date according to 3.1.4 in Part 2 of the standard: > 3.1.4 Definitions taken from ISO 8601 > > For the purposes of this part of ISO/IEC 9075, the definitions of the > following terms given in ISO 8601 apply: > > 3.1.4.1 Coordinated Universal Time (UTC) > 3.1.4.2 date (date, calendar in ISO 8601) I think the docs should clarify that "ISO 8601" in this case refers to a subset of definitions as layed out in the SQL standard. For example, week date (SELECT '2023-W46-1'::date) is not accepted by Postgres, but ordinal date (SELECT '2023-317'::date) is. I also noticed that when people say "ISO 8601" they usually mean RFC 3389 or some subset of ISO 8601. [1] [1] https://robinpokorny.com/blog/why-developers-should-stop-using-iso-8601-for-date-time/ -- Erik