On Thu, Jun 11, 2026 at 2:20 PM Masahiko Sawada <[email protected]>
wrote:

> I think we should go ahead and add both upper and lower bound checks,
> barring objections.
>

Thanks Masahiko. Here's a patch series that adds both boundary
checks along with the infinity check from my earlier patch:

  0001 - Reject timestamps before the Unix epoch (lower bound)
  0002 - Reject infinite intervals
  0003 - Reject timestamps beyond the 48-bit field limit (upper bound)

Christophe's original v1 covered the pre-epoch case; 0001 is
essentially the same fix with slightly different wording. I have
included it here so the series is self-contained and applies
cleanly on HEAD. Happy to drop it in favor of Christophe's
version if you prefer that.

The infinity check (0002) goes before the epoch conversion so
that uuidv7('infinity'::interval) gets a clear "infinite timestamps"
message rather than falling through to the pre-epoch check
with a confusing detail.

All three use ERRCODE_DATETIME_VALUE_OUT_OF_RANGE with errdetail.

Thanks,
Baji Shaik.

Attachment: 0001-Fix-uuidv7-with-pre-epoch-interval-silently-producin.patch
Description: Binary data

Attachment: 0002-Fix-uuidv7-with-infinite-interval-causing-integer-ov.patch
Description: Binary data

Attachment: 0003-Fix-uuidv7-with-far-future-interval-silently-overflo.patch
Description: Binary data

Reply via email to