Re: Infinite Interval - Mailing list pgsql-hackers

From Joseph Koshakow
Subject Re: Infinite Interval
Date
Msg-id CAAvxfHcj7J09wmFSGfuQwP5NU3yTNZ02L0pyOv=NZB8sBw2+gw@mail.gmail.com
Whole thread Raw
In response to Re: Infinite Interval  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Infinite Interval
List pgsql-hackers


On Sun, Apr 2, 2023 at 6:54 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>    Joseph Koshakow <koshy44@gmail.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

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Pass heaprel to GlobalVisTestFor() in vacuumRedirectAndPlaceholder()
Next
From: Yurii Rashkovskii
Date:
Subject: Re: [PATCH] Support % wildcard in extension upgrade filenames