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

From Aleksander Alekseev
Subject Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Date
Msg-id CAJ7c6TOramr1UTLcyB128LWMqita1Y7=arq3KHaU=qikf5yKOQ@mail.gmail.com
Whole thread Raw
Responses Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
List pgsql-hackers
Hi Sergey,

> I'm writing to propose adding two new built-in functions to PostgreSQL that provide compact UUID encoding using the
base32hexformat.
 

Firstly, cc:'ing a few dozens of people is not the best way to get
attention to your patch. Please don't do this.

Secondly, in order to propose a patch please use `git format-patch`
and send it as an attachment. Then register it on the nearest open
commitfest [1].

The interface you are proposing is ugly and is not composable. The
right way of doing this IMO would be:

1. Implement uuid -> bytea and bytea -> uuid casting
2. Implement encode(bytea, 'base32') and decode(text, 'base32')

So the overall interface should be like this:

SELECT encode(uuidv7() :: bytea, 'base32');

The value of converting uuid to base32 is not obvious though, so I
would recommend explaining it in more detail. Consider starting a new
thread for each separate patch.

[1]: https://commitfest.postgresql.org/
-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: postgres_fdw: Use COPY to speed up batch inserts
Next
From: Greg Sabino Mullane
Date:
Subject: Re: POC: Carefully exposing information without authentication