Re: Have I found an interval arithmetic bug? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Have I found an interval arithmetic bug?
Date
Msg-id 20210720041419.GA5882@momjian.us
Whole thread Raw
In response to Re: Have I found an interval arithmetic bug?  (Zhihong Yu <zyu@yugabyte.com>)
Responses Re: Have I found an interval arithmetic bug?  (Zhihong Yu <zyu@yugabyte.com>)
List pgsql-hackers
On Wed, Jul 14, 2021 at 09:03:21AM -0700, Zhihong Yu wrote:
> On Thu, Jul 8, 2021 at 10:22 AM Zhihong Yu <zyu@yugabyte.com> wrote:
>     On Wed, Jun 30, 2021 at 9:35 AM Bruce Momjian <bruce@momjian.us> wrote:
> 
>         On Tue, Jun 29, 2021 at 06:49:45PM +0200, Daniel Gustafsson wrote:
>         > > On 29 Jun 2021, at 18:50, Zhihong Yu <zyu@yugabyte.com> wrote:
>         >
>         > > Now that PG 15 is open for commit, do you think the patch can land
>         ?
>         >
>         > Adding it to the commitfest patch tracker is a good way to ensure
>         it's not
>         > forgotten about:
>         >
>         >       https://commitfest.postgresql.org/33/
> 
>         OK, I have been keeping it in my git tree since I wrote it and will
>         apply it in the next few days.
>     Thanks, Bruce.
> 
>     Hopefully you can get to this soon. 
> 
> Bruce: 
> Please see if the patch can be integrated now.

I found a mistake in my most recent patch.  For example, in master we
see this output:

    SELECT INTERVAL '1.8594 months';
             interval
    --------------------------
     1 mon 25 days 18:46:04.8

Obviously this should return '1 mon 26 days', but with my most recent
patch, it returned '1 mon 25 days'.  Turns out I had not properly used
rint() in AdjustFractDays, and in fact the function is now longer needed
because it is just a multiplication and an rint().

Updated patch attached.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.


Attachment

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Failure with 004_logrotate in prairiedog
Next
From: Amit Kapila
Date:
Subject: Re: row filtering for logical replication