Re: GUC names in messages

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
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-30 05:59:21
Message-ID: ZWgkuTmMItANLpnU@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v4-0003-GUC-names-maybe-add-quotes.patch text/x-diff 50.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haotian Chen 2023-11-30 06:06:20 Dumped SQL failed to execute with ERROR "GROUP BY position -1 is not in select list"
Previous Message Pavel Stehule 2023-11-30 05:47:57 Re: possibility to define only local cursors