pgsql: Add comments to uuid_extract_timestamp().

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add comments to uuid_extract_timestamp().
Date: 2026-08-04 20:41:14
Message-ID: E1wrLwo-00000000DCl-0m1p@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add comments to uuid_extract_timestamp().

The timestamp-reassembly expressions in uuid_extract_timestamp() are
chains of shifted octets whose shift counts encode the field layout of
each UUID version, which is not otherwise recoverable from the code.

This commit documents, for UUIDv1, UUIDv6, and UUIDv7 alike, which
octets carry which part of the timestamp and where each part lands in
the reassembled value, citing the RFC section that defines it.

Author: Tristan Partin <tristan(at)partin(dot)io>
Reviewed-by: Miłosz Bieniek <bieniek(dot)milosz(at)proton(dot)me>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Discussion: https://postgr.es/m/DJHJW50YWKIT.XIOT4NOZRQ03@partin.io

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3f2fdd150eb04fe1da60e2a99f4ba2dd2be6443b

Modified Files
--------------
src/backend/utils/adt/uuid.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-08-04 21:53:49 pgsql: Improving handling of oversized records in xlogreader.c
Previous Message Masahiko Sawada 2026-08-04 17:57:56 pgsql: Support UUIDv6 in uuid_extract_timestamp().