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.
> 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.
regards, tom lane
[1] https://www.postgresql.org/docs/devel/error-message-reporting.html