public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: [email protected]
Subject: pgsql: Don't cast pgoff_t to possibly 32-bit types for output
Date: Tue, 07 Jul 2026 09:50:09 +0000
Message-ID: <[email protected]> (raw)

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 <[email protected]>
Reviewed-by: Chao Li <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/20ce62fa-47fc-457b-b504-12f3c1651726%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/04fc2564fbbabe97cadbf782e8d40b8e3f7b22a5

Modified Files
--------------
src/backend/access/heap/rewriteheap.c | 4 ++--
src/backend/backup/walsummary.c       | 4 ++--
src/backend/replication/walsender.c   | 6 ++++++
src/backend/storage/file/fd.c         | 4 ++--
src/bin/pg_upgrade/slru_io.c          | 4 ++--
5 files changed, 14 insertions(+), 8 deletions(-)



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Don't cast pgoff_t to possibly 32-bit types for output
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox