| From: | Christophe Pettus <xof(at)thebuild(dot)com> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | uuidv7 improperly accepts dates before 1970-01-01 |
| Date: | 2026-04-25 00:19:44 |
| Message-ID: | 799A70FA-6E5C-4118-99EB-2FBBE1CBAC54@thebuild.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
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.
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-uuidv7-fix-negative-shift.diff | application/octet-stream | 2.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joe Conway | 2026-04-25 00:23:45 | Re: BUG #19457: RE: pgp_sym_encrypt silently accepts non-FIPS ciphers (bf, cast5, 3des) when OpenSSL is in FIPS mod |
| Previous Message | Masahiko Sawada | 2026-04-24 23:23:46 | Re: TRAP: failed Assert("offsets[i] > offsets[i - 1]"), File: "tidstore.c" |