From: Bruce Momjian <bruce@momjian.us>
To: Bryn Llewellyn <bryn@yugabyte.com>
Cc: Tom Lane PostgreSQL <tgl@sss.pgh.pa.us>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Isaac Morland <isaac.morland@gmail.com>
Cc: John W Higgins <wishdev@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Have I found an interval arithmetic bug?
Date: Wed, 21 Jul 2021 21:43:31 -0400
Message-ID: <20210722014331.GB19630@momjian.us> (raw)
In-Reply-To: <654FEA5F-79CF-414A-9801-F1482EEBCD88@yugabyte.com>
References: <CALNJ-vSc22BFW__bUqJk0USvn8_w+fWLWJjNqH=6WSa1-OJRTQ@mail.gmail.com>
<20210720225350.GB27025@momjian.us>
<CALNJ-vQXQGPQiKt1SubT2fd4xGuvoN9UUtJyVr8JRfPxBfQHgg@mail.gmail.com>
<20210721024834.GA8395@momjian.us>
<CAEZATCVMXYR4-GEr4UXzZVdS1CLwFweO7P=vZrepcMu6VrQMUQ@mail.gmail.com>
<677937.1626861539@sss.pgh.pa.us>
<CEA45CB6-7C0B-4960-9913-BD009DD04533@yugabyte.com>
<711398.1626888589@sss.pgh.pa.us>
<20210722000713.GA19630@momjian.us>
<654FEA5F-79CF-414A-9801-F1482EEBCD88@yugabyte.com>
On Wed, Jul 21, 2021 at 06:39:26PM -0700, Bryn Llewellyn wrote:
> Your statement
>
>
> “months-to-days conversion is almost always an approximation, while the
> days to seconds conversion is almost always accurate.”
>
>
> is misleading. Any conversion like these (and also the “spill up” conversions
> that the justify_hours(), justify_days(), and justify_interval() built-in
> functions bring) are semantically dangerous because of the different rules for
> adding a pure months, a pure days, or a pure seconds interval to a timestamptz
> value.
We are trying to get the most reasonable output for fractional values
--- I stand by my statements.
> Unless you avoid mixed interval values, then it’s so hard (even though it is
> possible) to predict the outcomes of interval arithmetic. Rather, all you get
> is emergent behavior that I fail to see can be relied upon in deliberately
> designed application code. Here’s a telling example:
The point is that we will get unusual values, so we should do the best
we can.
--
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-hackers@postgresql.org
Cc: bruce@momjian.us, bryn@yugabyte.com, tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com, zyu@yugabyte.com, daniel@yesql.se, pryzby@telsasoft.com, isaac.morland@gmail.com, wishdev@gmail.com
Subject: Re: Have I found an interval arithmetic bug?
In-Reply-To: <20210722014331.GB19630@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