Re: GUC names in messages - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: GUC names in messages
Date
Msg-id ZWgkuTmMItANLpnU@paquier.xyz
Whole thread Raw
In response to Re: GUC names in messages  (Peter Smith <smithpb2250@gmail.com>)
Responses Re: GUC names in messages
Re: GUC names in messages
Re: GUC names in messages
Re: GUC names in messages
List 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

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: possibility to define only local cursors
Next
From: Haotian Chen
Date:
Subject: Dumped SQL failed to execute with ERROR "GROUP BY position -1 is not in select list"