Re: GUC names in messages

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: 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-23 07:27:04
Message-ID: CAHut+PsXEqjxdvR6sZX6ihgWhK8jwk=L7VJdAJJT+hwAVwwj7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 9, 2023 at 10:04 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2023-Nov-09, Peter Smith wrote:
>
> > Notice that NOT QUOTED is the far more common pattern, so my vote
> > would be just to standardise on making everything this way. I know
> > there was some concern raised about ambiguous words like "timezone"
> > and "datestyle" etc but in practice, those are rare. Also, those GUCs
> > are different in that they are written as camel-case (e.g.
> > "DateStyle") in the guc_tables.c, so if they were also written
> > camel-case in the messages that could remove ambiguities with normal
> > words. YMMV.
>
> Well, I think camel-casing is also a sufficient differentiator for these
> identifiers not being English words. We'd need to ensure they're always
> written that way, when not quoted. However, in cases where arbitrary
> values are expanded, I don't know that they would be expanded that way,
> so I would still go for quoting in that case.
>
> There's also a few that are not camel-cased nor have any underscores --
> looking at postgresql.conf.sample, we have "port", "bonjour", "ssl",
> "fsync", "geqo", "jit", "autovacuum", "xmlbinary", "xmloption". (We also
> have "include", but I doubt that's ever used in an error message). But
> actually, there's more: every reloption is a candidate, and there we
> have "fillfactor", "autosummarize", "fastupdate", "buffering". So if we
> want to make generic advice on how to deal with option names in error
> messages, I think the wording on conditional quoting I proposed should
> go in (adding CamelCase as a reason not to quote), and then we can fix
> the code to match. Looking at your list, I think the changes to make
> are not too numerous.
>

Sorry for my delay in getting back to this thread.

PSA a patch for this work.

There may be some changes I've missed, but hopefully, this is a nudge
in the right direction.

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

Attachment Content-Type Size
v1-0001-GUC-names-docs.patch application/octet-stream 1.1 KB
v1-0002-GUC-names-fix-quotes.patch application/octet-stream 28.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Benesch 2023-11-23 07:40:27 pgoutput incorrectly replaces missing values with NULL since PostgreSQL 15
Previous Message Peter Eisentraut 2023-11-23 06:56:48 Catalog domain not-null constraints