Re: UUID v7

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: Sergey Prokhorenko <sergeyprokhorenko(at)yahoo(dot)com(dot)au>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, Przemysław Sztoch <przemyslaw(at)sztoch(dot)pl>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Mat Arye <mat(at)timescaledb(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, Junwang Zhao <zhjwpku(at)gmail(dot)com>
Subject: Re: UUID v7
Date: 2024-03-14 15:10:29
Message-ID: ea72ac58-a120-4f51-a1b1-c376b96ec2fd@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14.03.24 12:25, Andrey M. Borodin wrote:
>>>> I think the behavior of uuid_extract_var(iant) is wrong. The code
>>>> takes just two bits to return, but the draft document is quite clear
>>>> that the variant is 4 bits (see Table 1).
>>> Well, it was correct only for implemented variant. I've made version that implements full table 1 from section 4.1.
>> I think we are still interpreting this differently. I think uuid_extract_variant should just return whatever is in those four bits. Your function comment says "Can return only 0, 0b10, 0b110 and 0b111.", which I don't think it is correct. It should return 0 through 15.
> We will return "do not care" bits. This bits can confuse someone. E.g. for varaint 0b10 we can return 8, 9, 10 and 11 randomly. Is it OK? BTW for some reason document lists number 1-15, but your are correct that range is 0-15.

I agree it's confusing. Before I studied the RFC 4122bis project, I
didn't even know about variant vs. version. I think overall people will
find this more confusing than useful. If you just want to know, "is
this UUID of the kind specified in RFC 4122", you can query it with
uuid_extract_version(x) IS NOT NULL. So maybe we don't need the
_extract_variant function?

In response to

  • Re: UUID v7 at 2024-03-14 11:25:56 from Andrey M. Borodin

Responses

  • Re: UUID v7 at 2024-03-14 18:06:04 from Andrey M. Borodin

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-03-14 15:30:30 Re: Parallel Bitmap Heap Scan reports per-worker stats in EXPLAIN ANALYZE
Previous Message Amul Sul 2024-03-14 15:05:03 Re: Add system identifier to backup manifest