diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index 5a5398a76ae..0ccd392c3dc 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -1104,8 +1104,8 @@ heap_xlog_logical_rewrite(XLogReaderState *r) if (ftruncate(fd, xlrec->offset) != 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not truncate file \"%s\" to %u: %m", - path, (uint32) xlrec->offset))); + errmsg("could not truncate file \"%s\" to %lld: %m", + path, (long long int) xlrec->offset))); pgstat_report_wait_end(); data = XLogRecGetData(r) + sizeof(*xlrec); diff --git a/src/backend/backup/walsummary.c b/src/backend/backup/walsummary.c index 0cdc86af30b..48b7bd8c521 100644 --- a/src/backend/backup/walsummary.c +++ b/src/backend/backup/walsummary.c @@ -306,9 +306,9 @@ WriteWalSummary(void *wal_summary_io, void *data, int length) if (nbytes != length) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not write file \"%s\": wrote only %d of %d bytes at offset %u", + errmsg("could not write file \"%s\": wrote only %d of %d bytes at offset %lld", FilePathName(io->file), nbytes, - length, (unsigned) io->filepos), + length, (long long) io->filepos), errhint("Check free disk space."))); io->filepos += nbytes; diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index c931d9b4fa8..ae9ffd0d096 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -661,6 +661,12 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd) (errcode_for_file_access(), errmsg("could not seek to beginning of file \"%s\": %m", path))); + /* + * unlikely in practice, but to document the implicit integer conversion + */ + if (histfilelen > UINT32_MAX) + elog(ERROR, "timeline history file is too large"); + pq_sendint32(&buf, histfilelen); /* col2 len */ bytesleft = histfilelen; diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 4cf4717f764..b8a66b3b475 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -1521,8 +1521,8 @@ ReportTemporaryFileUsage(const char *path, pgoff_t size) { if ((size / 1024) >= log_temp_files) ereport(LOG, - (errmsg("temporary file: path \"%s\", size %lu", - path, (unsigned long) size))); + (errmsg("temporary file: path \"%s\", size %lld", + path, (long long) size))); } } diff --git a/src/bin/pg_upgrade/slru_io.c b/src/bin/pg_upgrade/slru_io.c index 2188a287850..aa9d59a0d7b 100644 --- a/src/bin/pg_upgrade/slru_io.c +++ b/src/bin/pg_upgrade/slru_io.c @@ -133,8 +133,8 @@ SlruReadSwitchPageSlow(SlruSegState *state, uint64 pageno) if (rc == 0) { /* unexpected EOF */ - pg_log(PG_WARNING, "unexpected EOF reading file \"%s\" at offset %u, reading as zeros", - state->fn, (unsigned int) offset); + pg_log(PG_WARNING, "unexpected EOF reading file \"%s\" at offset %lld, reading as zeros", + state->fn, (long long int) offset); memset(&state->buf.data[bytes_read], 0, BLCKSZ - bytes_read); break; }