Epoch from age is incorrect

Поиск
Список
Период
Сортировка
От Zhihong Zhang
Тема Epoch from age is incorrect
Дата
Msg-id E756CE54-1946-4DC8-9F63-9BB54A07EF63@gmail.com
обсуждение исходный текст
Ответы Re: Epoch from age is incorrect  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Epoch from age is incorrect  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The epoch from following statement is incorrect,

test_db=# select extract(epoch from age(TIMESTAMP '2013-02-18 06:15:15'));
 date_part 
-----------
 272396685
(1 row)


The correct value should be

test_db=# select (extract(epoch from now()) - extract(epoch from TIMESTAMP '2013-02-18 06:15:15'));
     ?column?     
------------------
 272816228.311208
(1 row)

They are several days apart. Maybe leap years are not counted properly?

Postgresql version:

PostgreSQL 11.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 

Let me know if you need more information. Thanks!

Zhihong

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

Предыдущее
От: Vik Fearing
Дата:
Сообщение: Re: BUG #17220: ALTER INDEX ALTER COLUMN SET (..) with an optionless opclass makes index and table unusable
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #17221: Data sending resume