Re: Infinite Interval

From: Joseph Koshakow <koshy44(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, "Gregory Stark (as CFM)" <stark(dot)cfm(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Infinite Interval
Date: 2023-04-03 00:32:26
Message-ID: CAAvxfHcj7J09wmFSGfuQwP5NU3yTNZ02L0pyOv=NZB8sBw2+gw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 2, 2023 at 6:54 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Joseph Koshakow <koshy44(at)gmail(dot)com> writes:
> >> I've added an errcontext to all the errors of the form "X out of
> >> range".
>
> Please note the style guidelines [1]:
>
> errcontext(const char *msg, ...) is not normally called directly
from
> an ereport message site; rather it is used in error_context_stack
> callback functions to provide information about the context in
which
> an error occurred, such as the current location in a PL function.
>
> If we should have this at all, which I doubt, it's probably
> errdetail not errcontext.

I've attached a patch with all of the errcontext calls removed. None of
the existing out of range errors have an errdetail call so I think this
is more consistent. If we do want to add errdetail, then we should
probably do it in a later patch and add it to all out of range errors,
not just the ones related to infinity.

> > How do you feel about redefining interval_mi in terms of interval_um
> > and interval_pl? That one felt like an improvement to me even outside
> > of the context of this change.
>
> I did not think so. For one thing, it introduces integer-overflow
> hazards that you would not have otherwise; ie, interval_um might have
> to throw an error for INT_MIN input, even though the end result of
> the calculation would have been in range.

Good point, I didn't think of that.

Thanks,
Joe Koshakow

Attachment Content-Type Size
v3-0001-Move-integer-helper-function-to-int.h.patch text/x-patch 3.3 KB
v3-0002-Check-for-overflow-in-make_interval.patch text/x-patch 5.0 KB
v18-0003-Add-infinite-interval-values.patch text/x-patch 91.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yurii Rashkovskii 2023-04-03 02:26:25 Re: [PATCH] Support % wildcard in extension upgrade filenames
Previous Message Andres Freund 2023-04-03 00:19:45 Re: Pass heaprel to GlobalVisTestFor() in vacuumRedirectAndPlaceholder()