Re: BUG #17573: timestamptz casting precision goes down as the year goes up

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #17573: timestamptz casting precision goes down as the year goes up
Дата
Msg-id 3675316.1659652621@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #17573: timestamptz casting precision goes down as the year goes up  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> timestamptz casting on year 2022 values returns a precision of one
> microsecond (as it is expected).
> As the year goes up, the precision goes down as the script below will show
> for years 2022, 23621, 2713, 4022, and 8022.

The issue here is not with the timestamp, nor even with the extract().
It's with your use of to_timestamp(), which takes float8, which has
limited precision.  The precision is disappearing in the implicit
cast to float8.

Prior to v14, there was also an issue with extract() returning float8,
but nowadays it returns numeric.  If you look directly at the extract()
results you'll see no precision is lost.

Maybe we should invent a variant of to_timestamp that takes numeric, but
the use-case seems pretty niche ...

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17573: timestamptz casting precision goes down as the year goes up
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17574: Attaching an invalid index to partition head make head index invalid forever