Re: computing dT from an interval

From: "Michael J(dot) Baars" <mjbaars1977(dot)pgsql-hackers(at)cyberfiber(dot)eu>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: computing dT from an interval
Date: 2021-02-23 08:23:21
Message-ID: 1ac3268bf242f667529514fce106e2399ffc82aa.camel@cyberfiber.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2021-02-22 at 10:52 -0500, Tom Lane wrote:
> "Michael J. Baars" <mjbaars1977(dot)pgsql-hackers(at)cyberfiber(dot)eu> writes:
> > So how do you compute the number of seconds in 8 years?
>
> IMO, that's a meaningless computation, because the answer is not fixed.
> Before you claim otherwise, think about the every-four-hundred-years
> leap year exception in the Gregorian rules. Besides, what if the
> question is "how many seconds in 7 years"? Then it definitely varies
> depending on the number of leap days included.
>
> What does make sense is timestamp subtraction, where the actual
> endpoints of the interval are known.
>
> regards, tom lane
>
>
There you have a point. Strange then that you get an answer other than 'undefined' when subtracting x - y, where y is undefined until x is defined, but you are
completely right. An interval of 8 years doesn't count a fixed number of seconds.

Thanks,
Mischa.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2021-02-23 09:27:24 Re: Improvements and additions to COPY progress reporting
Previous Message Amit Kapila 2021-02-23 08:06:29 Re: [PATCH] pg_hba.conf error messages for logical replication connections