From: Zhihong Zhang <zhihong@gmail.com>
To: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Epoch from age is incorrect
Date: Mon, 11 Oct 2021 16:39:37 -0400
Message-ID: <E756CE54-1946-4DC8-9F63-9BB54A07EF63@gmail.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: zhihong@gmail.com
Subject: Re: Epoch from age is incorrect
In-Reply-To: <E756CE54-1946-4DC8-9F63-9BB54A07EF63@gmail.com>
References: <E756CE54-1946-4DC8-9F63-9BB54A07EF63@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox