Re: UUID v7

Поиск
Список
Период
Сортировка
От Andrey M. Borodin
Тема Re: UUID v7
Дата
Msg-id AC9496A1-3120-4F53-9D64-D008CEA7528F@yandex-team.ru
обсуждение исходный текст
Ответ на Re: UUID v7  (Aleksander Alekseev <aleksander@timescale.com>)
Ответы Re: UUID v7  (Aleksander Alekseev <aleksander@timescale.com>)
Список pgsql-hackers

> On 24 Jan 2024, at 17:31, Aleksander Alekseev <aleksander@timescale.com> wrote:
>
> Hi,
>
>> Cfbot also seems to be happy with the patch so I'm changing the CF
>> entry status to RfC.
>
> I've found a bug:
>
> ```
> =# select now() - interval '5000 years';
>                ?column?
> ----------------------------------------
> 2977-01-24 15:29:01.779462+02:30:17 BC
>
> Time: 0.957 ms
>
> =# select uuidv7(now() - interval '5000 years');
>                uuidv7
> --------------------------------------
> 720c1868-0764-7677-99cd-265b84ea08b9
>
> =# select uuid_extract_time('720c1868-0764-7677-99cd-265b84ea08b9');
>     uuid_extract_time
> ----------------------------
> 5943-08-26 21:30:44.836+03
> ```

UUIDv7 range does not correspond to timestamp range. But it’s purpose is not in storing timestamp, but in being unique
identifier.So I don’t think it worth throwing an error when overflowing value is given. BTW if you will subtract some
nanoseconds- you will not get back timestamp you put into UUID too. 
UUID does not store timpestamp, it only uses it to generate an identifier. Some value can be extracted back, but with
limitedprecision, limited range and only if UUID was generated precisely by the specification in standard (and standard
allowsdeviation! Most of implementation try to tradeoff something). 


Best regards, Andrey Borodin.


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

Предыдущее
От: Aleksander Alekseev
Дата:
Сообщение: Re: UUID v7
Следующее
От: Aleksander Alekseev
Дата:
Сообщение: Re: Support TZ format code in to_timestamp()