pgsql: Don't cast pgoff_t to possibly 32-bit types for output

Поиск
Список
Период
Сортировка
Искать

pgsql: Don't cast pgoff_t to possibly 32-bit types for output

От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
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 
Reviewed-by: Chao Li 
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(-)

FAQ