From: Bruce Momjian <bruce@momjian.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Zhihong Zhang <zhihong@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: Epoch from age is incorrect
Date: Mon, 11 Oct 2021 17:56:12 -0400
Message-ID: <20211011215612.GE643@momjian.us> (raw)
In-Reply-To: <CAKFQuwb5tRgZs0K_2iAzYdQ3uYcxMJ+zLObpYmx05HDpSiLCiQ@mail.gmail.com>
References: <E756CE54-1946-4DC8-9F63-9BB54A07EF63@gmail.com>
<CAKFQuwb5tRgZs0K_2iAzYdQ3uYcxMJ+zLObpYmx05HDpSiLCiQ@mail.gmail.com>
On Mon, Oct 11, 2021 at 02:52:59PM -0700, David G. Johnston wrote:
> On Monday, October 11, 2021, Zhihong Zhang <zhihong@gmail.com> wrote:
>
>
> They are several days apart. Maybe leap years are not counted properly?
>
>
> That is related. Intervals supply integer years, months, and days (for
> example). Given an integer month (or year) value there is no way to accurately
> compute the number of days involved (or any subfield of day) since you lack
> knowledge of which months (years) they are (generally). So extracting an epoch
> from an interval is an inherently unwise thing to do. Having done it,
> comparing its result to a timestamp epoch computation is meaningless. If you
> can do the later then just do it as it will provide the expected answer while
> the interval epoch is inherently problematic.
Yes. Also, this blog has more details:
https://momjian.us/main/blogs/pgblog/2020.html#August_3_2020
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: bruce@momjian.us, david.g.johnston@gmail.com, zhihong@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Epoch from age is incorrect
In-Reply-To: <20211011215612.GE643@momjian.us>
* 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