Re: plperl error format vs plpgsql error format vs pgTAP - Mailing list pgsql-hackers

From Tom Lane
Subject Re: plperl error format vs plpgsql error format vs pgTAP
Date
Msg-id 20611.1243616644@sss.pgh.pa.us
Whole thread Raw
In response to Re: plperl error format vs plpgsql error format vs pgTAP  (Kevin Field <kevinjamesfield@gmail.com>)
List pgsql-hackers
Kevin Field <kevinjamesfield@gmail.com> writes:
> default:
>                 elog(ERROR, "unrecognized raise option: %d", opt->opt_type);

> Should this be changed to:

> default:
>                 ereport(ERROR, (errmsg_internal("unrecognized raise option: %d",
> opt->opt_type)));

No, we generally don't bother with that.  The above two are exactly
equivalent and the first is easier to write, so why complicate the code?
ereport is needed if you want to specify a SQLSTATE, provide a
translatable error message, etc, but for internal shouldn't-happen cases
we customarily just use elog.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Aidan Van Dyk
Date:
Subject: Re: PostgreSQL Developer meeting minutes up
Next
From: Kevin Field
Date:
Subject: Re: plperl error format vs plpgsql error format vs pgTAP