Re: GUC names in messages

Peter Smith <smithpb2250@gmail.com>

From: Peter Smith <smithpb2250@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Michael Paquier <michael@paquier.xyz>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Nathan Bossart <nathandbossart@gmail.com>, Laurenz Albe <laurenz.albe@cybertec.at>, Tom Lane <tgl@sss.pgh.pa.us>, Daniel Gustafsson <daniel@yesql.se>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-05-28T06:16:24Z
Lists: pgsql-hackers

Attachments

On Fri, May 17, 2024 at 9:57 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>
> On 17.05.24 05:31, Peter Smith wrote:
> >> I think we should accept your two patches
> >>
> >> v6-0001-GUC-names-docs.patch
> >> v6-0002-GUC-names-add-quotes.patch
> >>
> >> which effectively everyone was in favor of and which seem to be the most
> >> robust and sustainable solution.
> >>
> >> (The remaining three patches from the v6 set would be PG18 material at
> >> this point.)
> > Thanks very much for taking an interest in resurrecting this thread.
> >
> > It was always my intention to come back to this when the dust had
> > settled on PG17. But it would be even better if the docs for the rule
> > "just quote everything", and anything else you deem acceptable, can be
> > pushed sooner.
> >
> > Of course, there will still be plenty more to do for PG18, including
> > locating examples in newly pushed code for messages that have slipped
> > through the cracks during the last few months using different formats,
> > and other improvements, but those tasks should become easier if we can
> > get some of these v6 patches out of the way first.
>
> I committed your 0001 and 0002 now, with some small fixes.
>
> There has also been quite a bit of new code, of course, since you posted
> your patches, so we'll probably find a few more things that could use
> adjustment.
>
> I'd be happy to consider the rest of your patch set after beta1 and/or
> for PG18.

Thanks for pushing some of those v6 patches. Here is the new patch set v7*.

I have used a homegrown script/regex to help identify all the GUC
names that still needed quoting. Many of these occurrences are from
recently pushed code -- i.e. they are more recent than that v6-0002
patch previously pushed [1].

The new GUC quoting patches are separated by different GUC types only
to simplify my processing of them.

v7-0001 = Add quotes for GUCs - bool
v7-0002 = Add quotes for GUCs - int
v7-0003 = Add quotes for GUCs - real
v7-0004 = Add quotes for GUCs - string
v7-0005 = Add quotes for GUCs - enum

The other v7 patches are just carried forward unchanged from v6:

v7-0006 = fix case for IntervalStyle
v7-0007 = fix case for Datestyle
v7-0008 = make common translatable message strings

~~~~

STATUS

Here is the status of these v7* patches,  and remaining works to do:

* AFAIK those first 5 ("Add quotes") patches can be pushed ASAP in
PG17. If anybody finds more GUCs still not quoted then those are
probably somehow accidentally missed by me and should be fixed.

* The remaining 3 patches may wait until PG18.

* The patch 0008 ("make common translatable message strings") may be
OK to be pushed as-is. OTOH, this is the tip of another iceberg so I
expect if we look harder there will be many many more candidates to
turn into common messages. There may also be examples where  'similar'
messages can use identical common text, but those will require more
discussion/debate case-by-case

* Another remaining task is to check current usage and improve the
consistency of how some of the GUC values have been quoted. Refer to
mail from Kyotaro-san [2] for examples of this.

======
[1] v6-0001,0002 were already pushed.
https://www.postgresql.org/message-id/55ab714f-86e3-41a3-a1d2-a96a115db8bd%40eisentraut.org

[2] https://www.postgresql.org/message-id/20240520.165613.189183526936651938.horikyota.ntt%40gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia

Commits

  1. Apply GUC name from central table in more places of guc.c

  2. Use camel case for "DateStyle" in some error messages

  3. Unify some error messages to ease work of translators

  4. Apply more quoting to GUC names in messages

  5. Revise GUC names quoting in messages again

  6. doc: Mention how to use quotes with GUC names in error messages

  7. Apply quotes more consistently to GUC names in logs