Re: Fix overflow hazard in interval rounding - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Fix overflow hazard in interval rounding
Date
Msg-id 2715361.1707858079@sss.pgh.pa.us
Whole thread Raw
In response to Re: Fix overflow hazard in interval rounding  (Joseph Koshakow <koshy44@gmail.com>)
List pgsql-hackers
Joseph Koshakow <koshy44@gmail.com> writes:
> On Tue, Feb 13, 2024 at 1:46 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> (We'd need ereport in back branches, but this problem seems to
>> me to probably not be worth back-patching.)

> Agreed, this seems like a pretty rare overflow/underflow.

OK, pushed to HEAD only.  I converted the second steps to be like
"a -= a%b" instead of "a = (a/b)*b" to make it a little clearer
that they don't have their own risks of overflow.  Maybe it's a
shade faster that way too, not sure.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Joseph Koshakow
Date:
Subject: Re: Fix overflow hazard in interval rounding
Next
From: Justin Pryzby
Date:
Subject: Re: pg_upgrade and logical replication