Re: Fix overflow in justify_interval related functions - Mailing list pgsql-hackers

From Joseph Koshakow
Subject Re: Fix overflow in justify_interval related functions
Date
Msg-id CAAvxfHd1naq8NGyU10R1fG+nCQKcrrFBK3YfLuuGu1R7nB=Z7A@mail.gmail.com
Whole thread Raw
In response to Re: Fix overflow in justify_interval related functions  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: Fix overflow in justify_interval related functions  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers
On Mon, Feb 14, 2022 at 7:59 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
> I think it's possible to avoid overflow in justify_interval() in some cases
> by pre-justifying the days.  I've attached a patch to demonstrate.
>
> --
> Nathan Bossart
> Amazon Web Services: https://aws.amazon.com

Good catch, I didn't think about that. Though if you are pre-justifying
the days, then I don't think it's possible for the second addition to
days to overflow. The maximum amount the days field could be after
the first justification is 29. I think we can simplify it further to the
attached patch.

- Joe

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: automatically generating node support functions
Next
From: Tom Lane
Date:
Subject: Re: automatically generating node support functions