Re: Have I found an interval arithmetic bug?

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-20 22:53:50
Message-ID: 20210720225350.GB27025@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Jul 20, 2021 at 02:33:07PM -0700, Zhihong Yu wrote:
> On Mon, Jul 19, 2021 at 9:14 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > 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().
>
> Patch looks good.
> Maybe add the statement above as a test case :
>
> SELECT INTERVAL '1.8594 months' 

Good idea --- updated patch attached.

--
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.

Attachment Content-Type Size
interval.diff.gz application/gzip 2.1 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zhihong Yu 2021-07-21 00:13:37 Re: Have I found an interval arithmetic bug?
Previous Message Zhihong Yu 2021-07-20 21:33:07 Re: Have I found an interval arithmetic bug?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-07-20 23:08:40 Re: POC: GROUP BY optimization
Previous Message Ranier Vilela 2021-07-20 22:16:10 Re: Signed vs Unsigned (take 2) (src/backend/storage/ipc/procarray.c)