Обсуждение: BUG #17305: to_timestamp accept dates rejected by timestamptz cast

Поиск
Список
Период
Сортировка

BUG #17305: to_timestamp accept dates rejected by timestamptz cast

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      17305
Logged by:          Chinh Nguyen
Email address:      nguyenkhacchinh@hotmail.com
PostgreSQL version: 10.19
Operating system:   Linux
Description:

I don't know if this is a bug or just an unusual behavior. I had assumed,
per the documentation, that function to_timestamp() is the same as
timestamptz but with control for different formats.

The following dates are all rejected by timestamptz (e.g., select
'0000-01-01T00:00:01Z'::timestamptz):
0000-01-01T00:00:01Z, 0000-02-29T00:00:01Z, 0000-02-30T00:00:01Z,
0000-02-31T00:00:01Z

But they are accepted by to_timestamp (e.g., select to_timestamp('0000-01-01
00:00:00+00','YYYY-MM-DDThh24:mi:ssZ')). The results from to_timestamp
are:
0001-01-01 00:00:00+00 BC, 0001-02-29 00:00:00+00 BC, 0001-03-01 00:00:00+00
BC, 0001-03-02 00:00:00+00 BC

My version is 10.19 but I also tested against an online test db running
11.10.


Re: BUG #17305: to_timestamp accept dates rejected by timestamptz cast

От
Tom Lane
Дата:
PG Bug reporting form <noreply@postgresql.org> writes:
> I don't know if this is a bug or just an unusual behavior. I had assumed,
> per the documentation, that function to_timestamp() is the same as
> timestamptz but with control for different formats.

It is not, and I don't see the documentation claiming that it is.

            regards, tom lane