public inbox for [email protected]  
help / color / mirror / Atom feed
From: Masahiko Sawada <[email protected]>
To: Aleksander Alekseev <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Chengxi Sun <[email protected]>
Cc: Andrey Borodin <[email protected]>
Cc: Dagfinn Ilmari Mannsåker <[email protected]>
Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Date: Thu, 19 Mar 2026 12:24:02 -0700
Message-ID: <CAD21AoByeQny9oWUG4zoG1uv8X8d+hL6Rk0_vv_ahrkqY=Fa7A@mail.gmail.com> (raw)
In-Reply-To: <CAJ7c6TM=xPAwj4AvN6O4qXa7vc5cLGdDZb21ohqKp-cy2TJyWA@mail.gmail.com>
References: <[email protected]>
	<CAJ7c6TOramr1UTLcyB128LWMqita1Y7=arq3KHaU=qikf5yKOQ@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAD21AoCxy_3VW2_z5Rxc-tFsuqeyGsA-F_kD-tx6XXBC56nTCg@mail.gmail.com>
	<[email protected]>
	<CAD21AoAXQcZ2mMkxX6NPdFpdC-D3AhE--qyH9Se3XTrDX6x-bg@mail.gmail.com>
	<[email protected]>
	<CAD21AoCzEDdwpyPwA0d-QmCRe5rMz3m160SJgxMwKke85e8n0w@mail.gmail.com>
	<[email protected]>
	<CAD21AoCKvYCccndY4CRcwk1bOuWxJionOidEtKQWoJTqS7wL1g@mail.gmail.com>
	<[email protected]>
	<CAGECzQTb9pg2Qw0XmOEKaJivLJ8kdGq3Cq38OqSgwiFVD=9f8A@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAD21AoCf-0LdE=Js3ViXmKfSATJOjSNym1+80O+=-Y3X6LDMyA@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAJ7c6TNCGT2eZ8JttAZKUhVv3jJFTHvjFw6typzSGkM5_vePow@mail.gmail.com>
	<CAJ7c6TMZOvVcbEZ-KH8e4mDuQ6ZTfgV-BJoLX_aTd1MtjScyqA@mail.gmail.com>
	<CAD21AoCcikUgU5coyvM7PLJg5M-75LzQhm-Uxmqn_7M=DHkj+w@mail.gmail.com>
	<CAJ7c6TPu7NGrSj-V2-ns0GTNGx9cmoKQgzt-p2MpJepiGjQnYw@mail.gmail.com>
	<CAD21AoC2Ooy=W=4YjQ_GO5nEYZ2tsn43=TkLf7ysE-96ygohKg@mail.gmail.com>
	<CAJ7c6TOJ-aJh=dnPSwtzWsHnANi=SVZQ3bYuZLtS2w8xxVngnQ@mail.gmail.com>
	<CAMvSjCRxFgKC3JfOMSr358zGu166niRY2UqaTS_=oQcyiBArmQ@mail.gmail.com>
	<CAJ7c6TM=xPAwj4AvN6O4qXa7vc5cLGdDZb21ohqKp-cy2TJyWA@mail.gmail.com>

On Thu, Mar 19, 2026 at 5:19 AM Aleksander Alekseev
<[email protected]> wrote:
>
> Hi,
>
> > I might be missing some context here, so I wanted to ask: is this behavior intentional,
> > or would it make sense to enforce stricter validation for Base32hex input?
>
> That's intentional - see the discussion above:
>
> """
> [...]
> This code checks if the remaining bits of the input data are all zero.
> IIUC we don't have a similar check for base64 and base64url. For
> instance, the following input data is accepted:
>
> =# select decode('AB', 'base64');
>  decode
> --------
>  \x00
> (1 row)
> """

Right. I've also tested base32hex encoding/decoding with other
libraries such as python's one. IIUC our base32hex implementation
doesn't necessarily work exactly the same as other libraries to have a
better consistency with the existing encodings such as base64 but I
believe that it doesn't contradict the RFC.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com





view thread (63+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
  In-Reply-To: <CAD21AoByeQny9oWUG4zoG1uv8X8d+hL6Rk0_vv_ahrkqY=Fa7A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox