From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Joseph Koshakow <koshy44(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Fix overflow in justify_interval related functions |
Date: | 2022-02-15 04:23:06 |
Message-ID: | 20220215042306.GA2228390@nathanxps13 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 justification is 29. I think we can simplify it further to the
> attached patch.
LGTM. I've marked this one as ready-for-committer. 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.
> + ereport(ERROR,
> + (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
> + errmsg("interval out of range")));
nitpick: I think there is ordinarily an extra space before errmsg() so that
it lines up with errcode().
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2022-02-15 04:46:03 | Re: pgsql: Add suport for server-side LZ4 base backup compression. |
Previous Message | Peter Geoghegan | 2022-02-15 04:21:41 | Re: do only critical work during single-user vacuum? |