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

From: Sugamoto Shinya <shinya34892(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add hints for invalid binary encoding names in encode/decode functions
Date: 2025-11-17 14:08:14
Message-ID: CAAe3y+8tdMCadjxenRd-zJ3PxPHxiM0T9mPFUcFV5Jog94ty4A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 13, 2025 at 9:58 AM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:

> On Wed, Nov 12, 2025 at 10:23 PM Sugamoto Shinya <shinya34892(at)gmail(dot)com>
> wrote:
> > Thanks everyone for reviewing my proposal.
> > I've hard-coded the valid list of encoding names.
> >
> > Also, I modified the hint string into like "Valid encodings are \"hex\",
> \"base64\", \"base64url\", and \"escape\"."
> > by adding "and" before "escape".
> >
> > I attached my v2 patch to this message. Please let me know freely if you
> have any additional questions.
>
> Thanks for the updated patch! LGTM.
>
> One minor comment: in v2 patch, it seems the encodings in the HINT message
> are
> listed in the order they appear in the enclist struct. Wouldn't it be
> clearer to list them
> alphabetically, matching the order shown in the docs [1]: base64,
> base64url, escape, and hex?
>
> Regards,
>
> [1]
> https://www.postgresql.org/docs/devel/functions-binarystring.html#ENCODE-FORMAT-BASE64
>
> --
> Fujii Masao
>

Thanks, Fujii and Peter.

I ordered the valid encodings alphabetically and extracted those into
separate parameters.

Here is my new patch.

Regards,

Attachment Content-Type Size
v3-0001-Add-error-hints-for-invalid-binary-encoding-names.patch application/octet-stream 3.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tushar 2025-11-17 14:08:32 Re: Non-text mode for pg_dumpall
Previous Message Rahila Syed 2025-11-17 13:57:25 Re: Clarification on when _PG_init() is invoked for extensions