Re: Numeric multiplication overflow errors - Mailing list pgsql-hackers

From David Rowley
Subject Re: Numeric multiplication overflow errors
Date
Msg-id CAApHDvq3mBd1QVvv8O56wOvG4friH-a7U-pouDpg3CRjeU5Orw@mail.gmail.com
Whole thread Raw
In response to Re: Numeric multiplication overflow errors  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Numeric multiplication overflow errors  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
On Mon, 5 Jul 2021 at 23:07, Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> Em seg., 5 de jul. de 2021 às 06:44, Dean Rasheed <dean.a.rasheed@gmail.com> escreveu:
>> Note, however, that it won't make any difference to performance in the
>> way that you're suggesting -- elog() in Postgres is used for "should
>> never happen, unless there's a software bug" errors, rather than, say,
>> "might happen for certain invalid inputs" errors, so init_var() should
>> always be called in these functions.
>
> I agree that in this case, most of the time, elog is not called.

You may have misunderstood what Dean meant.  elog(ERROR) calls are now
exclusively for "cannot happen" cases.  If someone gets one of these
then there's a bug to fix or something else serious has gone wrong
with the hardware.

The case you seem to be talking about would fit better if the code in
question had been ereport(ERROR).

I don't disagree that the initialisation is better to happen after the
elog. I'm just mentioning this as I wanted to make sure you knew the
difference between elog(ERROR) and ereport(ERROR).

David



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Excessive cost of OpClassCache flushes in CLOBBER_CACHE_ALWAYS mode
Next
From: Ronan Dunklau
Date:
Subject: Re: Add proper planner support for ORDER BY / DISTINCT aggregates