uuidv7 improperly accepts dates before 1970-01-01 - Mailing list pgsql-bugs

From Christophe Pettus
Subject uuidv7 improperly accepts dates before 1970-01-01
Date
Msg-id 799A70FA-6E5C-4118-99EB-2FBBE1CBAC54@thebuild.com
Whole thread
Responses Re: uuidv7 improperly accepts dates before 1970-01-01
List 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
thatshould be rejected.  "Don't do that" is one answer, but for good hygiene, here's a patch that adds a < 0 check and
aregression test.  Applies cleanly to HEAD, make check passes. 


Attachment

pgsql-bugs by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: TRAP: failed Assert("offsets[i] > offsets[i - 1]"), File: "tidstore.c"
Next
From: Joe Conway
Date:
Subject: Re: BUG #19457: RE: pgp_sym_encrypt silently accepts non-FIPS ciphers (bf, cast5, 3des) when OpenSSL is in FIPS mod