Re: UUID v7 - Mailing list pgsql-hackers

From Andrey M. Borodin
Subject Re: UUID v7
Date
Msg-id D8C766FF-A231-46F4-B02F-C7801784B5FD@yandex-team.ru
Whole thread Raw
In response to Re: UUID v7  (Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>)
Responses Re: UUID v7
List pgsql-hackers

> On 24 Jul 2024, at 04:09, Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au> wrote:
>
> Implementations MAY alter the actual timestamp.

Hmm… looks like we slightly misinterpreted words about clock source.
Well, that’s great, let’s get offset back.
PFA version accepting offset interval.
It works like this:
postgres=# select uuidv7(interval '-2 months’);
 018fc02f-0996-7136-aeb4-8936b5a516a1


postgres=# select uuid_extract_timestamp(uuidv7(interval '-2 months'));
 2024-05-28 22:11:15.71+05

What do you think?


Best regards, Andrey Borodin.

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: race condition in pg_class
Next
From: Dean Rasheed
Date:
Subject: Re: Optimize mul_var() for var1ndigits >= 8