Re: BUG #18470: Time literal accepted in Postgres 15 and below, not accepted in Postgres 16

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: david.perez.ingeniero@gmail.com, pgsql-bugs@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2024-05-17T13:46:45Z
Lists: pgsql-bugs
On 2024-May-17, PG Bug reporting form wrote:

> I've read carefully this documentation:
> https://www.postgresql.org/docs/current/datatype-datetime.html
> 
> It states that:
> 
> ISO 8601 specifies the use of uppercase letter T to separate the date and
> time. PostgreSQL accepts that format on input, but on output it uses a space
> rather than T, as shown above. This is for readability and for consistency
> with RFC 3339 as well as some other database systems

Hmm, at least the Wikipedia page claims that the leading T should be
accepted.
https://en.wikipedia.org/wiki/ISO_8601#Times


> postgres=# select 'T14:00:00'::time;
> ERROR:  invalid input syntax for type time: "T14:00:00"

This changed with commit 5b3c5953553b, "Tighten error checks in datetime
input, and remove bogus "ISO" format."

https://git.postgresql.org/cgit/postgresql.git/commit/?id=5b3c5953553bb9fb0b171abc6041e7c7e9ca5b4d

There's no test case modified in this commit that specified only a time
with no date, so assume this particular change was unintentional.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Most hackers will be perfectly comfortable conceptualizing users as entropy
 sources, so let's move on."                               (Nathaniel Smith)
      https://mail.gnu.org/archive/html/monotone-devel/2007-01/msg00080.html



Commits

  1. Fix input of ISO "extended" time format for types time and timetz.

  2. Tighten error checks in datetime input, and remove bogus "ISO" format.