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

The Post Office <noreply@postgresql.org>

From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: david.perez.ingeniero@gmail.com
Date: 2024-05-17T11:04:53Z
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18470
Logged by:          david perez
Email address:      david.perez.ingeniero@gmail.com
PostgreSQL version: 16.3
Operating system:   Linux
Description:        

This is the result with Postgres 16:

postgres=# select VERSION();
                                                       version              
                                        
---------------------------------------------------------------------------------------------------------------------
 PostgreSQL 16.3 (Debian 16.3-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
(1 row)

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

And this is the result with Postgres 15:

postgres=# select VERSION();
                                                       version              
                                        
---------------------------------------------------------------------------------------------------------------------
 PostgreSQL 15.7 (Debian 15.7-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
(1 row)

postgres=# select 'T14:00:00'::time;
   time   
----------
 14:00:00
(1 row)

A time literal that begins with the letter "T" isn't accepted anymore.

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

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.