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

Илья Чердаков <i.cherdakov.pg@gmail.com>

From: Илья Чердаков <i.cherdakov.pg@gmail.com>
To: Andrey Borodin <x4mmm@yandex-team.ru>, Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, Jelte Fennema-Nio <postgres@jeltef.nl>, Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-20T05:46:43Z
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

31.10.2025 2:10, Masahiko Sawada wrote:
> ---
> I think we should update the documentation in the uuid section about
> casting data between bytea and uuid. For references, we have a similar
> description for bytea and integer[1].
Greetings!
I briefly tested the patched version of v3. The implemented
functionality works correctly.

---
You can also add a case with the error from v3-0002
"invalid base32hex end sequence" to the tests :

+        ereport(ERROR,
+                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                 errmsg("invalid base32hex end sequence"),
+                 errhint("Input data has non-zero padding bits.")));

---
I agree with Masahiko Sawada; information about conversions
should be added to the documentation.

-- 
Best regards,
Ilya Cherdakov, PostgresPro