Re: [PATCH] Add hints for invalid binary encoding names in encode/decode functions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCH] Add hints for invalid binary encoding names in encode/decode functions
Date
Msg-id b57c5768-d117-4e2a-b6cd-edd0e1432d45@eisentraut.org
Whole thread Raw
In response to Re: [PATCH] Add hints for invalid binary encoding names in encode/decode functions  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: [PATCH] Add hints for invalid binary encoding names in encode/decode functions
List pgsql-hackers
On 19.11.25 14:47, Fujii Masao wrote:
> On Wed, Nov 19, 2025 at 10:04 PM Daniel Gustafsson <daniel@yesql.se> wrote:
>>
>>> On 19 Nov 2025, at 14:01, Fujii Masao <masao.fujii@gmail.com> wrote:
>>
>>> You changed the HINT message to use format arguments,
>>> but I still think it's better to embed the values directly (e.g.,
>>> Valid encodings are "base64", "base64url", "escape", and "hex".)
>>> for consistency with similar HINT messages. If this message is
>>> used in many places a parameterized style would help translators,
>>> but that benefit doesn't apply here.
>>>
>>> Attached is an updated version of the patch. I switched
>>> the HINT message to the embedded form and updated the commit message.
>>> Barring any objections, I'm thinking to commit this.
>>
>> My intepreration was that this version was already objected to by Peter
>> upthread in c5c937dc-de8e-4284-be25-5d5eaf089d00@eisentraut.org.  The point
>> there being that punctuation in lists is subject to translation.
> 
> Yes, so I was thinking a message like "Valid encodings are %s" isn't acceptable
> since the punctuation included in the %s value is not translated. In contrast,
> a message like "Valid encodings are \"base64\", …" is fine because all
> punctuation
> is part of the translatable string itself, I thought.

My point was a different one.  It is generally preferable to separate 
translatable and untranslated things.  So, as an example from elsewhere, 
instead of

errhint("Use ALTER DOMAIN instead.");

it would be better to use

errhint("Use % instead.", "ALTER DOMAIN");

Similarly, here I would prefer something along the lines of

errhint("Valid values are \"%s\", \"%s\", and \"%s\".", "foo", "bar", 
"baz");

So like it was done in patch v3 looks good to me.



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: regarding statistics retaining with 18 Upgrade
Next
From: Aleksander Alekseev
Date:
Subject: Re: Trying out