On 2023-11-15 12:53 +0100, Peter Eisentraut wrote: > On 15.11.23 09:37, Erik Wienhold wrote: > > On 2023-11-15 08:16 +0100, Peter Eisentraut wrote: > > > The SQL standard does not refer to ISO 8601 to define date formats, it has > > > its own definitions. In fact, PostgreSQL implements more date formats > > > than > > > the SQL standard requires. > > > > Really? Then what does the standard mean with section "Definitions > > taken from ISO 8601" which I quoted in [1]? Just using the term "date" > > without adopting its syntax? > > Exactly, it just imports the definitions of those terms.
Thanks, now I see. SQL only defines date format 'YYYY-MM-DD' (YYYY, MM, and DD can be any unsigned integer) with this BNF: > <date literal> ::= > DATE <date string> > > <date string> ::= > <quote> <unquoted date string> <quote> > > <unquoted date string> ::= > <date value> > > <date value> ::= > <years value> <minus sign> <months value> <minus sign> <days value> And timestamp is only defined with a space separator which is clearly not ISO 8601: > <unquoted timestamp string> ::= > <unquoted date string> <space> <unquoted time string> > > And the Postgres docs also say "The SQL standard requires the use of the > > ISO 8601 format." [2] > > [2] > > https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT > > Yeah, that isn't correct. > > I think we should reframe "ISO" to mean "ISO 9075" and remove all claims of > alignment with ISO 8601 and RFC 3339. Agree. So just list the example inputs without any reference to a particular standard, except for ISO 9075 to show that Postgres is SQL-standard-compliant? -- Erik