Re: T is a mandatory date time separator in RFC3339 but documentation states differently

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Roman Frołow <rofrol(at)gmail(dot)com>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: T is a mandatory date time separator in RFC3339 but documentation states differently
Date: 2023-11-15 12:47:45
Message-ID: mmvqgl2yf76ufsb2zug7hjqmu5cqxk4wfy6lkax7beeeeqgn56@svb7qhcyno6t
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2023-11-15 14:46:43 Re: T is a mandatory date time separator in RFC3339 but documentation states differently
Previous Message Peter Eisentraut 2023-11-15 11:53:33 Re: T is a mandatory date time separator in RFC3339 but documentation states differently