uuidv7 improperly accepts dates before 1970-01-01

Christophe Pettus <xof@thebuild.com>

From: Christophe Pettus <xof@thebuild.com>
To: pgsql-bugs@lists.postgresql.org
Date: 2026-04-25T00:19:44Z
Lists: pgsql-bugs, pgsql-hackers

Attachments

Hii,

When playing around with UUIDv7s, I discovered that it accepts this:

xof=# SELECT uuidv7(INTERVAL '-1000 years');
                uuidv7                
--------------------------------------
 e4ea52a0-bda1-7121-8f1f-3d9bb3d9a76e
(1 row)

But RFC 9562 defines the time field as an unsigned number of milliseconds since Unix epoch, so timestamps earlier than that should be rejected.  "Don't do that" is one answer, but for good hygiene, here's a patch that adds a < 0 check and a regression test.  Applies cleanly to HEAD, make check passes.

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. COPY TO FORMAT JSON: respect column list order