How about if user wants to have an UUID of his birth date ?
regards
Marcos
Em qua., 24 de jan. de 2024 às 13:54, Andrey M. Borodin <x4mmm@yandex-team.ru> escreveu:
> On 24 Jan 2024, at 20:46, Aleksander Alekseev <aleksander@timescale.com> wrote: > > Only the > fact that timestamp from the far past generates UUID from the future > bothers me.
PFA implementation of guard checks, but I'm afraid that this can cause failures in ID generation unexpected to the user... See tests
+-- errors in edge cases of UUID v7 +SELECT 1 FROM uuidv7('1970-01-01 00:00:00+00'::timestamptz - interval '0ms'); +SELECT uuidv7('1970-01-01 00:00:00+00'::timestamptz - interval '1ms'); -- ERROR expected +SELECT 1 FROM uuidv7(uuid_extract_time('FFFFFFFF-FFFF-7FFF-B000-000000000000')); +SELECT uuidv7(uuid_extract_time('FFFFFFFF-FFFF-7FFF-B000-000000000000')+'1ms'); -- ERROR expected
Range is from 1970-01-01 00:00:00 to 10889-08-02 05:31:50.655. I'm not sure we should give this information in error message... Thanks!