Support UUIDv6 in uuid_extract_timestamp()

Started by Tristan Partinabout 4 hours ago2 messageshackers
Jump to latest
#1Tristan Partin
tristan@partin.io

UUIDv6 is the same as UUIDv1 with some fields reordered. We already
supported UUIDv1, so let's add support for UUIDv6. Previously, calls to
uuid_extract_timestamp() would return NULL for UUIDv6 values.

Patch 2 only adds comments. I think the bit manipulation is worthy of
comments, but others may disagree.

--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)

Attachments:

v1-0001-Support-UUIDv6-in-uuid_extract_timestamp.patchtext/x-patch; charset=utf-8; name=v1-0001-Support-UUIDv6-in-uuid_extract_timestamp.patchDownload+25-2
v1-0002-Add-comments-to-uuid_extract_timestamp.patchtext/x-patch; charset=utf-8; name=v1-0002-Add-comments-to-uuid_extract_timestamp.patchDownload+33-1
#2Masahiko Sawada
sawada.mshk@gmail.com
In reply to: Tristan Partin (#1)
Re: Support UUIDv6 in uuid_extract_timestamp()

On Wed, Jun 24, 2026 at 1:10 PM Tristan Partin <tristan@partin.io> wrote:

UUIDv6 is the same as UUIDv1 with some fields reordered. We already
supported UUIDv1, so let's add support for UUIDv6. Previously, calls to
uuid_extract_timestamp() would return NULL for UUIDv6 values.

Patch 2 only adds comments. I think the bit manipulation is worthy of
comments, but others may disagree.

Thank you for the patch!

The patch seems reasonable to me. I'll review the patch in depth.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com