Re: [HACKERS] plpgsql - additional extra checks - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: [HACKERS] plpgsql - additional extra checks
Date
Msg-id 20180709200111.snge7xqgc4vewan4@alvherre.pgsql
Whole thread Raw
In response to Re: [HACKERS] plpgsql - additional extra checks  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 2018-Jul-09, Andres Freund wrote:

> On 2018-07-09 15:44:36 -0400, Alvaro Herrera wrote:
> > > +                ereport(errlevel,
> > >                          (errcode(ERRCODE_TOO_MANY_ROWS),
> > >                           errmsg("query returned more than one row"),
> > > -                         errdetail ? errdetail_internal("parameters: %s", errdetail) : 0));
> > > +                         errdetail ? errdetail_internal("parameters: %s", errdetail) : 0,
> > > +                         use_errhint ? errhint("too_many_rows check of extra_%s is active.",
> > > +                                      too_many_rows_level == ERROR ? "errors" : "warnings") : 0));
> > 
> > Please write this in a way that results in less translatable messages,
> > and don't build setting names at runtime.  Concretely I suggest this:
> > 
> > errhint(too_many_rows_level == ERROR ? 
> >     gettext_noop("%s check of extra_errors is active.") : 
> >     gettext_noop("%s check of extra_warnings is active."),
> >     "too_many_rows");
> 
> Why not put extra_errors/extra_warnings into a variable as well?

Yeah, what he said.  (Then you *really* need a /* translator: */ comment
to explain.)

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Generating partitioning tuple conversion maps faster
Next
From: David Rowley
Date:
Subject: Re: Un peu décu : Re: Performance regression with PostgreSQL 11 and partitioning