Re: [PATCH] Add hints for invalid binary encoding names in encode/decode functions

Fujii Masao <masao.fujii@gmail.com>

From: Fujii Masao <masao.fujii@gmail.com>
To: Sugamoto Shinya <shinya34892@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Daniel Gustafsson <daniel@yesql.se>, Chao Li <li.evan.chao@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-19T13:01:03Z
Lists: pgsql-hackers

Attachments

On Wed, Nov 19, 2025 at 8:08 PM Sugamoto Shinya <shinya34892@gmail.com> wrote:
>
> Thanks everyone for reviewing my proposal. Please let me know if you have something to discuss here.

+                                errhint("Valid encodings are \"%s\",
\"%s\", \"%s\", and \"%s\".",
+                                                "base64",
"base64url", "escape", "hex")));

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.

Regards,

-- 
Fujii Masao

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add HINT listing valid encodings to encode() and decode() errors.

  2. Revise GUC names quoting in messages again

  3. doc: Mention how to use quotes with GUC names in error messages

  4. Adjust assorted hint messages that list all valid options.