Re: UUID v7

Поиск
Список
Период
Сортировка
От Andrey M. Borodin
Тема Re: UUID v7
Дата
Msg-id CFE482C1-F001-4C51-89A3-084E7FF36157@yandex-team.ru
обсуждение исходный текст
Ответ на Re: Re: UUID v7  (Przemysław Sztoch <przemyslaw@sztoch.pl>)
Ответы Re: UUID v7
Список pgsql-hackers
Hello Przemysław,

thanks for your interest in this patch!

> On 3 Jan 2024, at 04:37, Przemysław Sztoch <przemyslaw@sztoch.pl> wrote:
>
> 1. Is it possible to add a function that returns the version of the generated uuid?
> It will be very useful.
> I don't know if it's possible, but I think there are bits in the UUID that inform about the version.
What do you think if we have functions get_uuid_v7_ver(uuid) and get_uuid_v7_var(uuid) to extract bit fields according
to[0] ? Or, perhaps, this should be one function with two return parameters? 
It's not in a patch yet, I'm just considering how this functionality should look like.

> 2. If there is any doubt about adding the function to the main sources (standard development in progress), in my
opinionyou can definitely add this function to the uuid-ossp extension. 
From my POV we can just have this function in the core. OSSP support for UUID seems more or less dead [1]: "Newsflash:
04-Jul-2008:Released OSSP uuid 1.6.2". Or do I look into wrong place? 

> 3. Wouldn't it be worth including UUID version 6 as well?
The standard in [0] says "Systems that do not involve legacy UUIDv1 SHOULD use UUIDv7 Section 5.7 instead." If there's
apoint in developing v6 - I'm OK to do so. 

> 4. Sometimes you will need to generate a uuid for historical time. There should be an additional function
gen_uuid_v7(timestamp).
Done, please see patch attached. But I changed signature to gen_uuid_v7(int8), to avoid messing with bytes from user
whoknows what they want. Or do you think gen_uuid_v7(timestamp) would be more convenient? 

Thanks!

Best regards, Andrey Borodin.


[0] https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis-14#uuidv7
[1] http://www.ossp.org/

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: add AVX2 support to simd.h
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression