Re: uuidv7 improperly accepts dates before 1970-01-01 - Mailing list pgsql-hackers

From Baji Shaik
Subject Re: uuidv7 improperly accepts dates before 1970-01-01
Date
Msg-id CA+fm-RN9UgAG2ew7T0Gum8RtZ4ZbyYvOLyyqAiuTWhsGEn3_zw@mail.gmail.com
Whole thread
In response to Re: uuidv7 improperly accepts dates before 1970-01-01  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: uuidv7 improperly accepts dates before 1970-01-01
List pgsql-hackers
On Wed, Jun 24, 2026 at 9:19 PM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:
From a user's perspective, it seems sufficient to know that the
shifted timestamp falls outside the range supported by UUID v7. As a
translator, I'm not particularly enthusiastic about adding more
message variants when the distinction is not particularly useful to
users.

Thanks for the feedback, Kyotaro. Good point. Attached v3 with all boundary checks
using a single shared errdetail:

 "UUID version 7 supports timestamps from 1970-01-01 to approximately year 10889."

0001 - Reject infinite intervals
0002 - Reject pre-epoch timestamps (with overflow-safe epoch conversion)
0003 - Reject timestamps beyond the 48-bit limit

I prefer keeping them as 3 patches since each addresses a distinct
failure mode and is easier to review/bisect independently. That said,
since 0002 and 0003 now share the same errdetail and are logically
the same validation (timestamp outside valid range), I'm happy to
merge them into one patch for v4 if preferred. 

Thanks,
Baji Shaik.
Attachment

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Nitin Jadhav
Date:
Subject: Re: [PATCH] Fix minRecoveryPoint not advanced past checkpoint in CreateRestartPoint