]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Don't cast pgoff_t to possibly 32-bit types for output
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 7 Jul 2026 09:45:09 +0000 (11:45 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 7 Jul 2026 09:45:09 +0000 (11:45 +0200)
commit04fc2564fbbabe97cadbf782e8d40b8e3f7b22a5
treee96caa46c1e217c02fb8b9084b6550d869a1de57
parentbb4142fb68cfab35b7c5f8db7645196c50662631
Don't cast pgoff_t to possibly 32-bit types for output

pgoff_t is most likely a 64-bit integer, so casting it to a 32-bit
type for output could lose data.  In the cases addressed here, the
files cannot actually get that large, so this is only cosmetic and to
set better examples for the future.  (Similar issues that could have
actual practical impact were addressed separately in commit
e8f851d6172.)

In one case, the 32-bit size is baked into the protocol, so here we
add an elog and document this discrepancy.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/20ce62fa-47fc-457b-b504-12f3c1651726%40eisentraut.org
src/backend/access/heap/rewriteheap.c
src/backend/backup/walsummary.c
src/backend/replication/walsender.c
src/backend/storage/file/fd.c
src/bin/pg_upgrade/slru_io.c