Re: Fix for edge case in date_bin() function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Moaaz Assali <ma5679(at)nyu(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix for edge case in date_bin() function
Date: 2024-02-28 19:06:44
Message-ID: 2425370.1709147204@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Moaaz Assali <ma5679(at)nyu(dot)edu> writes:
> - I have used INT64 -> UINT64 mapping in order to ensure no integer
> overflows are possible.

I don't think I trust this idea, and in any case it doesn't remove
all the overflow hazards: the reduction of the stride interval to
microseconds can overflow, and the final subtraction of the stride
can too. I changed it to just do the straightforward thing
(throwing error if the pg_xxx_s64_overflow routines detect error),
and pushed it. Thanks for the report and patch!

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-02-28 19:07:30 Re: An improved README experience for PostgreSQL
Previous Message David E. Wheeler 2024-02-28 18:54:59 Re: An improved README experience for PostgreSQL