Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions

Jelte Fennema-Nio <postgres@jeltef.nl>

From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>
Cc: Andrey Borodin <x4mmm@yandex-team.ru>, Masahiko Sawada <sawada.mshk@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-28T14:39:26Z
Lists: pgsql-hackers

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 base32hex support to encode() and decode() functions.

  2. Allow explicit casting between bytea and uuid.

  3. Add support for base64url encoding and decoding

On Tue, 28 Oct 2025 at 15:29, Sergey Prokhorenko
<sergeyprokhorenko@yahoo.com.au> wrote:
> I believe we should put the discussion about compact UUID text encoding in PostgreSQL on hold for now.

I agree with respect to the dedicated encode_uuid and decode_uuid functions.

But I think having postgres support base32hex in encode/decode for
bytea seems like a sensible thing in any case. As well as conversion
between UUID and bytea. If someone wants to create patches for that,
it seems like there'd be enough support for those to get them merged.