Re: GUC names in messages

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, 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: 2023-12-16 09:33:45
Message-ID: ZX1u-QVlAowc4CT2@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 14, 2023 at 09:38:40AM +0100, Peter Eisentraut wrote:
> After these discussions, I think this rule change was not a good idea. It
> effectively enforces these kinds of inconsistencies. For example, if you
> ever refactored
>
> "DateStyle is wrong"
>
> to
>
> "%s is wrong"
>
> you'd need to adjust the quotes, and thus user-visible behavior, for
> entirely internal reasons. This is not good.

So, what are you suggesting? Should the encouraged rule be removed
from the docs? Or do you object to some of the changes done in the
latest patch series v5?

FWIW, I am a bit meh with v5-0001, because I don't see the benefits.
On the contrary v5-0003 is useful, because it reduces a bit the number
of strings to translate. That's always good to take. I don't have a
problem with v5-0002, either, where we'd begin using the name of the
GUC as stored in the static tables rather than the name provided in
the SET query, particularly for the reason that it makes the GUC name
a bit more consistent even when using double-quotes around the
parameter name in the query, where the error messages would not force
a lower-case conversion. The patch would, AFAIU, change HEAD from
that:
=# SET "intervalstylE" to popo;
ERROR: 22023: invalid value for parameter "intervalstylE": "popo"
To that:
=# SET "intervalstylE" to popo;
ERROR: 22023: invalid value for parameter "IntervalStyle": "popo"

> And then came the idea to
> determine the quoting dynamically, which I think everyone agreed was too
> much. So I don't see a way to make this work well.

Yeah, with the quotes being language-dependent, any idea I can think
of is as good as unreliable and dead.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ishaan Adarsh 2023-12-16 10:49:06 [DOC] Introducing Quick Start Guide to PL/pgSQL and PL/Python Documentation
Previous Message Michael Paquier 2023-12-16 09:07:04 Re: Remove MSVC scripts from the tree