pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Bruce Momjian <bruce@momjian.us>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Bryn Llewellyn <bryn@yugabyte.com>
Cc: Tom Lane PostgreSQL <tgl@sss.pgh.pa.us>
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: Tue, 20 Jul 2021 22:48:34 -0400
Message-ID: <20210721024834.GA8395@momjian.us> (raw )
In-Reply-To: <CALNJ-vQXQGPQiKt1SubT2fd4xGuvoN9UUtJyVr8JRfPxBfQHgg@mail.gmail.com >
References: <20210508024204.GB27048@momjian.us >
<CALNJ-vQLukGOX5HKa7Z5tKYfNOyB6u0dU2+SuRFXExoJ_7m8QA@mail.gmail.com >
<076E1871-8446-405C-9561-29FA03F46A4A@yesql.se >
<20210630163516.GA3304@momjian.us >
<CALNJ-vTD709opMzOyfT=KVtXaAvLmpqPGGEqqqXMSZwF8aQH1A@mail.gmail.com >
<CALNJ-vQfTHNbH3VCeg3ChT42y1swnWtV-6iztthO8QfOE8wdwg@mail.gmail.com >
<20210720041419.GA5882@momjian.us >
<CALNJ-vSc22BFW__bUqJk0USvn8_w+fWLWJjNqH=6WSa1-OJRTQ@mail.gmail.com >
<20210720225350.GB27025@momjian.us >
<CALNJ-vQXQGPQiKt1SubT2fd4xGuvoN9UUtJyVr8JRfPxBfQHgg@mail.gmail.com >
On Tue, Jul 20, 2021 at 05:13:37PM -0700, Zhihong Yu wrote:
> On Tue, Jul 20, 2021 at 3:53 PM Bruce Momjian <bruce@momjian.us> wrote:
> With your patch, the following example (Coutesy Bryn) still shows fraction:
>
> # select (interval '1 month')*1.123;
> ?column?
> -----------------------
> 1 mon 3 days 16:33:36
> (1 row)
>
> Do you think the output can be improved (by getting rid of fraction) ?
Well, I focused on how fractional units were processed inside of
interval values. I never considered how multiplication should be
handled. I have not really thought about how to handle that, but this
example now gives me concern:
SELECT INTERVAL '1.06 months 1 hour';
interval
-----------------------
1 mon 2 days 01:00:00
Notice that it rounds the '1.06 months' to '1 mon 2 days', rather than
spilling to hours/minutes/seconds, even though hours is already
specified. I don't see a better way to handle this than the current
code already does, but it is something odd.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.
view thread (99+ messages) latest in thread
Message-ID: <20210721024834.GA8395@momjian.us>
Permalink: ../20210721024834.GA8395@momjian.us/
Also on: postgresql.org/message-id/20210721024834.GA8395@momjian.us
copy link · copy postgr.es
reply 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, zyu@yugabyte.com, daniel@yesql.se, bryn@yugabyte.com, tgl@sss.pgh.pa.us, pryzby@telsasoft.com, isaac.morland@gmail.com, wishdev@gmail.com
Subject: Re: Have I found an interval arithmetic bug?
In-Reply-To: <20210721024834.GA8395@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