postgresql/src/backend
Masahiko Sawada a5419bc72e Fix timestamp overflow in UUIDv7 implementation.
The uuidv7_interval() function previously converted a shifted
microsecond-precision timestamp (64-bit integer) to another 64-bit
integer representing a timestamp with nanosecond precision. This
conversion caused overflow for dates beyond the year 2262. The
millisecond and sub-millisecond parts were then extracted from this
nanosecond-precision timestamp and stored in UUIDv7 values.

With this commit, the millisecond and sub-millisecond parts are stored
directly into the UUIDv7 value without being converted back to a
nanosecond precision timestamp. Following RFC 9562, the timestamp is
stored as an unsigned integer, enabling support for dates up to the
year 10889.

Reported and fixed by Andrey Borodin, with cosmetic changes and
regression tests by me.

Reported-by: Andrey Borodin <x4mmm@yandex-team.ru>
Author: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/96DEC2D9-659A-40E8-B7BA-AF5D162A9E21@yandex-team.ru
2025-03-28 09:39:11 -07:00
..
access Fix guc_malloc calls for consistency and OOM checks 2025-03-27 22:57:34 +01:00
archive Update copyright for 2025 2025-01-01 11:21:55 -05:00
backup pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
bootstrap Remove unnecessary (char *) casts [mem] 2025-02-12 08:50:13 +01:00
catalog Add support for not-null constraints on virtual generated columns 2025-03-28 13:53:37 +01:00
commands Add support for not-null constraints on virtual generated columns 2025-03-28 13:53:37 +01:00
executor Add support for not-null constraints on virtual generated columns 2025-03-28 13:53:37 +01:00
foreign Update copyright for 2025 2025-01-01 11:21:55 -05:00
jit Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
lib Update copyright for 2025 2025-01-01 11:21:55 -05:00
libpq Modularize log_connections output 2025-03-12 11:35:21 -04:00
main Use thread-safe strftime_l() instead of strftime(). 2025-03-28 07:13:43 +01:00
nodes Remove the query_id_squash_values GUC 2025-03-27 13:33:37 +01:00
optimizer Allow plugins to set a 64-bit plan identifier in PlannedStmt 2025-03-24 13:23:42 +09:00
parser Add support for not-null constraints on virtual generated columns 2025-03-28 13:53:37 +01:00
partitioning Fix bug in cbc127917 to handle nested Append correctly 2025-02-25 09:24:42 +09:00
po Update copyright for 2025 2025-01-01 11:21:55 -05:00
port Update copyright for 2025 2025-01-01 11:21:55 -05:00
postmaster Remove the query_id_squash_values GUC 2025-03-27 13:33:37 +01:00
regex Support PG_UNICODE_FAST locale in the builtin collation provider. 2025-01-17 15:56:30 -08:00
replication Fix guc_malloc calls for consistency and OOM checks 2025-03-27 22:57:34 +01:00
rewrite Fix incorrect handling of subquery pullup 2025-03-13 16:36:03 +09:00
snowball Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
statistics Stats: use schemaname/relname instead of regclass. 2025-03-25 11:16:06 -07:00
storage Fix guc_malloc calls for consistency and OOM checks 2025-03-27 22:57:34 +01:00
tcop Fix guc_malloc calls for consistency and OOM checks 2025-03-27 22:57:34 +01:00
tsearch Clear errno before calling strtol() in spell.c. 2025-03-08 11:24:25 -05:00
utils Fix timestamp overflow in UUIDv7 implementation. 2025-03-28 09:39:11 -07:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile aio: Add liburing dependency 2025-03-26 19:45:32 -04:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls.mk Return yyparse() result not via global variable 2025-01-24 06:55:39 +01:00