Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions - Mailing list pgsql-hackers

From Jelte Fennema-Nio
Subject Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Date
Msg-id CAGECzQRNgpxZswyN98UvV+gLCpqOxEUXvaq0TPTtn8qVfJ+7vQ@mail.gmail.com
Whole thread Raw
In response to Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions  (Andrey Borodin <x4mmm@yandex-team.ru>)
List pgsql-hackers
On Thu, 23 Oct 2025 at 15:07, Andrey Borodin <x4mmm@yandex-team.ru> wrote:
> > SELECT encode(uuidv7() :: bytea, 'base32');
>
> That's an excellent feedback! Would such conversion be idiomatic for Postgres users?
> Are there any other alternative approaches?

Agreed that extending the encode function is the way to go. An example
of that is the recently added support for base64url:
https://git.postgresql.org/cgit/postgresql.git/commit/?h=REL_18_0&id=e1d917182c1953b16b32a39ed2fe38e3d0823047

> > The value of converting uuid to base32 is not obvious though, so I
> > would recommend explaining it in more detail.
>
> Yes, and maybe some examples of other systems that adopted this format would be handy too. Sergey, can you, please,
extendreasoning why this particular format is prominent? RFC 4648 describes a bunch of formats.
 

I've definitely used base32 to encode uuids myself. The primary
benefit being shorter strings, while still being able to spell them
out by voice to people without having to specify whether a letter is
upper or lowercase.



pgsql-hackers by date:

Previous
From: "Jelte Fennema-Nio"
Date:
Subject: libpq: Bump protocol version to version 3.2 at least until the first/second beta
Next
From: Kirill Reshke
Date:
Subject: Re: WIP: parallel GiST index builds