Re: [HACKERS] plpgsql - additional extra checks

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, nospam-abuse(at)bloodgate(dot)com, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, David Steele <david(at)pgmasters(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Marko Tiikkaja <marko(at)joh(dot)to>, Jim Nasby <jim(dot)nasby(at)bluetreble(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] plpgsql - additional extra checks
Date: 2018-07-09 19:51:01
Message-ID: 20180709195101.45gfucbfpuotxwld@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2018-07-09 19:58:58 Re: Generating partitioning tuple conversion maps faster
Previous Message Alvaro Herrera 2018-07-09 19:44:36 Re: [HACKERS] plpgsql - additional extra checks