The following bug has been logged on the website:
Bug reference: 19738
Logged by: Shallow
Email address: theshallow27@gmail.com
PostgreSQL version: 18.6
Operating system: Linux
Description:
UUIDv7 stores a 48-bit Unix-millisecond timestamp, and PostgreSQL's
documentation says its timestamp also includes sub-millisecond precision. A
shifted timestamp 250 microseconds into the final representable millisecond
is
rejected as out of range, although its millisecond field is still the
maximum
valid value.
**Reproduction:**
```sql
SELECT uuidv7(
(timestamptz '1970-01-01 UTC'
+ interval '281474976710655 milliseconds'
+ interval '250 microseconds')
- clock_timestamp()
);
```
**Actual result:** SQLSTATE `22008`, `timestamp out of range for UUID
version 7`.
**Expected result:** Generate a UUIDv7 whose 48-bit millisecond timestamp is
`2^48 - 1`, preserving the permitted sub-millisecond component.