Re: UUID v7
x4mmm@yandex-team.ru
From: "Andrey M. Borodin" <x4mmm@yandex-team.ru>
To: Andrey Borodin <amborodin86@gmail.com>
Cc: Jelte Fennema <postgres@jeltef.nl>,
Nick Babadzhanian <pgnickb@gmail.com>,
Mat Arye <mat@timescaledb.com>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Tom Lane <tgl@sss.pgh.pa.us>,
Daniel Gustafsson <daniel@yesql.se>,
Matthias van de Meent <boekewurm+postgres@gmail.com>,
Nikolay Samokhvalov <samokhvalov@gmail.com>,
"Kyzer Davis (kydavis)" <kydavis@cisco.com>,
Andres Freund <andres@anarazel.de>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
"brad@peabody.io" <brad@peabody.io>,
"wolakk@gmail.com" <wolakk@gmail.com>,
sergeyprokhorenko@yahoo.com.au
Date: 2024-01-02T09:17:42Z
Lists: pgsql-hackers
Attachments
- v7-0001-Implement-UUID-v7-as-per-IETF-draft.patch (application/octet-stream) patch v7-0001
- v7-0003-Use-cached-random-numbers-in-gen_random_uuid-too.patch (application/octet-stream) patch v7-0003
- v7-0002-Buffer-random-numbers.patch (application/octet-stream) patch v7-0002
> On 9 Oct 2023, at 23:46, Andrey Borodin <amborodin86@gmail.com> wrote: Here's next iteration of the patch. I've added get_uuid_v7_time(). This function extracts timestamp from uuid, iff it is v7. Timestamp correctness only guaranteed if the timestamp was generated by the same implementation (6 bytes for milliseconds obtained by gettimeofday()). Tests verify that get_uuid_v7_time(gen_uuid_v7()) differs no more than 1ms from now(). Maybe we should allow more tolerant values for slow test machines. Best regards, Andrey Borodin.
Commits
-
Fix timestamp overflow in UUIDv7 implementation.
- a5419bc72e22 18.0 landed
-
Add UUID version 7 generation function.
- 78c5e141e9c1 18.0 landed
-
Add some UUID support functions
- 794f10f6b920 17.0 landed