From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
Cc: | Daniel Gustafsson <daniel(at)yesql(dot)se>, Bryn Llewellyn <bryn(at)yugabyte(dot)com>, Tom Lane PostgreSQL <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, John W Higgins <wishdev(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Have I found an interval arithmetic bug? |
Date: | 2021-07-21 02:48:34 |
Message-ID: | 20210721024834.GA8395@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
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(at)momjian(dot)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(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2021-07-21 08:23:18 | Re: Have I found an interval arithmetic bug? |
Previous Message | Rob Sargent | 2021-07-21 00:55:27 | Re: More records after sort |
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2021-07-21 02:52:43 | Re: Add proper planner support for ORDER BY / DISTINCT aggregates |
Previous Message | Michael Paquier | 2021-07-21 02:35:33 | Re: add 'noError' to euc_tw_and_big5.c |