Re: GUC names in messages
От | Peter Smith |
---|---|
Тема | Re: GUC names in messages |
Дата | |
Msg-id | CAHut+Psf3NewXbsFKY88Qn1ON1_dMD6343MuWdMiiM2Ds9a_wA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: GUC names in messages (Peter Eisentraut <peter@eisentraut.org>) |
Ответы |
Re: GUC names in messages
|
Список | pgsql-hackers |
On Fri, Dec 22, 2023 at 12:24 AM Peter Eisentraut <peter@eisentraut.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
Вложения
В списке pgsql-hackers по дате отправления: