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

2025-11-19 Thread Peter Eisentraut
On 19.11.25 14:47, Fujii Masao wrote: On Wed, Nov 19, 2025 at 10:04 PM Daniel Gustafsson wrote: On 19 Nov 2025, at 14:01, Fujii Masao 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"

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

2025-11-19 Thread Fujii Masao
On Wed, Nov 19, 2025 at 10:04 PM Daniel Gustafsson wrote: > > > On 19 Nov 2025, at 14:01, Fujii Masao 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", a

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

2025-11-19 Thread Daniel Gustafsson
> On 19 Nov 2025, at 14:01, Fujii Masao 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 messa

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

2025-11-19 Thread Fujii Masao
On Wed, Nov 19, 2025 at 8:08 PM Sugamoto Shinya 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\".", +

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

2025-11-19 Thread Sugamoto Shinya
Thanks everyone for reviewing my proposal. Please let me know if you have something to discuss here. 2025年11月19日(水) 0:31 Nathan Bossart : > On Wed, Nov 19, 2025 at 12:20:34AM +0900, Sugamoto Shinya wrote: > > On Tue, Nov 18, 2025 at 1:07 PM Fujii Masao > wrote: > >> Is there a guideline on when

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

2025-11-18 Thread Nathan Bossart
On Wed, Nov 19, 2025 at 12:20:34AM +0900, Sugamoto Shinya wrote: > On Tue, Nov 18, 2025 at 1:07 PM Fujii Masao wrote: >> Is there a guideline on when we should use the ClosestMatch machinery >> instead of explicitly listing valid values? From the discussion in [1], >> it seems appropriate when the

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

2025-11-18 Thread Sugamoto Shinya
On Tue, Nov 18, 2025 at 1:07 PM Fujii Masao wrote: > On Tue, Nov 18, 2025 at 5:34 AM Masahiko Sawada > wrote: > > > > On Mon, Nov 17, 2025 at 8:44 AM Nathan Bossart > wrote: > > > > > > On Mon, Nov 17, 2025 at 04:04:17PM +0100, Daniel Gustafsson wrote: > > > > Oh right, I had forgotten about th

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

2025-11-17 Thread Fujii Masao
On Tue, Nov 18, 2025 at 5:34 AM Masahiko Sawada wrote: > > On Mon, Nov 17, 2025 at 8:44 AM Nathan Bossart > wrote: > > > > On Mon, Nov 17, 2025 at 04:04:17PM +0100, Daniel Gustafsson wrote: > > > Oh right, I had forgotten about that, thanks for the reminder. The patch > > > as > > > proposed i

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

2025-11-17 Thread Masahiko Sawada
On Mon, Nov 17, 2025 at 8:44 AM Nathan Bossart wrote: > > On Mon, Nov 17, 2025 at 04:04:17PM +0100, Daniel Gustafsson wrote: > > Oh right, I had forgotten about that, thanks for the reminder. The patch as > > proposed is correct then. > > The patch is probably fine as-is, but this seems like a ca

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

2025-11-17 Thread Nathan Bossart
On Mon, Nov 17, 2025 at 04:04:17PM +0100, Daniel Gustafsson wrote: > Oh right, I had forgotten about that, thanks for the reminder. The patch as > proposed is correct then. The patch is probably fine as-is, but this seems like a candidate for the ClosestMatch stuff added by commit 5ac51c8. -- n

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

2025-11-17 Thread Daniel Gustafsson
> On 17 Nov 2025, at 15:59, Fujii Masao wrote: > > On Mon, Nov 17, 2025 at 11:30 PM Daniel Gustafsson wrote: >> >>> On 17 Nov 2025, at 15:08, Sugamoto Shinya wrote: >> >>> I ordered the valid encodings alphabetically and extracted those into >>> separate parameters. >> >> LGTM. Per project

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

2025-11-17 Thread Fujii Masao
On Mon, Nov 17, 2025 at 11:30 PM Daniel Gustafsson wrote: > > > On 17 Nov 2025, at 15:08, Sugamoto Shinya wrote: > > > I ordered the valid encodings alphabetically and extracted those into > > separate parameters. > > LGTM. Per project style I don't think we should quote the names of encodings

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

2025-11-17 Thread Daniel Gustafsson
> On 17 Nov 2025, at 15:08, Sugamoto Shinya wrote: > I ordered the valid encodings alphabetically and extracted those into > separate parameters. LGTM. Per project style I don't think we should quote the names of encodings since they are visibly not English words (see commit a243569bf65c5 whic

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

2025-11-17 Thread Sugamoto Shinya
On Thu, Nov 13, 2025 at 9:58 AM Fujii Masao wrote: > On Wed, Nov 12, 2025 at 10:23 PM Sugamoto Shinya > 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\", > \

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

2025-11-12 Thread Fujii Masao
On Wed, Nov 12, 2025 at 10:23 PM Sugamoto Shinya 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" bef

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

2025-11-12 Thread Peter Eisentraut
On 10.11.25 10:06, Chao Li wrote: The list is defined in encode.c (search for enclist in the file), I guess we can add a function to return a string with a encoding names. 2 ``` +errhint("Valid binary encodings are: %s", +

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

2025-11-12 Thread Sugamoto Shinya
On Wed, Nov 12, 2025 at 10:56 AM Fujii Masao wrote: > On Wed, Nov 12, 2025 at 10:10 AM Masahiko Sawada > wrote: > > +1 for hard-coding the supported encoding list. I think it's a good > > start point. We can revisit the idea of dynamically constructing the > > encoding list if we're concerned ab

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

2025-11-11 Thread Fujii Masao
On Wed, Nov 12, 2025 at 10:10 AM Masahiko Sawada wrote: > +1 for hard-coding the supported encoding list. I think it's a good > start point. We can revisit the idea of dynamically constructing the > encoding list if we're concerned about its maintenance cost. +1 Regards, -- Fujii Masao

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

2025-11-11 Thread Masahiko Sawada
On Tue, Nov 11, 2025 at 7:14 AM Sugamoto Shinya wrote: > > Thanks everyone for checking my proposal. > Other than how to make the hint string, every comment looks good to me. I'll > take those into my patch. I appreciate it. > > > Given the comments you all made, I looked into the source code to

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

2025-11-11 Thread Sugamoto Shinya
Thanks everyone for checking my proposal. Other than how to make the hint string, every comment looks good to me. I'll take those into my patch. I appreciate it. Given the comments you all made, I looked into the source code to see how we build `errhint` with values, and found the following. //

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

2025-11-10 Thread Chao Li
> On Nov 10, 2025, at 22:43, Daniel Gustafsson wrote: > >> On 10 Nov 2025, at 10:06, Chao Li wrote: >>> On Nov 8, 2025, at 14:25, Sugamoto Shinya wrote: > >>> This patch adds an error hint listing the valid encoding names, >>> so users can immediately see the supported options. > > +1. >

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

2025-11-10 Thread Daniel Gustafsson
> On 10 Nov 2025, at 10:06, Chao Li wrote: >> On Nov 8, 2025, at 14:25, Sugamoto Shinya wrote: >> This patch adds an error hint listing the valid encoding names, >> so users can immediately see the supported options. +1. > I think hardcoding the encoding list is fragile. AFAIK, “base64url” was

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

2025-11-10 Thread Chao Li
> On Nov 8, 2025, at 14:25, Sugamoto Shinya wrote: > > Hi, > > When users pass an invalid encoding name to the built-in functions > `encode()` or `decode()`, PostgreSQL currently reports only: > > ERROR: unrecognized encoding: "xxx" > > This patch adds an error hint listing the valid e

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

2025-11-10 Thread Fujii Masao
On Sat, Nov 8, 2025 at 3:26 PM Sugamoto Shinya wrote: > > Hi, > > When users pass an invalid encoding name to the built-in functions > `encode()` or `decode()`, PostgreSQL currently reports only: > > ERROR: unrecognized encoding: "xxx" > > This patch adds an error hint listing the valid encod

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

2025-11-07 Thread Sugamoto Shinya
Hi, When users pass an invalid encoding name to the built-in functions `encode()` or `decode()`, PostgreSQL currently reports only: ERROR: unrecognized encoding: "xxx" This patch adds an error hint listing the valid encoding names, so users can immediately see the supported options. Exampl