Re: GUC names in messages

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, 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>, 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: 2024-01-04 06:53:44
Message-ID: CAHut+Psf3NewXbsFKY88Qn1ON1_dMD6343MuWdMiiM2Ds9a_wA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 22, 2023 at 12:24 AM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 21.12.23 07:24, Peter Smith wrote:
> > #1. GUC name quoting.
> >
> > Some basic guidelines were decided and a patch is already pushed [1].
> >
> > <para>
> > In messages containing configuration variable names, do not include quotes
> > when the names are visibly not natural English words, such as when they
> > have underscores, are all-uppercase or have mixed case. Otherwise, quotes
> > must be added. Do include quotes in a message where an arbitrary variable
> > name is to be expanded.
> > </para>
> >
> > AFAIK there is nothing controversial there, although maybe the
> > guideline for 'mixed case' needs revisiting depending on objections
> > about point #2.
>
> Now that I read this again, I think this is wrong.
>
> We should decide the quoting for a category, not the actual content.
> Like, quote all file names; do not quote keywords.
>
> This led to the attempted patch to decide the quoting of GUC parameter
> names dynamically based on the actual content, which no one really
> liked. But then, to preserve consistency, we also need to be uniform in
> quoting GUC parameter names where the name is hardcoded.
>

I agree. By attempting to define when to and when not to use quotes it
has become overcomplicated.

Earlier in the thread, I counted how quotes were used in the existing
messages [5]; there were ~39 quoted and 164 not quoted. Based on that
we chose to stay with the majority, and leave all the unquoted ones so
only adding quotes "when necessary". In hindsight, that was probably
the wrong choice because it opened a can of worms about what "when
necessary" even means (e.g. what about underscores, mixed case etc).

Certainly one simple rule "just quote everything" is easiest to follow.

~~~

OPTION#1. DO quote hardcoded GUC names everywhere
- pro: consistent with the dynamic names, which are always quoted
- pro: no risk of mistaking GUC names for normal words in the message
- con: more patch changes than not quoting

Laurenz [2] "My personal preference is to always quote GUC names"
Nathan [3][4] "І'd vote for quoting all GUC names, if for no other
reason than "visibly not English natural words" feels a bit open to
interpretation."
PeterE [6] "... to preserve consistency, we also need to be uniform in
quoting GUC parameter names where the name is hardcoded."

~

OPTION#2. DO NOT quote hardcoded GUC names anywhere
- pro: less patch changes than quoting everything
- con: not consistent with the dynamic names, which are always quoted
- con: risk of mistaking GUC names for normal words in the message

PeterE, originally [1] said "I'm leaning toward not quoting GUC
names", but IIUC changed his opinion in [6].

~~~

Given the above, I've updated the v6 patch set to just *always* quote
GUC names. The docs are also re-written.

======
[1] https://www.postgresql.org/message-id/22998fc0-93c2-48d2-b0f9-361cd5764695%40eisentraut.org
[2] https://www.postgresql.org/message-id/4b83f9888428925e3049e24b60a73f4b94dc2368.camel%40cybertec.at
[3] https://www.postgresql.org/message-id/20231102015239.GA82553%40nathanxps13
[4] https://www.postgresql.org/message-id/20231107145821.GA779199%40nathanxps13
[5] https://www.postgresql.org/message-id/CAHut%2BPtqTao%2BOKRxGcCzUxt9h9d0%3DTQZZoRjMYe3xe0-O7_hsQ%40mail.gmail.com
[6] https://www.postgresql.org/message-id/1704b2cf-2444-484a-a7a4-2ba79f72951d%40eisentraut.org

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v6-0001-GUC-names-docs.patch application/octet-stream 1.4 KB
v6-0005-GUC-names-make-common-translatable-message-string.patch application/octet-stream 19.3 KB
v6-0003-GUC-names-fix-case-intervalstyle.patch application/octet-stream 1.9 KB
v6-0004-GUC-names-fix-case-datestyle.patch application/octet-stream 11.2 KB
v6-0002-GUC-names-add-quotes.patch application/octet-stream 94.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2024-01-04 06:59:06 the s_lock_stuck on perform_spin_delay
Previous Message Shlok Kyal 2024-01-04 06:51:54 Re: speed up a logical replica setup