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: 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-04-03 03:00:12
Message-ID: 20210403030012.GH29126@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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(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 text/x-diff 5.0 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joao Miguel Ferreira 2021-04-03 10:59:18 ignore tablespace in schema definition queries
Previous Message Zhihong Yu 2021-04-03 02:53:35 Re: Have I found an interval arithmetic bug?

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2021-04-03 03:39:43 Re: SQL-standard function body
Previous Message Andres Freund 2021-04-03 02:55:16 Re: Making wait events a bit more efficient