Re: UUID v7
Jelte Fennema-Nio <postgres@jeltef.nl>
From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Marcos Pegoraro <marcos@f10.com.br>
Cc: Andrey Borodin <x4mmm@yandex-team.ru>, Aleksander Alekseev <aleksander@timescale.com>, pgsql-hackers mailing list <pgsql-hackers@postgresql.org>, Nikolay Samokhvalov <nik@postgres.ai>, "David G. Johnston" <david.g.johnston@gmail.com>, Przemysław Sztoch <przemyslaw@sztoch.pl>, Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>, 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>, "brad@peabody.io" <brad@peabody.io>, Kirk Wolak <wolakk@gmail.com>
Date: 2024-01-24T21:15:43Z
Lists: pgsql-hackers
On Wed, 24 Jan 2024 at 21:47, Marcos Pegoraro <marcos@f10.com.br> wrote: > > I understand your point, but > '2000-01-01' :: timestamp and '1900-01-01' :: timestamp are both valid timestamps. > > So looks strange if user can do > select uuidv7(TIMESTAMP '2000-01-01') > but cannot do > select uuidv7(TIMESTAMP '1900-01-01') I think that would be okay honestly. I don't think there's any reasonable value for the uuid when a timestamp is given outside of the date range that the uuid7 "algorithm" supports. So +1 for erroring when you provide a timestamp outside of that range (either too far in the past or too far in the future).
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