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 20210403030012.GH29126@momjian.us
Whole thread Raw
In response to Re: Have I found an interval arithmetic bug?  (Zhihong Yu <zyu@yugabyte.com>)
List pgsql-hackers
On Fri, Apr  2, 2021 at 07:53:35PM -0700, Zhihong Yu wrote:
> Bruce:
> In src/interfaces/ecpg/pgtypeslib/interval.c, how about the following places ?
> 
> Around line 158:
>                 case 'Y':
>                     tm->tm_year += val;
>                     tm->tm_mon += (fval * MONTHS_PER_YEAR);
> 
> Around line 194:
>                     tm->tm_year += val;
>                     tm->tm_mon += (fval * MONTHS_PER_YEAR);
> 
> Is rint() needed for these two cases ?

Ah, yes, good point.  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: Andres Freund
Date:
Subject: Re: Making wait events a bit more efficient
Next
From: Julien Rouhaud
Date:
Subject: Re: SQL-standard function body