Re: Fix overflow in justify_interval related functions

2022-02-28 Thread Tom Lane
Joseph Koshakow writes: > [ v4-0001-Check-for-overflow-in-justify_interval-functions.patch ] Pushed. I added a comment explaining why the one addition in interval_justify_interval doesn't require an overflow check. regards, tom lane

Re: Fix overflow in justify_interval related functions

2022-02-25 Thread Nathan Bossart
On Fri, Feb 25, 2022 at 10:30:57AM -0500, Joseph Koshakow wrote: > Just checking because I'm not very familiar with the process, > are there any outstanding items that I need to do for this patch? Unless someone has additional feedback, I don't think so. -- Nathan Bossart Amazon Web Services:

Re: Fix overflow in justify_interval related functions

2022-02-25 Thread Joseph Koshakow
Just checking because I'm not very familiar with the process, are there any outstanding items that I need to do for this patch? - Joe Koshakow

Re: Fix overflow in justify_interval related functions

2022-02-15 Thread Joseph Koshakow
On Mon, Feb 14, 2022 at 11:23 PM Nathan Bossart wrote: > It's a little weird > that justify_hours() and justify_days() can overflow in cases where there > is still a valid interval representation, but as Tom noted, those functions > have specific charters to follow. Yes it is a bit weird, but

Re: Fix overflow in justify_interval related functions

2022-02-14 Thread Nathan Bossart
On Mon, Feb 14, 2022 at 08:35:43PM -0500, Joseph Koshakow wrote: > 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

Re: Fix overflow in justify_interval related functions

2022-02-14 Thread Joseph Koshakow
On Mon, Feb 14, 2022 at 7:59 PM Nathan Bossart 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

Re: Fix overflow in justify_interval related functions

2022-02-14 Thread Nathan Bossart
On Mon, Feb 14, 2022 at 04:57:07PM -0500, Joseph Koshakow wrote: > On Mon, Feb 14, 2022 at 2:15 PM Nathan Bossart > wrote: >> Makes sense. So we could likely avoid it for justify_interval, but the >> others are at the mercy of the interval implementation. > > I'm not entirely sure what you

Re: Fix overflow in justify_interval related functions

2022-02-14 Thread Joseph Koshakow
On Mon, Feb 14, 2022 at 2:15 PM Nathan Bossart wrote: > Makes sense. So we could likely avoid it for justify_interval, but the > others are at the mercy of the interval implementation. I'm not entirely sure what you mean by "it", but for both justify_interval and justify_days this commit throws

Re: Fix overflow in justify_interval related functions

2022-02-14 Thread Nathan Bossart
On Mon, Feb 14, 2022 at 01:55:56PM -0500, Tom Lane wrote: > Nathan Bossart writes: >> On Sun, Feb 13, 2022 at 01:28:38PM -0500, Joseph Koshakow wrote: >>> +SELECT justify_hours(interval '2147483647 days 24 hrs'); >>> +ERROR: interval out of range > >> The docs [0] claim that the maximum value

Re: Fix overflow in justify_interval related functions

2022-02-14 Thread Tom Lane
Nathan Bossart writes: > On Sun, Feb 13, 2022 at 01:28:38PM -0500, Joseph Koshakow wrote: >> +SELECT justify_hours(interval '2147483647 days 24 hrs'); >> +ERROR: interval out of range > The docs [0] claim that the maximum value for interval is 178 million > years, but this test case is only ~6

Re: Fix overflow in justify_interval related functions

2022-02-14 Thread Nathan Bossart
On Sun, Feb 13, 2022 at 01:28:38PM -0500, Joseph Koshakow wrote: > +SELECT justify_hours(interval '2147483647 days 24 hrs'); > +ERROR: interval out of range The docs [0] claim that the maximum value for interval is 178 million years, but this test case is only ~6 million. Should we instead

Fix overflow in justify_interval related functions

2022-02-13 Thread Joseph Koshakow
I mentioned this issue briefly in another thread, but the justify_interval, justify_days, and justify_hours functions all have the potential to overflow. The attached patch fixes this issue. Cheers, Joe Koshakow From 4400f2e6886097e3b75d455aeec1ffa9cbc88510 Mon Sep 17 00:00:00 2001 From: Joseph