BUG #16571: "time with time zone" type can input '00:00:00+1559'::time with time zone

Started by PG Bug reporting formover 5 years ago2 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 16571
Logged by: osdba
Email address: mailtch@163.com
PostgreSQL version: 13beta2
Operating system: all
Description:

In Document(https://www.postgresql.org/docs/current/datatype-datetime.html),
"time with time zone" range is: 00:00:00+1459 to 24:00:00-1459

but you can input:

osdba=# select '00:00:00+1559'::time with time zone;
timetz
----------------
00:00:00+15:59
(1 row)

osdba=# select '24:00:00-1559'::time with time zone;
timetz
----------------
24:00:00-15:59
(1 row)

you can input range is :
00:00:00+1559 to 24:00:00-1559
not the "00:00:00+1459 to 24:00:00-1459"

Document error or this type bug?

all version postgresql have this strange phenomenon.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: BUG #16571: "time with time zone" type can input '00:00:00+1559'::time with time zone

PG Bug reporting form <noreply@postgresql.org> writes:

In Document(https://www.postgresql.org/docs/current/datatype-datetime.html),
"time with time zone" range is: 00:00:00+1459 to 24:00:00-1459
but you can input:
osdba=# select '00:00:00+1559'::time with time zone;
timetz
----------------
00:00:00+15:59
(1 row)

Hmm, the code is quite clear about it:

/*
* We allow numeric timezone offsets up to 15:59:59 either way from Greenwich.
* Currently, the record holders for wackiest offsets in actual use are zones
* Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42
* until 1867. If we were to reject such values we would fail to dump and
* restore old timestamptz values with these zone settings.
*/
#define MAX_TZDISP_HOUR 15 /* maximum allowed hour part */

Apparently this documentation reference got overlooked the last time
we changed that :-(. Will fix, thanks for the report!

regards, tom lane