Re: GUC names in messages

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: GUC names in messages
Date: 2023-11-26 22:41:51
Message-ID: CAHut+PtOqRPyVuX=xL=EhDAEWkpBh2MgeSW1KoyMjru-tEWO9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 24, 2023 at 2:11 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Thu, Nov 23, 2023 at 06:27:04PM +1100, Peter Smith wrote:
> > There may be some changes I've missed, but hopefully, this is a nudge
> > in the right direction.
>
> Thanks for spending some time on that.
>
> <para>
> + In messages containing configuration variable names, do not include quotes
> + when the names are visibly not English natural words, such as when they
> + have underscores or are all-uppercase or have mixed case. Otherwise, quotes
> + must be added. Do include quotes in a message where an arbitrary variable
> + name is to be expanded.
> + </para>
>
> That seems to describe clearly the consensus reached on the thread
> (quotes for GUCs that are single terms, no quotes for names that are
> obviously parameters).
>
> In terms of messages that have predictible names, 0002 moves in the
> needle in the right direction. There seem to be more:
> src/backend/postmaster/bgworker.c: errhint("Consider increasing the
> configuration parameter \"max_worker_processes\".")));
> contrib/pg_prewarm/autoprewarm.c: errhint("Consider increasing
> configuration parameter \"max_worker_processes\".")));

Done in patch 0002

>
> Things like parse_and_validate_value() and set_config_option_ext()
> include log strings about GUC and these use quotes. Could these areas
> be made smarter with a routine to check if quotes are applied
> automatically when we have a "simple" GUC name, aka I guess made of
> only lower-case characters? This could be done with a islower() on
> the string name, for instance.

See what you think of patch 0003

~~

PSA v2 patches.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v2-0001-GUC-names-docs.patch application/octet-stream 1.1 KB
v2-0002-GUC-names-fix-quotes.patch application/octet-stream 29.9 KB
v2-0003-GUC-names-maybe-add-quotes.patch application/octet-stream 41.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-11-26 23:04:35 Re: GUC names in messages
Previous Message Tom Lane 2023-11-26 20:22:04 Re: Improve rowcount estimate for UNNEST(column)