Re: GUC names in messages
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Peter Smith <smithpb2250@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Nathan Bossart <nathandbossart@gmail.com>, Laurenz Albe <laurenz.albe@cybertec.at>, Peter Eisentraut <peter@eisentraut.org>, Tom Lane <tgl@sss.pgh.pa.us>, Daniel Gustafsson <daniel@yesql.se>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-11-30T05:59:21Z
Lists: pgsql-hackers
Attachments
- v4-0003-GUC-names-maybe-add-quotes.patch (text/x-diff) patch v4-0003
On Tue, Nov 28, 2023 at 11:54:33AM +1100, Peter Smith wrote:
> Here is patch set v3.
>
> Patches 0001 and 0002 are unchanged from v2.
After some grepping, I've noticed that 0002 had a mistake with
track_commit_timestamp: some alternate output of modules/commit_ts/
was not updated. meson was able to reproduce the failure as well.
I am not sure regarding what we should do a mixed cases as well, so I
have discarded DateStyle for now, and applied the rest.
Also applied 0001 from Alvaro.
> Patch 0003 now uses a "%s%s%s" format specifier with GUC_FORMAT macro
> in guc.c, as recently suggested by Michael [1].
I cannot think about a better idea as these strings need to be
translated so they need three %s.
+ if (*p == '_')
+ underscore = true;
+ else if ('a' <= *p && *p <= 'z')
+ lowercase = true;
An issue with this code is that it would forget to quote GUCs that use
dots, like the ones from an extension. I don't really see why we
cannot just make the macro return true only if all the characters of a
GUC name is made of lower-case alpha characters?
With an extra indentation applied, I finish with the attached for
0003.
--
Michael
Commits
-
Apply GUC name from central table in more places of guc.c
- f3f06b13308e 18.0 landed
-
Use camel case for "DateStyle" in some error messages
- 2e7c4abe5a88 18.0 landed
-
Unify some error messages to ease work of translators
- a68159ff2b32 18.0 landed
-
Apply more quoting to GUC names in messages
- b4db64270e0c 18.0 landed
-
Revise GUC names quoting in messages again
- 17974ec25946 17.0 landed
-
doc: Mention how to use quotes with GUC names in error messages
- a243569bf65c 17.0 landed
-
Apply quotes more consistently to GUC names in logs
- 8d9978a7176a 17.0 landed