Use PRI?64 instead of "ll?" in format strings (continued).
authorPeter Eisentraut <peter@eisentraut.org>
Sat, 29 Mar 2025 09:30:08 +0000 (10:30 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 29 Mar 2025 09:43:57 +0000 (10:43 +0100)
Continuation of work started in commit 15a79c73, after initial trial.

Author: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/b936d2fb-590d-49c3-a615-92c3a88c6c19%40eisentraut.org

54 files changed:
contrib/file_fdw/file_fdw.c
contrib/pageinspect/btreefuncs.c
contrib/pageinspect/hashfuncs.c
contrib/pg_prewarm/pg_prewarm.c
src/backend/access/brin/brin.c
src/backend/access/heap/vacuumlazy.c
src/backend/access/rmgrdesc/clogdesc.c
src/backend/access/rmgrdesc/committsdesc.c
src/backend/access/rmgrdesc/mxactdesc.c
src/backend/access/rmgrdesc/xactdesc.c
src/backend/access/transam/multixact.c
src/backend/access/transam/slru.c
src/backend/access/transam/xloginsert.c
src/backend/access/transam/xlogreader.c
src/backend/backup/basebackup_incremental.c
src/backend/backup/walsummaryfuncs.c
src/backend/catalog/catalog.c
src/backend/commands/analyze.c
src/backend/commands/copy.c
src/backend/commands/copyfrom.c
src/backend/commands/copyfromparse.c
src/backend/commands/explain.c
src/backend/commands/sequence.c
src/backend/commands/vacuum.c
src/backend/replication/logical/logical.c
src/backend/replication/slot.c
src/backend/storage/ipc/ipc.c
src/backend/storage/ipc/signalfuncs.c
src/backend/utils/activity/pgstat.c
src/backend/utils/activity/pgstat_replslot.c
src/backend/utils/activity/pgstat_shmem.c
src/backend/utils/activity/pgstat_xact.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/varlena.c
src/backend/utils/adt/xid8funcs.c
src/backend/utils/error/csvlog.c
src/backend/utils/error/elog.c
src/backend/utils/error/jsonlog.c
src/backend/utils/mmgr/mcxt.c
src/backend/utils/sort/logtape.c
src/backend/utils/sort/tuplesort.c
src/bin/pg_basebackup/pg_createsubscriber.c
src/bin/pg_combinebackup/pg_combinebackup.c
src/bin/pg_combinebackup/write_manifest.c
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_resetwal/pg_resetwal.c
src/bin/pg_rewind/libpq_source.c
src/bin/pg_verifybackup/astreamer_verify.c
src/bin/pg_verifybackup/pg_verifybackup.c
src/fe_utils/print.c
src/include/lib/radixtree.h
src/test/modules/test_copy_callbacks/test_copy_callbacks.c
src/test/modules/test_slru/test_slru.c
src/test/modules/xid_wraparound/xid_wraparound.c

index d94690e89dd47b0084bb4b69d9026f6b789fcc09..a9a5671d95a6fe85eb183504b96efd602108e9c6 100644 (file)
@@ -798,8 +798,8 @@ retry:
                cstate->num_errors > cstate->opts.reject_limit)
                ereport(ERROR,
                        (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
-                        errmsg("skipped more than REJECT_LIMIT (%lld) rows due to data type incompatibility",
-                               (long long) cstate->opts.reject_limit)));
+                        errmsg("skipped more than REJECT_LIMIT (%" PRId64 ") rows due to data type incompatibility",
+                               cstate->opts.reject_limit)));
 
            /* Repeat NextCopyFrom() until no soft error occurs */
            goto retry;
@@ -855,10 +855,10 @@ fileEndForeignScan(ForeignScanState *node)
        festate->cstate->num_errors > 0 &&
        festate->cstate->opts.log_verbosity >= COPY_LOG_VERBOSITY_DEFAULT)
        ereport(NOTICE,
-               errmsg_plural("%llu row was skipped due to data type incompatibility",
-                             "%llu rows were skipped due to data type incompatibility",
-                             (unsigned long long) festate->cstate->num_errors,
-                             (unsigned long long) festate->cstate->num_errors));
+               errmsg_plural("%" PRIu64 " row was skipped due to data type incompatibility",
+                             "%" PRIu64 " rows were skipped due to data type incompatibility",
+                             festate->cstate->num_errors,
+                             festate->cstate->num_errors));
 
    EndCopyFrom(festate->cstate);
 }
@@ -1319,10 +1319,10 @@ file_acquire_sample_rows(Relation onerel, int elevel,
        cstate->num_errors > 0 &&
        cstate->opts.log_verbosity >= COPY_LOG_VERBOSITY_DEFAULT)
        ereport(NOTICE,
-               errmsg_plural("%llu row was skipped due to data type incompatibility",
-                             "%llu rows were skipped due to data type incompatibility",
-                             (unsigned long long) cstate->num_errors,
-                             (unsigned long long) cstate->num_errors));
+               errmsg_plural("%" PRIu64 " row was skipped due to data type incompatibility",
+                             "%" PRIu64 " rows were skipped due to data type incompatibility",
+                             cstate->num_errors,
+                             cstate->num_errors));
 
    EndCopyFrom(cstate);
 
index 9cdc8e182b48363e843aa09e9bc5e072e4b32d30..294821231fc3b9239277c642ffdfea02e082d41c 100644 (file)
@@ -206,14 +206,12 @@ check_relation_block_range(Relation rel, int64 blkno)
    if (blkno < 0 || blkno > MaxBlockNumber)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("invalid block number %lld",
-                       (long long) blkno)));
+                errmsg("invalid block number %" PRId64, blkno)));
 
    if ((BlockNumber) (blkno) >= RelationGetNumberOfBlocks(rel))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("block number %lld is out of range",
-                       (long long) blkno)));
+                errmsg("block number %" PRId64 " is out of range", blkno)));
 }
 
 /* -----------------------------------------------
index d4a2a1d676ab96d5d67586763516cf113f4ac119..ca7f1f6e7410d14fb6a0be7a224de3d8df38cb6f 100644 (file)
@@ -436,8 +436,8 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
    if (ovflblkno >= RelationGetNumberOfBlocks(indexRel))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("block number %lld is out of range for relation \"%s\"",
-                       (long long int) ovflblkno, RelationGetRelationName(indexRel))));
+                errmsg("block number %" PRId64 " is out of range for relation \"%s\"",
+                       ovflblkno, RelationGetRelationName(indexRel))));
 
    /* Read the metapage so we can determine which bitmap page to use */
    metabuf = _hash_getbuf(indexRel, HASH_METAPAGE, HASH_READ, LH_META_PAGE);
index f496ec9d85d2824426595935d4c6b97e031ff976..63faf43d0bf3e12f835d9b3fa772eead26642d3f 100644 (file)
@@ -129,8 +129,8 @@ pg_prewarm(PG_FUNCTION_ARGS)
        if (first_block < 0 || first_block >= nblocks)
            ereport(ERROR,
                    (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                    errmsg("starting block number must be between 0 and %lld",
-                           (long long) (nblocks - 1))));
+                    errmsg("starting block number must be between 0 and %" PRId64,
+                           (nblocks - 1))));
    }
    if (PG_ARGISNULL(4))
        last_block = nblocks - 1;
@@ -140,8 +140,8 @@ pg_prewarm(PG_FUNCTION_ARGS)
        if (last_block < 0 || last_block >= nblocks)
            ereport(ERROR,
                    (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                    errmsg("ending block number must be between 0 and %lld",
-                           (long long) (nblocks - 1))));
+                    errmsg("ending block number must be between 0 and %" PRId64,
+                           (nblocks - 1))));
    }
 
    /* Now we're ready to do the real work. */
index 737ad63880878942bf146843203399bb8dbd272d..01e1db7f856be10d77f8e01bfbc3a48a22b1a60e 100644 (file)
@@ -1400,8 +1400,7 @@ brin_summarize_range(PG_FUNCTION_ARGS)
    if (heapBlk64 > BRIN_ALL_BLOCKRANGES || heapBlk64 < 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
-                errmsg("block number out of range: %lld",
-                       (long long) heapBlk64)));
+                errmsg("block number out of range: %" PRId64, heapBlk64)));
    heapBlk = (BlockNumber) heapBlk64;
 
    /*
@@ -1508,8 +1507,8 @@ brin_desummarize_range(PG_FUNCTION_ARGS)
    if (heapBlk64 > MaxBlockNumber || heapBlk64 < 0)
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
-                errmsg("block number out of range: %lld",
-                       (long long) heapBlk64)));
+                errmsg("block number out of range: %" PRId64,
+                       heapBlk64)));
    heapBlk = (BlockNumber) heapBlk64;
 
    /*
index 2cbcf5e5db2cdcc360ea25cec619d0e85f74077e..6d287b38cf552609dc336d3fd21d211532f82549 100644 (file)
@@ -1020,14 +1020,14 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
                             orig_rel_pages,
                             vacrel->eager_scanned_pages);
            appendStringInfo(&buf,
-                            _("tuples: %lld removed, %lld remain, %lld are dead but not yet removable\n"),
-                            (long long) vacrel->tuples_deleted,
-                            (long long) vacrel->new_rel_tuples,
-                            (long long) vacrel->recently_dead_tuples);
+                            _("tuples: %" PRId64 " removed, %" PRId64 " remain, %" PRId64 " are dead but not yet removable\n"),
+                            vacrel->tuples_deleted,
+                            (int64) vacrel->new_rel_tuples,
+                            vacrel->recently_dead_tuples);
            if (vacrel->missed_dead_tuples > 0)
                appendStringInfo(&buf,
-                                _("tuples missed: %lld dead from %u pages not removed due to cleanup lock contention\n"),
-                                (long long) vacrel->missed_dead_tuples,
+                                _("tuples missed: %" PRId64 " dead from %u pages not removed due to cleanup lock contention\n"),
+                                vacrel->missed_dead_tuples,
                                 vacrel->missed_dead_pages);
            diff = (int32) (ReadNextTransactionId() -
                            vacrel->cutoffs.OldestXmin);
@@ -1050,12 +1050,12 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
                                 _("new relminmxid: %u, which is %d MXIDs ahead of previous value\n"),
                                 vacrel->NewRelminMxid, diff);
            }
-           appendStringInfo(&buf, _("frozen: %u pages from table (%.2f%% of total) had %lld tuples frozen\n"),
+           appendStringInfo(&buf, _("frozen: %u pages from table (%.2f%% of total) had %" PRId64 " tuples frozen\n"),
                             vacrel->new_frozen_tuple_pages,
                             orig_rel_pages == 0 ? 100.0 :
                             100.0 * vacrel->new_frozen_tuple_pages /
                             orig_rel_pages,
-                            (long long) vacrel->tuples_frozen);
+                            vacrel->tuples_frozen);
 
            appendStringInfo(&buf,
                             _("visibility map: %u pages set all-visible, %u pages set all-frozen (%u were all-visible)\n"),
@@ -1070,7 +1070,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
                else
                    appendStringInfoString(&buf, _("index scan needed: "));
 
-               msgfmt = _("%u pages from table (%.2f%% of total) had %lld dead item identifiers removed\n");
+               msgfmt = _("%u pages from table (%.2f%% of total) had %" PRId64 " dead item identifiers removed\n");
            }
            else
            {
@@ -1079,13 +1079,13 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
                else
                    appendStringInfoString(&buf, _("index scan bypassed by failsafe: "));
 
-               msgfmt = _("%u pages from table (%.2f%% of total) have %lld dead item identifiers\n");
+               msgfmt = _("%u pages from table (%.2f%% of total) have %" PRId64 " dead item identifiers\n");
            }
            appendStringInfo(&buf, msgfmt,
                             vacrel->lpdead_item_pages,
                             orig_rel_pages == 0 ? 100.0 :
                             100.0 * vacrel->lpdead_item_pages / orig_rel_pages,
-                            (long long) vacrel->lpdead_items);
+                            vacrel->lpdead_items);
            for (int i = 0; i < vacrel->nindexes; i++)
            {
                IndexBulkDeleteResult *istat = vacrel->indstats[i];
@@ -1130,16 +1130,16 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
            appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
                             read_rate, write_rate);
            appendStringInfo(&buf,
-                            _("buffer usage: %lld hits, %lld reads, %lld dirtied\n"),
-                            (long long) total_blks_hit,
-                            (long long) total_blks_read,
-                            (long long) total_blks_dirtied);
+                            _("buffer usage: %" PRId64 " hits, %" PRId64 " reads, %" PRId64 " dirtied\n"),
+                            total_blks_hit,
+                            total_blks_read,
+                            total_blks_dirtied);
            appendStringInfo(&buf,
-                            _("WAL usage: %lld records, %lld full page images, %llu bytes, %lld buffers full\n"),
-                            (long long) walusage.wal_records,
-                            (long long) walusage.wal_fpi,
-                            (unsigned long long) walusage.wal_bytes,
-                            (long long) walusage.wal_buffers_full);
+                            _("WAL usage: %" PRId64 " records, %" PRId64 " full page images, %" PRIu64 " bytes, %" PRId64 " buffers full\n"),
+                            walusage.wal_records,
+                            walusage.wal_fpi,
+                            walusage.wal_bytes,
+                            walusage.wal_buffers_full);
            appendStringInfo(&buf, _("system usage: %s"), pg_rusage_show(&ru0));
 
            ereport(verbose ? INFO : LOG,
@@ -2802,8 +2802,8 @@ lazy_vacuum_heap_rel(LVRelState *vacrel)
            vacuumed_pages == vacrel->lpdead_item_pages));
 
    ereport(DEBUG2,
-           (errmsg("table \"%s\": removed %lld dead item identifiers in %u pages",
-                   vacrel->relname, (long long) vacrel->dead_items_info->num_items,
+           (errmsg("table \"%s\": removed %" PRId64 " dead item identifiers in %u pages",
+                   vacrel->relname, vacrel->dead_items_info->num_items,
                    vacuumed_pages)));
 
    /* Revert to the previous phase information for error traceback */
index f2d0ee7a023e2ba640902df3e6b1e1ba4e4f908a..41bf28dcfd05cb6b4eb16f4ae13109d112173609 100644 (file)
@@ -28,15 +28,15 @@ clog_desc(StringInfo buf, XLogReaderState *record)
        int64       pageno;
 
        memcpy(&pageno, rec, sizeof(pageno));
-       appendStringInfo(buf, "page %lld", (long long) pageno);
+       appendStringInfo(buf, "page %" PRId64, pageno);
    }
    else if (info == CLOG_TRUNCATE)
    {
        xl_clog_truncate xlrec;
 
        memcpy(&xlrec, rec, sizeof(xl_clog_truncate));
-       appendStringInfo(buf, "page %lld; oldestXact %u",
-                        (long long) xlrec.pageno, xlrec.oldestXact);
+       appendStringInfo(buf, "page %" PRId64 "; oldestXact %u",
+                        xlrec.pageno, xlrec.oldestXact);
    }
 }
 
index c5e1c1b5bb3a7394e6faa0090ff6d98fdcfc2eb7..a6ab9dd78de176d5605e8e9330b8226b0d32c013 100644 (file)
@@ -28,14 +28,14 @@ commit_ts_desc(StringInfo buf, XLogReaderState *record)
        int64       pageno;
 
        memcpy(&pageno, rec, sizeof(pageno));
-       appendStringInfo(buf, "%lld", (long long) pageno);
+       appendStringInfo(buf, "%" PRId64, pageno);
    }
    else if (info == COMMIT_TS_TRUNCATE)
    {
        xl_commit_ts_truncate *trunc = (xl_commit_ts_truncate *) rec;
 
-       appendStringInfo(buf, "pageno %lld, oldestXid %u",
-                        (long long) trunc->pageno, trunc->oldestXid);
+       appendStringInfo(buf, "pageno %" PRId64 ", oldestXid %u",
+                        trunc->pageno, trunc->oldestXid);
    }
 }
 
index 8bd3d5b63c74cba6f28d857a516b4fd2d57f402c..3ca0582db3647787e9cf69f1c6ae8afccbd1084f 100644 (file)
@@ -58,7 +58,7 @@ multixact_desc(StringInfo buf, XLogReaderState *record)
        int64       pageno;
 
        memcpy(&pageno, rec, sizeof(pageno));
-       appendStringInfo(buf, "%lld", (long long) pageno);
+       appendStringInfo(buf, "%" PRId64, pageno);
    }
    else if (info == XLOG_MULTIXACT_CREATE_ID)
    {
index 7f94810defc32d9403ad2de582d645c26b5c614e..715cc1f7bad66a35a92a81e10b09a6454f401861 100644 (file)
@@ -320,10 +320,10 @@ xact_desc_stats(StringInfo buf, const char *label,
            uint64      objid =
                ((uint64) dropped_stats[i].objid_hi) << 32 | dropped_stats[i].objid_lo;
 
-           appendStringInfo(buf, " %d/%u/%llu",
+           appendStringInfo(buf, " %d/%u/%" PRIu64,
                             dropped_stats[i].kind,
                             dropped_stats[i].dboid,
-                            (unsigned long long) objid);
+                            objid);
        }
    }
 }
index c1e2c42e1bb68ee21f94393a542bee60acd94385..9d25a7df0d32088abe67357f220e25621afb81e1 100644 (file)
@@ -3058,8 +3058,8 @@ PerformMembersTruncation(MultiXactOffset oldestOffset, MultiXactOffset newOldest
     */
    while (segment != endsegment)
    {
-       elog(DEBUG2, "truncating multixact members segment %llx",
-            (unsigned long long) segment);
+       elog(DEBUG2, "truncating multixact members segment %" PRIx64,
+            segment);
        SlruDeleteSegment(MultiXactMemberCtl, segment);
 
        /* move to next segment, handling wraparound correctly */
@@ -3210,14 +3210,14 @@ TruncateMultiXact(MultiXactId newOldestMulti, Oid newOldestMultiDB)
    }
 
    elog(DEBUG1, "performing multixact truncation: "
-        "offsets [%u, %u), offsets segments [%llx, %llx), "
-        "members [%u, %u), members segments [%llx, %llx)",
+        "offsets [%u, %u), offsets segments [%" PRIx64 ", %" PRIx64 "), "
+        "members [%u, %u), members segments [%" PRIx64 ", %" PRIx64 ")",
         oldestMulti, newOldestMulti,
-        (unsigned long long) MultiXactIdToOffsetSegment(oldestMulti),
-        (unsigned long long) MultiXactIdToOffsetSegment(newOldestMulti),
+        MultiXactIdToOffsetSegment(oldestMulti),
+        MultiXactIdToOffsetSegment(newOldestMulti),
         oldestOffset, newOldestOffset,
-        (unsigned long long) MXOffsetToMemberSegment(oldestOffset),
-        (unsigned long long) MXOffsetToMemberSegment(newOldestOffset));
+        MXOffsetToMemberSegment(oldestOffset),
+        MXOffsetToMemberSegment(newOldestOffset));
 
    /*
     * Do truncation, and the WAL logging of the truncation, in a critical
@@ -3470,14 +3470,14 @@ multixact_redo(XLogReaderState *record)
               SizeOfMultiXactTruncate);
 
        elog(DEBUG1, "replaying multixact truncation: "
-            "offsets [%u, %u), offsets segments [%llx, %llx), "
-            "members [%u, %u), members segments [%llx, %llx)",
+            "offsets [%u, %u), offsets segments [%" PRIx64 ", %" PRIx64 "), "
+            "members [%u, %u), members segments [%" PRIx64 ", %" PRIx64 ")",
             xlrec.startTruncOff, xlrec.endTruncOff,
-            (unsigned long long) MultiXactIdToOffsetSegment(xlrec.startTruncOff),
-            (unsigned long long) MultiXactIdToOffsetSegment(xlrec.endTruncOff),
+            MultiXactIdToOffsetSegment(xlrec.startTruncOff),
+            MultiXactIdToOffsetSegment(xlrec.endTruncOff),
             xlrec.startTruncMemb, xlrec.endTruncMemb,
-            (unsigned long long) MXOffsetToMemberSegment(xlrec.startTruncMemb),
-            (unsigned long long) MXOffsetToMemberSegment(xlrec.endTruncMemb));
+            MXOffsetToMemberSegment(xlrec.startTruncMemb),
+            MXOffsetToMemberSegment(xlrec.endTruncMemb));
 
        /* should not be required, but more than cheap enough */
        LWLockAcquire(MultiXactTruncationLock, LW_EXCLUSIVE);
index 9ce628e62a5c5e12e851e5548d1226b06e945cf1..fe56286d9a972a26a99ef1f776d145b0cdb5bbaf 100644 (file)
@@ -100,8 +100,7 @@ SlruFileName(SlruCtl ctl, char *path, int64 segno)
         * that in the future we can't decrease SLRU_PAGES_PER_SEGMENT easily.
         */
        Assert(segno >= 0 && segno <= INT64CONST(0xFFFFFFFFFFFFFFF));
-       return snprintf(path, MAXPGPATH, "%s/%015llX", ctl->Dir,
-                       (long long) segno);
+       return snprintf(path, MAXPGPATH, "%s/%015" PRIX64, ctl->Dir, segno);
    }
    else
    {
index 14d583ae7ae21f9fcb90e9c7e6c16ac65f9393e4..5ee9d0b028eaefa8ffa552c9c1a693c74874007c 100644 (file)
@@ -869,8 +869,8 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
            if (mainrdata_len > PG_UINT32_MAX)
                ereport(ERROR,
                        (errmsg_internal("too much WAL data"),
-                        errdetail_internal("Main data length is %llu bytes for a maximum of %u bytes.",
-                                           (unsigned long long) mainrdata_len,
+                        errdetail_internal("Main data length is %" PRIu64 " bytes for a maximum of %u bytes.",
+                                           mainrdata_len,
                                            PG_UINT32_MAX)));
 
            mainrdata_len_4b = (uint32) mainrdata_len;
@@ -915,8 +915,8 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
    if (total_len > XLogRecordMaxSize)
        ereport(ERROR,
                (errmsg_internal("oversized WAL record"),
-                errdetail_internal("WAL record would be %llu bytes (of maximum %u bytes); rmid %u flags %u.",
-                                   (unsigned long long) total_len, XLogRecordMaxSize, rmid, info)));
+                errdetail_internal("WAL record would be %" PRIu64 " bytes (of maximum %u bytes); rmid %u flags %u.",
+                                   total_len, XLogRecordMaxSize, rmid, info)));
 
    /*
     * Fill in the fields in the record header. Prev-link is filled in later,
index 5483d4f0dd2b64d40a455fa85dbfd7ff3e41aecc..2790ade1f91e83a951af639564f08d319aade964 100644 (file)
@@ -1272,9 +1272,9 @@ XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr,
            longhdr->xlp_sysid != state->system_identifier)
        {
            report_invalid_record(state,
-                                 "WAL file is from different database system: WAL file database system identifier is %llu, pg_control database system identifier is %llu",
-                                 (unsigned long long) longhdr->xlp_sysid,
-                                 (unsigned long long) state->system_identifier);
+                                 "WAL file is from different database system: WAL file database system identifier is %" PRIu64 ", pg_control database system identifier is %" PRIu64,
+                                 longhdr->xlp_sysid,
+                                 state->system_identifier);
            return false;
        }
        else if (longhdr->xlp_seg_size != state->segcxt.ws_segsize)
index 76a580686658ceac72774f7600992ab0bf537a08..28491b1e0ab08b8c3feb47f25a2ed1c2871c229c 100644 (file)
@@ -949,9 +949,9 @@ manifest_process_system_identifier(JsonManifestParseContext *context,
 
    if (manifest_system_identifier != system_identifier)
        context->error_cb(context,
-                         "system identifier in backup manifest is %llu, but database system identifier is %llu",
-                         (unsigned long long) manifest_system_identifier,
-                         (unsigned long long) system_identifier);
+                         "system identifier in backup manifest is %" PRIu64 ", but database system identifier is %" PRIu64,
+                         manifest_system_identifier,
+                         system_identifier);
 }
 
 /*
index 9811b79d62a4c0e43b67cbb3619e14141efbb5c6..d6dd131da145b59d497b3c477ca1e86f14e21fe6 100644 (file)
@@ -92,7 +92,7 @@ pg_wal_summary_contents(PG_FUNCTION_ARGS)
    if (raw_tli < 1 || raw_tli > PG_INT32_MAX)
        ereport(ERROR,
                errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-               errmsg("invalid timeline %lld", (long long) raw_tli));
+               errmsg("invalid timeline %" PRId64, raw_tli));
 
    /* Prepare to read the specified WAL summary file. */
    ws.tli = (TimeLineID) raw_tli;
index 8436e312d4d2fa978c9789d3aaa716461a92c1a9..a6edf614606ede83cdb44ac6ac6d808af1216ed2 100644 (file)
@@ -474,10 +474,10 @@ GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
            ereport(LOG,
                    (errmsg("still searching for an unused OID in relation \"%s\"",
                            RelationGetRelationName(relation)),
-                    errdetail_plural("OID candidates have been checked %llu time, but no unused OID has been found yet.",
-                                     "OID candidates have been checked %llu times, but no unused OID has been found yet.",
+                    errdetail_plural("OID candidates have been checked %" PRIu64 " time, but no unused OID has been found yet.",
+                                     "OID candidates have been checked %" PRIu64 " times, but no unused OID has been found yet.",
                                      retries,
-                                     (unsigned long long) retries)));
+                                     retries)));
 
            /*
             * Double the number of retries to do before logging next until it
@@ -499,10 +499,10 @@ GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
    if (retries > GETNEWOID_LOG_THRESHOLD)
    {
        ereport(LOG,
-               (errmsg_plural("new OID has been assigned in relation \"%s\" after %llu retry",
-                              "new OID has been assigned in relation \"%s\" after %llu retries",
+               (errmsg_plural("new OID has been assigned in relation \"%s\" after %" PRIu64 " retry",
+                              "new OID has been assigned in relation \"%s\" after %" PRIu64 " retries",
                               retries,
-                              RelationGetRelationName(relation), (unsigned long long) retries)));
+                              RelationGetRelationName(relation), retries)));
    }
 
    return newOid;
index 2b5fbdcbd82b228d2a27102ad0f73e733668d771..ca76c0d2668055e43f9c69798041262f49b7820e 100644 (file)
@@ -827,16 +827,16 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
            }
            appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
                             read_rate, write_rate);
-           appendStringInfo(&buf, _("buffer usage: %lld hits, %lld reads, %lld dirtied\n"),
-                            (long long) total_blks_hit,
-                            (long long) total_blks_read,
-                            (long long) total_blks_dirtied);
+           appendStringInfo(&buf, _("buffer usage: %" PRId64 " hits, %" PRId64 " reads, %" PRId64 " dirtied\n"),
+                            total_blks_hit,
+                            total_blks_read,
+                            total_blks_dirtied);
            appendStringInfo(&buf,
-                            _("WAL usage: %lld records, %lld full page images, %llu bytes, %lld buffers full\n"),
-                            (long long) walusage.wal_records,
-                            (long long) walusage.wal_fpi,
-                            (unsigned long long) walusage.wal_bytes,
-                            (long long) walusage.wal_buffers_full);
+                            _("WAL usage: %" PRId64 " records, %" PRId64 " full page images, %" PRIu64 " bytes, %" PRId64 " buffers full\n"),
+                            walusage.wal_records,
+                            walusage.wal_fpi,
+                            walusage.wal_bytes,
+                            walusage.wal_buffers_full);
            appendStringInfo(&buf, _("system usage: %s"), pg_rusage_show(&ru0));
 
            ereport(verbose ? INFO : LOG,
index cfca9d9dc29d52ad600a920e07b46c3a2845e30d..74ae42b19a710da948a461b506480d38978c64d0 100644 (file)
@@ -443,8 +443,8 @@ defGetCopyRejectLimitOption(DefElem *def)
    if (reject_limit <= 0)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("REJECT_LIMIT (%lld) must be greater than zero",
-                       (long long) reject_limit)));
+                errmsg("REJECT_LIMIT (%" PRId64 ") must be greater than zero",
+                       reject_limit)));
 
    return reject_limit;
 }
index bcf66f0adf89318c0ee88dc2ce4cabb313531449..fbbbc09a97b17aaab735be61b46e3bd9129a3be9 100644 (file)
@@ -265,14 +265,14 @@ CopyFromErrorCallback(void *arg)
    {
        /* can't usefully display the data */
        if (cstate->cur_attname)
-           errcontext("COPY %s, line %llu, column %s",
+           errcontext("COPY %s, line %" PRIu64 ", column %s",
                       cstate->cur_relname,
-                      (unsigned long long) cstate->cur_lineno,
+                      cstate->cur_lineno,
                       cstate->cur_attname);
        else
-           errcontext("COPY %s, line %llu",
+           errcontext("COPY %s, line %" PRIu64,
                       cstate->cur_relname,
-                      (unsigned long long) cstate->cur_lineno);
+                      cstate->cur_lineno);
    }
    else
    {
@@ -282,9 +282,9 @@ CopyFromErrorCallback(void *arg)
            char       *attval;
 
            attval = CopyLimitPrintoutLength(cstate->cur_attval);
-           errcontext("COPY %s, line %llu, column %s: \"%s\"",
+           errcontext("COPY %s, line %" PRIu64 ", column %s: \"%s\"",
                       cstate->cur_relname,
-                      (unsigned long long) cstate->cur_lineno,
+                      cstate->cur_lineno,
                       cstate->cur_attname,
                       attval);
            pfree(attval);
@@ -292,9 +292,9 @@ CopyFromErrorCallback(void *arg)
        else if (cstate->cur_attname)
        {
            /* error is relevant to a particular column, value is NULL */
-           errcontext("COPY %s, line %llu, column %s: null input",
+           errcontext("COPY %s, line %" PRIu64 ", column %s: null input",
                       cstate->cur_relname,
-                      (unsigned long long) cstate->cur_lineno,
+                      cstate->cur_lineno,
                       cstate->cur_attname);
        }
        else
@@ -309,16 +309,16 @@ CopyFromErrorCallback(void *arg)
                char       *lineval;
 
                lineval = CopyLimitPrintoutLength(cstate->line_buf.data);
-               errcontext("COPY %s, line %llu: \"%s\"",
+               errcontext("COPY %s, line %" PRIu64 ": \"%s\"",
                           cstate->cur_relname,
-                          (unsigned long long) cstate->cur_lineno, lineval);
+                          cstate->cur_lineno, lineval);
                pfree(lineval);
            }
            else
            {
-               errcontext("COPY %s, line %llu",
+               errcontext("COPY %s, line %" PRIu64,
                           cstate->cur_relname,
-                          (unsigned long long) cstate->cur_lineno);
+                          cstate->cur_lineno);
            }
        }
    }
@@ -1168,8 +1168,8 @@ CopyFrom(CopyFromState cstate)
                cstate->num_errors > cstate->opts.reject_limit)
                ereport(ERROR,
                        (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
-                        errmsg("skipped more than REJECT_LIMIT (%lld) rows due to data type incompatibility",
-                               (long long) cstate->opts.reject_limit)));
+                        errmsg("skipped more than REJECT_LIMIT (%" PRId64 ") rows due to data type incompatibility",
+                               cstate->opts.reject_limit)));
 
            /* Repeat NextCopyFrom() until no soft error occurs */
            continue;
@@ -1471,10 +1471,10 @@ CopyFrom(CopyFromState cstate)
        cstate->num_errors > 0 &&
        cstate->opts.log_verbosity >= COPY_LOG_VERBOSITY_DEFAULT)
        ereport(NOTICE,
-               errmsg_plural("%llu row was skipped due to data type incompatibility",
-                             "%llu rows were skipped due to data type incompatibility",
-                             (unsigned long long) cstate->num_errors,
-                             (unsigned long long) cstate->num_errors));
+               errmsg_plural("%" PRIu64 " row was skipped due to data type incompatibility",
+                             "%" PRIu64 " rows were skipped due to data type incompatibility",
+                             cstate->num_errors,
+                             cstate->num_errors));
 
    if (bistate != NULL)
        FreeBulkInsertState(bistate);
index e8128f85e6b5dad4df842beb8d6a2413322ced3b..f5fc346e2013bb2332a7521d203eeb1a0ec2f920 100644 (file)
@@ -1053,16 +1053,16 @@ CopyFromTextLikeOneRow(CopyFromState cstate, ExprContext *econtext,
 
                    attval = CopyLimitPrintoutLength(cstate->cur_attval);
                    ereport(NOTICE,
-                           errmsg("skipping row due to data type incompatibility at line %llu for column \"%s\": \"%s\"",
-                                  (unsigned long long) cstate->cur_lineno,
+                           errmsg("skipping row due to data type incompatibility at line %" PRIu64 " for column \"%s\": \"%s\"",
+                                  cstate->cur_lineno,
                                   cstate->cur_attname,
                                   attval));
                    pfree(attval);
                }
                else
                    ereport(NOTICE,
-                           errmsg("skipping row due to data type incompatibility at line %llu for column \"%s\": null input",
-                                  (unsigned long long) cstate->cur_lineno,
+                           errmsg("skipping row due to data type incompatibility at line %" PRIu64 " for column \"%s\": null input",
+                                  cstate->cur_lineno,
                                   cstate->cur_attname));
 
                /* reset relname_only */
index 391b34a2af217ed35328ece6c44bfe4b2b85cd25..ef8aa489af8d23bf76278e95556e26b0ee1cd1f6 100644 (file)
@@ -4126,17 +4126,17 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage)
            {
                appendStringInfoString(es->str, " shared");
                if (usage->shared_blks_hit > 0)
-                   appendStringInfo(es->str, " hit=%lld",
-                                    (long long) usage->shared_blks_hit);
+                   appendStringInfo(es->str, " hit=%" PRId64,
+                                    usage->shared_blks_hit);
                if (usage->shared_blks_read > 0)
-                   appendStringInfo(es->str, " read=%lld",
-                                    (long long) usage->shared_blks_read);
+                   appendStringInfo(es->str, " read=%" PRId64,
+                                    usage->shared_blks_read);
                if (usage->shared_blks_dirtied > 0)
-                   appendStringInfo(es->str, " dirtied=%lld",
-                                    (long long) usage->shared_blks_dirtied);
+                   appendStringInfo(es->str, " dirtied=%" PRId64,
+                                    usage->shared_blks_dirtied);
                if (usage->shared_blks_written > 0)
-                   appendStringInfo(es->str, " written=%lld",
-                                    (long long) usage->shared_blks_written);
+                   appendStringInfo(es->str, " written=%" PRId64,
+                                    usage->shared_blks_written);
                if (has_local || has_temp)
                    appendStringInfoChar(es->str, ',');
            }
@@ -4144,17 +4144,17 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage)
            {
                appendStringInfoString(es->str, " local");
                if (usage->local_blks_hit > 0)
-                   appendStringInfo(es->str, " hit=%lld",
-                                    (long long) usage->local_blks_hit);
+                   appendStringInfo(es->str, " hit=%" PRId64,
+                                    usage->local_blks_hit);
                if (usage->local_blks_read > 0)
-                   appendStringInfo(es->str, " read=%lld",
-                                    (long long) usage->local_blks_read);
+                   appendStringInfo(es->str, " read=%" PRId64,
+                                    usage->local_blks_read);
                if (usage->local_blks_dirtied > 0)
-                   appendStringInfo(es->str, " dirtied=%lld",
-                                    (long long) usage->local_blks_dirtied);
+                   appendStringInfo(es->str, " dirtied=%" PRId64,
+                                    usage->local_blks_dirtied);
                if (usage->local_blks_written > 0)
-                   appendStringInfo(es->str, " written=%lld",
-                                    (long long) usage->local_blks_written);
+                   appendStringInfo(es->str, " written=%" PRId64,
+                                    usage->local_blks_written);
                if (has_temp)
                    appendStringInfoChar(es->str, ',');
            }
@@ -4162,11 +4162,11 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage)
            {
                appendStringInfoString(es->str, " temp");
                if (usage->temp_blks_read > 0)
-                   appendStringInfo(es->str, " read=%lld",
-                                    (long long) usage->temp_blks_read);
+                   appendStringInfo(es->str, " read=%" PRId64,
+                                    usage->temp_blks_read);
                if (usage->temp_blks_written > 0)
-                   appendStringInfo(es->str, " written=%lld",
-                                    (long long) usage->temp_blks_written);
+                   appendStringInfo(es->str, " written=%" PRId64,
+                                    usage->temp_blks_written);
            }
            appendStringInfoChar(es->str, '\n');
        }
@@ -4276,17 +4276,17 @@ show_wal_usage(ExplainState *es, const WalUsage *usage)
            appendStringInfoString(es->str, "WAL:");
 
            if (usage->wal_records > 0)
-               appendStringInfo(es->str, " records=%lld",
-                                (long long) usage->wal_records);
+               appendStringInfo(es->str, " records=%" PRId64,
+                                usage->wal_records);
            if (usage->wal_fpi > 0)
-               appendStringInfo(es->str, " fpi=%lld",
-                                (long long) usage->wal_fpi);
+               appendStringInfo(es->str, " fpi=%" PRId64,
+                                usage->wal_fpi);
            if (usage->wal_bytes > 0)
-               appendStringInfo(es->str, " bytes=" UINT64_FORMAT,
+               appendStringInfo(es->str, " bytes=%" PRIu64,
                                 usage->wal_bytes);
            if (usage->wal_buffers_full > 0)
-               appendStringInfo(es->str, " buffers full=%lld",
-                                (long long) usage->wal_buffers_full);
+               appendStringInfo(es->str, " buffers full=%" PRId64,
+                                usage->wal_buffers_full);
            appendStringInfoChar(es->str, '\n');
        }
    }
index 4b7c5113aabe6773acdd0d086760e15fb60533e2..451ae6f7f69401ff80a8c60157cda8363de2cccc 100644 (file)
@@ -745,9 +745,9 @@ nextval_internal(Oid relid, bool check_permissions)
                if (!cycle)
                    ereport(ERROR,
                            (errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED),
-                            errmsg("nextval: reached maximum value of sequence \"%s\" (%lld)",
+                            errmsg("nextval: reached maximum value of sequence \"%s\" (%" PRId64 ")",
                                    RelationGetRelationName(seqrel),
-                                   (long long) maxv)));
+                                   maxv)));
                next = minv;
            }
            else
@@ -764,9 +764,9 @@ nextval_internal(Oid relid, bool check_permissions)
                if (!cycle)
                    ereport(ERROR,
                            (errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED),
-                            errmsg("nextval: reached minimum value of sequence \"%s\" (%lld)",
+                            errmsg("nextval: reached minimum value of sequence \"%s\" (%" PRId64 ")",
                                    RelationGetRelationName(seqrel),
-                                   (long long) minv)));
+                                   minv)));
                next = maxv;
            }
            else
@@ -988,9 +988,9 @@ do_setval(Oid relid, int64 next, bool iscalled)
    if ((next < minv) || (next > maxv))
        ereport(ERROR,
                (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
-                errmsg("setval: value %lld is out of bounds for sequence \"%s\" (%lld..%lld)",
-                       (long long) next, RelationGetRelationName(seqrel),
-                       (long long) minv, (long long) maxv)));
+                errmsg("setval: value %" PRId64 " is out of bounds for sequence \"%s\" (%" PRId64 "..%" PRId64 ")",
+                       next, RelationGetRelationName(seqrel),
+                       minv, maxv)));
 
    /* Set the currval() state only if iscalled = true */
    if (iscalled)
@@ -1463,8 +1463,8 @@ init_params(ParseState *pstate, List *options, bool for_identity,
        || (seqform->seqtypid == INT4OID && (seqform->seqmax < PG_INT32_MIN || seqform->seqmax > PG_INT32_MAX)))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("MAXVALUE (%lld) is out of range for sequence data type %s",
-                       (long long) seqform->seqmax,
+                errmsg("MAXVALUE (%" PRId64 ") is out of range for sequence data type %s",
+                       seqform->seqmax,
                        format_type_be(seqform->seqtypid))));
 
    /* MINVALUE (null arg means NO MINVALUE) */
@@ -1495,17 +1495,17 @@ init_params(ParseState *pstate, List *options, bool for_identity,
        || (seqform->seqtypid == INT4OID && (seqform->seqmin < PG_INT32_MIN || seqform->seqmin > PG_INT32_MAX)))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("MINVALUE (%lld) is out of range for sequence data type %s",
-                       (long long) seqform->seqmin,
+                errmsg("MINVALUE (%" PRId64 ") is out of range for sequence data type %s",
+                       seqform->seqmin,
                        format_type_be(seqform->seqtypid))));
 
    /* crosscheck min/max */
    if (seqform->seqmin >= seqform->seqmax)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("MINVALUE (%lld) must be less than MAXVALUE (%lld)",
-                       (long long) seqform->seqmin,
-                       (long long) seqform->seqmax)));
+                errmsg("MINVALUE (%" PRId64 ") must be less than MAXVALUE (%" PRId64 ")",
+                       seqform->seqmin,
+                       seqform->seqmax)));
 
    /* START WITH */
    if (start_value != NULL)
@@ -1524,15 +1524,15 @@ init_params(ParseState *pstate, List *options, bool for_identity,
    if (seqform->seqstart < seqform->seqmin)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("START value (%lld) cannot be less than MINVALUE (%lld)",
-                       (long long) seqform->seqstart,
-                       (long long) seqform->seqmin)));
+                errmsg("START value (%" PRId64 ") cannot be less than MINVALUE (%" PRId64 ")",
+                       seqform->seqstart,
+                       seqform->seqmin)));
    if (seqform->seqstart > seqform->seqmax)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("START value (%lld) cannot be greater than MAXVALUE (%lld)",
-                       (long long) seqform->seqstart,
-                       (long long) seqform->seqmax)));
+                errmsg("START value (%" PRId64 ") cannot be greater than MAXVALUE (%" PRId64 ")",
+                       seqform->seqstart,
+                       seqform->seqmax)));
 
    /* RESTART [WITH] */
    if (restart_value != NULL)
@@ -1554,15 +1554,15 @@ init_params(ParseState *pstate, List *options, bool for_identity,
    if (seqdataform->last_value < seqform->seqmin)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("RESTART value (%lld) cannot be less than MINVALUE (%lld)",
-                       (long long) seqdataform->last_value,
-                       (long long) seqform->seqmin)));
+                errmsg("RESTART value (%" PRId64 ") cannot be less than MINVALUE (%" PRId64 ")",
+                       seqdataform->last_value,
+                       seqform->seqmin)));
    if (seqdataform->last_value > seqform->seqmax)
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("RESTART value (%lld) cannot be greater than MAXVALUE (%lld)",
-                       (long long) seqdataform->last_value,
-                       (long long) seqform->seqmax)));
+                errmsg("RESTART value (%" PRId64 ") cannot be greater than MAXVALUE (%" PRId64 ")",
+                       seqdataform->last_value,
+                       seqform->seqmax)));
 
    /* CACHE */
    if (cache_value != NULL)
@@ -1571,8 +1571,8 @@ init_params(ParseState *pstate, List *options, bool for_identity,
        if (seqform->seqcache <= 0)
            ereport(ERROR,
                    (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                    errmsg("CACHE (%lld) must be greater than zero",
-                           (long long) seqform->seqcache)));
+                    errmsg("CACHE (%" PRId64 ") must be greater than zero",
+                           seqform->seqcache)));
        seqdataform->log_cnt = 0;
    }
    else if (isInit)
index f0a7b87808d1bf3a7c053bd4f8fdec764d82dadb..db5da3ce826210da7d9794357cb3d7a5f69efb47 100644 (file)
@@ -2614,9 +2614,9 @@ vac_bulkdel_one_index(IndexVacuumInfo *ivinfo, IndexBulkDeleteResult *istat,
                              dead_items);
 
    ereport(ivinfo->message_level,
-           (errmsg("scanned index \"%s\" to remove %lld row versions",
+           (errmsg("scanned index \"%s\" to remove %" PRId64 " row versions",
                    RelationGetRelationName(ivinfo->index),
-                   (long long) dead_items_info->num_items)));
+                   dead_items_info->num_items)));
 
    return istat;
 }
index 8ea846bfc3b69cbc60670cf3679515832d3d4ad7..a8d2e024d344410167b3eb406c2aff02762fec29 100644 (file)
@@ -1921,16 +1921,16 @@ UpdateDecodingStats(LogicalDecodingContext *ctx)
    if (rb->spillBytes <= 0 && rb->streamBytes <= 0 && rb->totalBytes <= 0)
        return;
 
-   elog(DEBUG2, "UpdateDecodingStats: updating stats %p %lld %lld %lld %lld %lld %lld %lld %lld",
+   elog(DEBUG2, "UpdateDecodingStats: updating stats %p %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64,
         rb,
-        (long long) rb->spillTxns,
-        (long long) rb->spillCount,
-        (long long) rb->spillBytes,
-        (long long) rb->streamTxns,
-        (long long) rb->streamCount,
-        (long long) rb->streamBytes,
-        (long long) rb->totalTxns,
-        (long long) rb->totalBytes);
+        rb->spillTxns,
+        rb->spillCount,
+        rb->spillBytes,
+        rb->streamTxns,
+        rb->streamCount,
+        rb->streamBytes,
+        rb->totalTxns,
+        rb->totalBytes);
 
    repSlotStat.spill_txns = rb->spillTxns;
    repSlotStat.spill_count = rb->spillCount;
index 646ba2a78fa9cab6dc53af7ac75cecd15d481dcb..600b87fa9cb65af8093d298c53c3f50918785052 100644 (file)
@@ -1544,11 +1544,11 @@ ReportSlotInvalidation(ReplicationSlotInvalidationCause cause,
    {
        case RS_INVAL_WAL_REMOVED:
            {
-               unsigned long long ex = oldestLSN - restart_lsn;
+               uint64      ex = oldestLSN - restart_lsn;
 
                appendStringInfo(&err_detail,
-                                ngettext("The slot's restart_lsn %X/%X exceeds the limit by %llu byte.",
-                                         "The slot's restart_lsn %X/%X exceeds the limit by %llu bytes.",
+                                ngettext("The slot's restart_lsn %X/%X exceeds the limit by %" PRIu64 " byte.",
+                                         "The slot's restart_lsn %X/%X exceeds the limit by %" PRIu64 " bytes.",
                                          ex),
                                 LSN_FORMAT_ARGS(restart_lsn),
                                 ex);
index e4d5b944e12fe9f6b6ece5098f5fd90a001de096..567739b5be93a33404d4dc70acac2b500c28c9f4 100644 (file)
@@ -399,8 +399,8 @@ cancel_before_shmem_exit(pg_on_exit_callback function, Datum arg)
        before_shmem_exit_list[before_shmem_exit_index - 1].arg == arg)
        --before_shmem_exit_index;
    else
-       elog(ERROR, "before_shmem_exit callback (%p,0x%llx) is not the latest entry",
-            function, (long long) arg);
+       elog(ERROR, "before_shmem_exit callback (%p,0x%" PRIxPTR ") is not the latest entry",
+            function, arg);
 }
 
 /* ----------------------------------------------------------------
index bebc97ecffd8869ca438eccffc17b6486f2096c8..a3a670ba247417a959af26336b8b18de042b87da 100644 (file)
@@ -215,10 +215,10 @@ pg_wait_until_termination(int pid, int64 timeout)
    } while (remainingtime > 0);
 
    ereport(WARNING,
-           (errmsg_plural("backend with PID %d did not terminate within %lld millisecond",
-                          "backend with PID %d did not terminate within %lld milliseconds",
+           (errmsg_plural("backend with PID %d did not terminate within %" PRId64 " millisecond",
+                          "backend with PID %d did not terminate within %" PRId64 " milliseconds",
                           timeout,
-                          pid, (long long int) timeout)));
+                          pid, timeout)));
 
    return false;
 }
index 40063085073f2635662ec02329a29bb3e5b44ce3..0005021f644b2e96ad97247078de25d5af85500b 100644 (file)
@@ -1679,9 +1679,9 @@ pgstat_write_statsfile(void)
         */
        if (!pgstat_is_kind_valid(ps->key.kind))
        {
-           elog(WARNING, "found unknown stats entry %u/%u/%llu",
+           elog(WARNING, "found unknown stats entry %u/%u/%" PRIu64,
                 ps->key.kind, ps->key.dboid,
-                (unsigned long long) ps->key.objid);
+                ps->key.objid);
            continue;
        }
 
@@ -1903,9 +1903,9 @@ pgstat_read_statsfile(void)
 
                        if (!pgstat_is_kind_valid(key.kind))
                        {
-                           elog(WARNING, "invalid stats kind for entry %u/%u/%llu of type %c",
+                           elog(WARNING, "invalid stats kind for entry %u/%u/%" PRIu64 " of type %c",
                                 key.kind, key.dboid,
-                                (unsigned long long) key.objid, t);
+                                key.objid, t);
                            goto error;
                        }
                    }
@@ -1976,9 +1976,9 @@ pgstat_read_statsfile(void)
                    if (found)
                    {
                        dshash_release_lock(pgStatLocal.shared_hash, p);
-                       elog(WARNING, "found duplicate stats entry %u/%u/%llu of type %c",
+                       elog(WARNING, "found duplicate stats entry %u/%u/%" PRIu64 " of type %c",
                             key.kind, key.dboid,
-                            (unsigned long long) key.objid, t);
+                            key.objid, t);
                        goto error;
                    }
 
@@ -1989,9 +1989,9 @@ pgstat_read_statsfile(void)
                                    pgstat_get_entry_data(key.kind, header),
                                    pgstat_get_entry_len(key.kind)))
                    {
-                       elog(WARNING, "could not read data for entry %u/%u/%llu of type %c",
+                       elog(WARNING, "could not read data for entry %u/%u/%" PRIu64 " of type %c",
                             key.kind, key.dboid,
-                            (unsigned long long) key.objid, t);
+                            key.objid, t);
                        goto error;
                    }
 
index cd56cb328610337cbf1353d71f32f41e400608c0..ccfb11c49bf82793180ca1f031ab54d1eb1ba2e3 100644 (file)
@@ -194,8 +194,8 @@ pgstat_replslot_to_serialized_name_cb(const PgStat_HashKey *key, const PgStatSha
     * at the offset.
     */
    if (!ReplicationSlotName(key->objid, name))
-       elog(ERROR, "could not find name for replication slot index %llu",
-            (unsigned long long) key->objid);
+       elog(ERROR, "could not find name for replication slot index %" PRIu64,
+            key->objid);
 }
 
 bool
index 770d62425c5dc65ecb883b1e59cec87c076cead3..5cd243037551ce7ca954a2702f22863121321f44 100644 (file)
@@ -864,10 +864,10 @@ pgstat_drop_entry_internal(PgStatShared_HashEntry *shent,
     */
    if (shent->dropped)
        elog(ERROR,
-            "trying to drop stats entry already dropped: kind=%s dboid=%u objid=%llu refcount=%u",
+            "trying to drop stats entry already dropped: kind=%s dboid=%u objid=%" PRIu64 " refcount=%u",
             pgstat_get_kind_info(shent->key.kind)->name,
             shent->key.dboid,
-            (unsigned long long) shent->key.objid,
+            shent->key.objid,
             pg_atomic_read_u32(&shent->refcount));
    shent->dropped = true;
 
index 76a4f24aa82b1a5d0ec6f05b1d9f4e35de7db5ce..bc9864bd8d9d0abc732bbf8bcff6460b0c79b816 100644 (file)
@@ -363,9 +363,9 @@ pgstat_create_transactional(PgStat_Kind kind, Oid dboid, uint64 objid)
    if (pgstat_get_entry_ref(kind, dboid, objid, false, NULL))
    {
        ereport(WARNING,
-               errmsg("resetting existing statistics for kind %s, db=%u, oid=%llu",
+               errmsg("resetting existing statistics for kind %s, db=%u, oid=%" PRIu64,
                       (pgstat_get_kind_info(kind))->name, dboid,
-                      (unsigned long long) objid));
+                      objid));
 
        pgstat_reset(kind, dboid, objid);
    }
index 5d893cff50c8fd18235a05931c60636ea6bbaa4a..793d8a9adccdc43de22f1e9148d76d093f30c0f8 100644 (file)
@@ -4630,7 +4630,7 @@ AddISO8601IntPart(char *cp, int64 value, char units)
 {
    if (value == 0)
        return cp;
-   sprintf(cp, "%lld%c", (long long) value, units);
+   sprintf(cp, "%" PRId64 "%c", value, units);
    return cp + strlen(cp);
 }
 
@@ -4641,10 +4641,10 @@ AddPostgresIntPart(char *cp, int64 value, const char *units,
 {
    if (value == 0)
        return cp;
-   sprintf(cp, "%s%s%lld %s%s",
+   sprintf(cp, "%s%s%" PRId64 " %s%s",
            (!*is_zero) ? " " : "",
            (*is_before && value > 0) ? "+" : "",
-           (long long) value,
+           value,
            units,
            (value != 1) ? "s" : "");
 
@@ -4672,7 +4672,7 @@ AddVerboseIntPart(char *cp, int64 value, const char *units,
    }
    else if (*is_before)
        value = -value;
-   sprintf(cp, " %lld %s%s", (long long) value, units, (value == 1) ? "" : "s");
+   sprintf(cp, " %" PRId64 " %s%s", value, units, (value == 1) ? "" : "s");
    *is_zero = false;
    return cp + strlen(cp);
 }
@@ -4767,10 +4767,10 @@ EncodeInterval(struct pg_itm *itm, int style, char *str)
                    char        sec_sign = (hour < 0 || min < 0 ||
                                            sec < 0 || fsec < 0) ? '-' : '+';
 
-                   sprintf(cp, "%c%d-%d %c%lld %c%lld:%02d:",
+                   sprintf(cp, "%c%d-%d %c%" PRId64 " %c%" PRId64 ":%02d:",
                            year_sign, abs(year), abs(mon),
-                           day_sign, (long long) i64abs(mday),
-                           sec_sign, (long long) i64abs(hour), abs(min));
+                           day_sign, i64abs(mday),
+                           sec_sign, i64abs(hour), abs(min));
                    cp += strlen(cp);
                    cp = AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, true);
                    *cp = '\0';
@@ -4781,15 +4781,15 @@ EncodeInterval(struct pg_itm *itm, int style, char *str)
                }
                else if (has_day)
                {
-                   sprintf(cp, "%lld %lld:%02d:",
-                           (long long) mday, (long long) hour, min);
+                   sprintf(cp, "%" PRId64 " %" PRId64 ":%02d:",
+                           mday, hour, min);
                    cp += strlen(cp);
                    cp = AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, true);
                    *cp = '\0';
                }
                else
                {
-                   sprintf(cp, "%lld:%02d:", (long long) hour, min);
+                   sprintf(cp, "%" PRId64 ":%02d:", hour, min);
                    cp += strlen(cp);
                    cp = AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, true);
                    *cp = '\0';
@@ -4839,10 +4839,10 @@ EncodeInterval(struct pg_itm *itm, int style, char *str)
            {
                bool        minus = (hour < 0 || min < 0 || sec < 0 || fsec < 0);
 
-               sprintf(cp, "%s%s%02lld:%02d:",
+               sprintf(cp, "%s%s%02" PRId64 ":%02d:",
                        is_zero ? "" : " ",
                        (minus ? "-" : (is_before ? "+" : "")),
-                       (long long) i64abs(hour), abs(min));
+                       i64abs(hour), abs(min));
                cp += strlen(cp);
                cp = AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, true);
                *cp = '\0';
index 95631eb209941506155b5484b56e7b7f31e7361a..3e4d5568bde895af4214a7e3a8c200ad1bbaafbd 100644 (file)
@@ -3296,8 +3296,8 @@ byteaGetBit(PG_FUNCTION_ARGS)
    if (n < 0 || n >= (int64) len * 8)
        ereport(ERROR,
                (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
-                errmsg("index %lld out of valid range, 0..%lld",
-                       (long long) n, (long long) len * 8 - 1)));
+                errmsg("index %" PRId64 " out of valid range, 0..%" PRId64,
+                       n, (int64) len * 8 - 1)));
 
    /* n/8 is now known < len, so safe to cast to int */
    byteNo = (int) (n / 8);
@@ -3368,8 +3368,8 @@ byteaSetBit(PG_FUNCTION_ARGS)
    if (n < 0 || n >= (int64) len * 8)
        ereport(ERROR,
                (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
-                errmsg("index %lld out of valid range, 0..%lld",
-                       (long long) n, (long long) len * 8 - 1)));
+                errmsg("index %" PRId64 " out of valid range, 0..%" PRId64,
+                       n, (int64) len * 8 - 1)));
 
    /* n/8 is now known < len, so safe to cast to int */
    byteNo = (int) (n / 8);
index 88d798fbf4bc5522215c11fb768cbd7423ac2df1..1da3964ca6fb88084cfa10e773df94c9e64d8cf7 100644 (file)
@@ -117,8 +117,8 @@ TransactionIdInRecentPast(FullTransactionId fxid, TransactionId *extracted_xid)
    if (!FullTransactionIdPrecedes(fxid, now_fullxid))
        ereport(ERROR,
                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                errmsg("transaction ID %llu is in the future",
-                       (unsigned long long) U64FromFullTransactionId(fxid))));
+                errmsg("transaction ID %" PRIu64 " is in the future",
+                       U64FromFullTransactionId(fxid))));
 
    /*
     * TransamVariables->oldestClogXid is protected by XactTruncationLock, but
index 8e9fbcb999b6ee9d90e3ffa85833b7424b873132..fdac3c048e36a99143d46558ffc5f8db7f1d2b20 100644 (file)
@@ -248,7 +248,7 @@ write_csvlog(ErrorData *edata)
    appendStringInfoChar(&buf, ',');
 
    /* query id */
-   appendStringInfo(&buf, "%lld", (long long) pgstat_get_my_query_id());
+   appendStringInfo(&buf, "%" PRId64, pgstat_get_my_query_id());
 
    appendStringInfoChar(&buf, '\n');
 
index b891dab3bf64569bd71bbd3c9bd61fc4e4de2ca7..97014c1a5a5caa5e691985ca14e57794dcd3f703 100644 (file)
@@ -3152,11 +3152,11 @@ log_status_format(StringInfo buf, const char *format, ErrorData *edata)
                break;
            case 'Q':
                if (padding != 0)
-                   appendStringInfo(buf, "%*lld", padding,
-                                    (long long) pgstat_get_my_query_id());
+                   appendStringInfo(buf, "%*" PRId64, padding,
+                                    pgstat_get_my_query_id());
                else
-                   appendStringInfo(buf, "%lld",
-                                    (long long) pgstat_get_my_query_id());
+                   appendStringInfo(buf, "%" PRId64,
+                                    pgstat_get_my_query_id());
                break;
            default:
                /* format error - ignore it */
index 549e0f48ee82b82b4abc789167c18088a3820342..519eacf17f83cf9dafb0f311cbb9bdbcfd1b9974 100644 (file)
@@ -284,8 +284,8 @@ write_jsonlog(ErrorData *edata)
    }
 
    /* query id */
-   appendJSONKeyValueFmt(&buf, "query_id", false, "%lld",
-                         (long long) pgstat_get_my_query_id());
+   appendJSONKeyValueFmt(&buf, "query_id", false, "%" PRId64,
+                         pgstat_get_my_query_id());
 
    /* Finish string */
    appendStringInfoChar(&buf, '}');
index 91060de0ab7a81c370abe0e55a45c4f567f75c27..d98ae9db6beceb79f24e090bcd676c8b02b3ac28 100644 (file)
@@ -285,31 +285,31 @@ MemoryContextTraverseNext(MemoryContext curr, MemoryContext top)
 static void
 BogusFree(void *pointer)
 {
-   elog(ERROR, "pfree called with invalid pointer %p (header 0x%016llx)",
-        pointer, (unsigned long long) GetMemoryChunkHeader(pointer));
+   elog(ERROR, "pfree called with invalid pointer %p (header 0x%016" PRIx64 ")",
+        pointer, GetMemoryChunkHeader(pointer));
 }
 
 static void *
 BogusRealloc(void *pointer, Size size, int flags)
 {
-   elog(ERROR, "repalloc called with invalid pointer %p (header 0x%016llx)",
-        pointer, (unsigned long long) GetMemoryChunkHeader(pointer));
+   elog(ERROR, "repalloc called with invalid pointer %p (header 0x%016" PRIx64 ")",
+        pointer, GetMemoryChunkHeader(pointer));
    return NULL;                /* keep compiler quiet */
 }
 
 static MemoryContext
 BogusGetChunkContext(void *pointer)
 {
-   elog(ERROR, "GetMemoryChunkContext called with invalid pointer %p (header 0x%016llx)",
-        pointer, (unsigned long long) GetMemoryChunkHeader(pointer));
+   elog(ERROR, "GetMemoryChunkContext called with invalid pointer %p (header 0x%016" PRIx64 ")",
+        pointer, GetMemoryChunkHeader(pointer));
    return NULL;                /* keep compiler quiet */
 }
 
 static Size
 BogusGetChunkSpace(void *pointer)
 {
-   elog(ERROR, "GetMemoryChunkSpace called with invalid pointer %p (header 0x%016llx)",
-        pointer, (unsigned long long) GetMemoryChunkHeader(pointer));
+   elog(ERROR, "GetMemoryChunkSpace called with invalid pointer %p (header 0x%016" PRIx64 ")",
+        pointer, GetMemoryChunkHeader(pointer));
    return 0;                   /* keep compiler quiet */
 }
 
index 47e601ef62c8c5423c05b6cced2ed52ccf234dd5..e529ceb8260bb0ab0252560a80f63b0e580ef3a7 100644 (file)
@@ -263,8 +263,8 @@ ltsWriteBlock(LogicalTapeSet *lts, int64 blocknum, const void *buffer)
    if (BufFileSeekBlock(lts->pfile, blocknum) != 0)
        ereport(ERROR,
                (errcode_for_file_access(),
-                errmsg("could not seek to block %lld of temporary file",
-                       (long long) blocknum)));
+                errmsg("could not seek to block %" PRId64 " of temporary file",
+                       blocknum)));
    BufFileWrite(lts->pfile, buffer, BLCKSZ);
 
    /* Update nBlocksWritten, if we extended the file */
@@ -284,8 +284,8 @@ ltsReadBlock(LogicalTapeSet *lts, int64 blocknum, void *buffer)
    if (BufFileSeekBlock(lts->pfile, blocknum) != 0)
        ereport(ERROR,
                (errcode_for_file_access(),
-                errmsg("could not seek to block %lld of temporary file",
-                       (long long) blocknum)));
+                errmsg("could not seek to block %" PRId64 " of temporary file",
+                       blocknum)));
    BufFileReadExact(lts->pfile, buffer, BLCKSZ);
 }
 
@@ -1100,10 +1100,10 @@ LogicalTapeBackspace(LogicalTape *lt, size_t size)
        ltsReadBlock(lt->tapeSet, prev, lt->buffer);
 
        if (TapeBlockGetTrailer(lt->buffer)->next != lt->curBlockNumber)
-           elog(ERROR, "broken tape, next of block %lld is %lld, expected %lld",
-                (long long) prev,
-                (long long) (TapeBlockGetTrailer(lt->buffer)->next),
-                (long long) lt->curBlockNumber);
+           elog(ERROR, "broken tape, next of block %" PRId64 " is %" PRId64 ", expected %" PRId64,
+                prev,
+                TapeBlockGetTrailer(lt->buffer)->next,
+                lt->curBlockNumber);
 
        lt->nbytes = TapeBlockPayloadSize;
        lt->curBlockNumber = prev;
index 2ef32d53a43e45faf0da49509cf8022ccd4c3457..65ab83fff8b2647dff0d5bb6547fbf57e545bae0 100644 (file)
@@ -918,13 +918,13 @@ tuplesort_free(Tuplesortstate *state)
    if (trace_sort)
    {
        if (state->tapeset)
-           elog(LOG, "%s of worker %d ended, %lld disk blocks used: %s",
+           elog(LOG, "%s of worker %d ended, %" PRId64 " disk blocks used: %s",
                 SERIAL(state) ? "external sort" : "parallel external sort",
-                state->worker, (long long) spaceUsed, pg_rusage_show(&state->ru_start));
+                state->worker, spaceUsed, pg_rusage_show(&state->ru_start));
        else
-           elog(LOG, "%s of worker %d ended, %lld KB used: %s",
+           elog(LOG, "%s of worker %d ended, %" PRId64 " KB used: %s",
                 SERIAL(state) ? "internal sort" : "unperformed parallel sort",
-                state->worker, (long long) spaceUsed, pg_rusage_show(&state->ru_start));
+                state->worker, spaceUsed, pg_rusage_show(&state->ru_start));
    }
 
    TRACE_POSTGRESQL_SORT_DONE(state->tapeset != NULL, spaceUsed);
index 443760d5ba8e3266e7da0e8f550cb80e9aca98bf..eed3793c8168b20db3e2ca8e6766e15a0ae9070b 100644 (file)
@@ -614,8 +614,7 @@ get_primary_sysid(const char *conninfo)
 
    sysid = strtou64(PQgetvalue(res, 0, 0), NULL, 10);
 
-   pg_log_info("system identifier is %llu on publisher",
-               (unsigned long long) sysid);
+   pg_log_info("system identifier is %" PRIu64 " on publisher", sysid);
 
    PQclear(res);
    disconnect_database(conn, false);
@@ -643,8 +642,7 @@ get_standby_sysid(const char *datadir)
 
    sysid = cf->system_identifier;
 
-   pg_log_info("system identifier is %llu on subscriber",
-               (unsigned long long) sysid);
+   pg_log_info("system identifier is %" PRIu64 " on subscriber", sysid);
 
    pg_free(cf);
 
@@ -684,8 +682,8 @@ modify_subscriber_sysid(const struct CreateSubscriberOptions *opt)
    if (!dry_run)
        update_controlfile(subscriber_dir, cf, true);
 
-   pg_log_info("system identifier is %llu on subscriber",
-               (unsigned long long) cf->system_identifier);
+   pg_log_info("system identifier is %" PRIu64 " on subscriber",
+               cf->system_identifier);
 
    pg_log_info("running pg_resetwal on the subscriber");
 
index 050260ee832a4158a489bd0a705724f1b6ae5d03..d61bde42f498b9ca8d472d082cdca22da2734eb8 100644 (file)
@@ -302,10 +302,10 @@ main(int argc, char *argv[])
 
            controlpath = psprintf("%s/%s", prior_backup_dirs[i], "global/pg_control");
 
-           pg_fatal("%s: manifest system identifier is %llu, but control file has %llu",
+           pg_fatal("%s: manifest system identifier is %" PRIu64 ", but control file has %" PRIu64,
                     controlpath,
-                    (unsigned long long) manifests[i]->system_identifier,
-                    (unsigned long long) system_identifier);
+                    manifests[i]->system_identifier,
+                    system_identifier);
        }
    }
 
@@ -631,9 +631,9 @@ check_control_files(int n_backups, char **backup_dirs)
        if (i == n_backups - 1)
            system_identifier = control_file->system_identifier;
        else if (system_identifier != control_file->system_identifier)
-           pg_fatal("%s: expected system identifier %llu, but found %llu",
-                    controlpath, (unsigned long long) system_identifier,
-                    (unsigned long long) control_file->system_identifier);
+           pg_fatal("%s: expected system identifier %" PRIu64 ", but found %" PRIu64,
+                    controlpath, system_identifier,
+                    control_file->system_identifier);
 
        /*
         * Detect checksum mismatches, but only if the last backup in the
@@ -654,8 +654,7 @@ check_control_files(int n_backups, char **backup_dirs)
     * If debug output is enabled, make a note of the system identifier that
     * we found in all of the relevant control files.
     */
-   pg_log_debug("system identifier is %llu",
-                (unsigned long long) system_identifier);
+   pg_log_debug("system identifier is %" PRIu64, system_identifier);
 
    /*
     * Warn the user if not all backups are in the same state with regards to
index 44879b3f3e877797b57baaf9d24619b9b1d8be98..313f8929df509e07cc707a518beb7a1e3eff125b 100644 (file)
@@ -104,8 +104,7 @@ add_file_to_manifest(manifest_writer *mwriter, const char *manifest_path,
        appendStringInfoString(&mwriter->buf, "\", ");
    }
 
-   appendStringInfo(&mwriter->buf, "\"Size\": %llu, ",
-                    (unsigned long long) size);
+   appendStringInfo(&mwriter->buf, "\"Size\": %" PRIu64 ", ", size);
 
    appendStringInfoString(&mwriter->buf, "\"Last-Modified\": \"");
    enlargeStringInfo(&mwriter->buf, 128);
index bea779eef940db47c02df6165e1bcbe2b7f246b4..9901a2bae51c93ebf766ee6abe623bfb05dcad25 100644 (file)
@@ -239,8 +239,8 @@ main(int argc, char *argv[])
           ControlFile->pg_control_version);
    printf(_("Catalog version number:               %u\n"),
           ControlFile->catalog_version_no);
-   printf(_("Database system identifier:           %llu\n"),
-          (unsigned long long) ControlFile->system_identifier);
+   printf(_("Database system identifier:           %" PRIu64 "\n"),
+          ControlFile->system_identifier);
    printf(_("Database cluster state:               %s\n"),
           dbState(ControlFile->state));
    printf(_("pg_control last modified:             %s\n"),
index 31bc0abff16a87e9e3cb16ada6ca44f0a4f124d4..2ae3702efba18c3f9e5deed2167fee76ab991667 100644 (file)
@@ -746,8 +746,8 @@ PrintControlValues(bool guessed)
           ControlFile.pg_control_version);
    printf(_("Catalog version number:               %u\n"),
           ControlFile.catalog_version_no);
-   printf(_("Database system identifier:           %llu\n"),
-          (unsigned long long) ControlFile.system_identifier);
+   printf(_("Database system identifier:           %" PRIu64 "\n"),
+          ControlFile.system_identifier);
    printf(_("Latest checkpoint's TimeLineID:       %u\n"),
           ControlFile.checkPointCopy.ThisTimeLineID);
    printf(_("Latest checkpoint's full_page_writes: %s\n"),
index d171839effe740d324d853df39abcdca39c7e95b..56c2ad55d4a6701f4d6924191a42d3d3fa948a61 100644 (file)
@@ -567,8 +567,8 @@ process_queued_fetch_requests(libpq_source *src)
        }
        else
        {
-           pg_log_debug("received chunk for file \"%s\", offset %lld, size %d",
-                        filename, (long long int) chunkoff, chunksize);
+           pg_log_debug("received chunk for file \"%s\", offset %" PRId64 ", size %d",
+                        filename, chunkoff, chunksize);
 
            if (strcmp(filename, rq->path) != 0)
            {
@@ -576,8 +576,8 @@ process_queued_fetch_requests(libpq_source *src)
                         filename, rq->path);
            }
            if (chunkoff != rq->offset)
-               pg_fatal("received data at offset %lld of file \"%s\", when requested for offset %lld",
-                        (long long int) chunkoff, rq->path, (long long int) rq->offset);
+               pg_fatal("received data at offset %" PRId64 " of file \"%s\", when requested for offset %lld",
+                        chunkoff, rq->path, (long long int) rq->offset);
 
            /*
             * We should not receive more data than we requested, or
index 6c3a132ea3a65f6aa4efb5de5ffec7aa1dd23ade..079c3970410ab204a308168f48ff09e7e6e485c1 100644 (file)
@@ -207,11 +207,11 @@ member_verify_header(astreamer *streamer, astreamer_member *member)
    if (m->size != member->size)
    {
        report_backup_error(mystreamer->context,
-                           "\"%s\" has size %llu in \"%s\" but size %llu in the manifest",
+                           "\"%s\" has size %llu in \"%s\" but size %" PRIu64 " in the manifest",
                            member->pathname,
                            (unsigned long long) member->size,
                            mystreamer->archive_name,
-                           (unsigned long long) m->size);
+                           m->size);
        m->bad = true;
        return;
    }
@@ -296,10 +296,10 @@ member_verify_checksum(astreamer *streamer)
    if (mystreamer->checksum_bytes != m->size)
    {
        report_backup_error(mystreamer->context,
-                           "file \"%s\" in \"%s\" should contain %llu bytes, but read %llu bytes",
+                           "file \"%s\" in \"%s\" should contain %" PRIu64 " bytes, but read %" PRIu64 " bytes",
                            m->pathname, mystreamer->archive_name,
-                           (unsigned long long) m->size,
-                           (unsigned long long) mystreamer->checksum_bytes);
+                           m->size,
+                           mystreamer->checksum_bytes);
        return;
    }
 
@@ -408,11 +408,11 @@ member_verify_control_data(astreamer *streamer)
    /* System identifiers should match. */
    if (manifest->system_identifier !=
        mystreamer->control_file.system_identifier)
-       report_fatal_error("%s: %s: manifest system identifier is %llu, but control file has %llu",
+       report_fatal_error("%s: %s: manifest system identifier is %" PRIu64 ", but control file has %" PRIu64,
                           mystreamer->archive_name,
                           mystreamer->mfile->pathname,
-                          (unsigned long long) manifest->system_identifier,
-                          (unsigned long long) mystreamer->control_file.system_identifier);
+                          manifest->system_identifier,
+                          mystreamer->control_file.system_identifier);
 }
 
 /*
index 84edd2cdca5cd07450fdc5005e6b034a48baa1db..383668a8b6a50edf20fdeeec2fd87dce3e18b419 100644 (file)
@@ -770,10 +770,10 @@ verify_control_file(const char *controlpath, uint64 manifest_system_identifier)
 
    /* System identifiers should match. */
    if (manifest_system_identifier != control_file->system_identifier)
-       report_fatal_error("%s: manifest system identifier is %llu, but control file has %llu",
+       report_fatal_error("%s: manifest system identifier is %" PRIu64 ", but control file has %" PRIu64,
                           controlpath,
-                          (unsigned long long) manifest_system_identifier,
-                          (unsigned long long) control_file->system_identifier);
+                          manifest_system_identifier,
+                          control_file->system_identifier);
 
    /* Release memory. */
    pfree(control_file);
@@ -1165,9 +1165,8 @@ verify_file_checksum(verifier_context *context, manifest_file *m,
    if (bytes_read != m->size)
    {
        report_backup_error(context,
-                           "file \"%s\" should contain %llu bytes, but read %llu bytes",
-                           relpath, (unsigned long long) m->size,
-                           (unsigned long long) bytes_read);
+                           "file \"%s\" should contain %" PRIu64 " bytes, but read %" PRIu64,
+                           relpath, m->size, bytes_read);
        return;
    }
 
index 5e5e54e1b7531291d6a42265e4a08b5c68d75c13..28d5bb0bd5d71f4fb30c19756e6cd9a8046d7c66 100644 (file)
@@ -3185,9 +3185,9 @@ printTableInit(printTableContent *const content, const printTableOpt *opt,
    /* Catch possible overflow.  Using >= here allows adding 1 below */
    if (total_cells >= SIZE_MAX / sizeof(*content->cells))
    {
-       fprintf(stderr, _("Cannot print table contents: number of cells %lld is equal to or exceeds maximum %lld.\n"),
-               (long long int) total_cells,
-               (long long int) (SIZE_MAX / sizeof(*content->cells)));
+       fprintf(stderr, _("Cannot print table contents: number of cells %" PRId64 " is equal to or exceeds maximum %zu.\n"),
+               total_cells,
+               SIZE_MAX / sizeof(*content->cells));
        exit(EXIT_FAILURE);
    }
    content->cells = pg_malloc0((total_cells + 1) * sizeof(*content->cells));
@@ -3269,8 +3269,8 @@ printTableAddCell(printTableContent *const content, char *cell,
    total_cells = (uint64) content->ncolumns * content->nrows;
    if (content->cellsadded >= total_cells)
    {
-       fprintf(stderr, _("Cannot add cell to table content: total cell count of %lld exceeded.\n"),
-               (long long int) total_cells);
+       fprintf(stderr, _("Cannot add cell to table content: total cell count of %" PRId64 " exceeded.\n"),
+               total_cells);
        exit(EXIT_FAILURE);
    }
 
index f0abb0df389fc64d9ce316043c0d9285099b270d..a75b77270c4e68d1303aecc3c1033fa8e398c952 100644 (file)
@@ -2754,7 +2754,7 @@ RT_SCOPE void
 RT_STATS(RT_RADIX_TREE * tree)
 {
    fprintf(stderr, "max_val = " UINT64_FORMAT "\n", tree->ctl->max_val);
-   fprintf(stderr, "num_keys = %lld\n", (long long) tree->ctl->num_keys);
+   fprintf(stderr, "num_keys = %" PRId64 "\n", tree->ctl->num_keys);
 
 #ifdef RT_SHMEM
    fprintf(stderr, "handle = " DSA_POINTER_FORMAT "\n", tree->ctl->handle);
@@ -2766,10 +2766,10 @@ RT_STATS(RT_RADIX_TREE * tree)
    {
        RT_SIZE_CLASS_ELEM size_class = RT_SIZE_CLASS_INFO[i];
 
-       fprintf(stderr, ", n%d = %lld", size_class.fanout, (long long) tree->ctl->num_nodes[i]);
+       fprintf(stderr, ", n%d = %" PRId64, size_class.fanout, tree->ctl->num_nodes[i]);
    }
 
-   fprintf(stderr, ", leaves = %lld", (long long) tree->ctl->num_leaves);
+   fprintf(stderr, ", leaves = %" PRId64, tree->ctl->num_leaves);
 
    fprintf(stderr, "\n");
 }
index a83fdbd7cd876a798daf45c5416b97c42246c94f..41113a8acdcff9e9cb7110baa8e9d4087bb9b638 100644 (file)
@@ -42,8 +42,8 @@ test_copy_to_callback(PG_FUNCTION_ARGS)
    processed = DoCopyTo(cstate);
    EndCopyTo(cstate);
 
-   ereport(NOTICE, (errmsg("COPY TO callback has processed %lld rows",
-                           (long long) processed)));
+   ereport(NOTICE, (errmsg("COPY TO callback has processed %" PRId64 " rows",
+                           processed)));
 
    table_close(rel, NoLock);
 
index 3ea5ceb8552e8809f310a83367de373f5f8b9011..2e4492900afbc48ea5008b41da7811e67fe7fc6b 100644 (file)
@@ -151,8 +151,8 @@ test_slru_page_sync(PG_FUNCTION_ARGS)
    ftag.segno = pageno / SLRU_PAGES_PER_SEGMENT;
    SlruSyncFileTag(TestSlruCtl, &ftag, path);
 
-   elog(NOTICE, "Called SlruSyncFileTag() for segment %lld on path %s",
-        (long long) ftag.segno, path);
+   elog(NOTICE, "Called SlruSyncFileTag() for segment %" PRId64 " on path %s",
+        ftag.segno, path);
 
    PG_RETURN_VOID();
 }
@@ -166,8 +166,8 @@ test_slru_page_delete(PG_FUNCTION_ARGS)
    ftag.segno = pageno / SLRU_PAGES_PER_SEGMENT;
    SlruDeleteSegment(TestSlruCtl, ftag.segno);
 
-   elog(NOTICE, "Called SlruDeleteSegment() for segment %lld",
-        (long long) ftag.segno);
+   elog(NOTICE, "Called SlruDeleteSegment() for segment %" PRId64,
+        ftag.segno);
 
    PG_RETURN_VOID();
 }
index af2144d9bebb0e2180d0d44ae5717d0bbb6f18f3..e27a5fa576954936387e74aebdb59ee78aac96d9 100644 (file)
@@ -35,7 +35,7 @@ consume_xids(PG_FUNCTION_ARGS)
    FullTransactionId lastxid;
 
    if (nxids < 0)
-       elog(ERROR, "invalid nxids argument: %lld", (long long) nxids);
+       elog(ERROR, "invalid nxids argument: %" PRId64, nxids);
 
    if (nxids == 0)
        lastxid = ReadNextFullTransactionId();
@@ -56,8 +56,8 @@ consume_xids_until(PG_FUNCTION_ARGS)
    FullTransactionId lastxid;
 
    if (!FullTransactionIdIsNormal(targetxid))
-       elog(ERROR, "targetxid %llu is not normal",
-            (unsigned long long) U64FromFullTransactionId(targetxid));
+       elog(ERROR, "targetxid %" PRIu64 " is not normal",
+            U64FromFullTransactionId(targetxid));
 
    lastxid = consume_xids_common(targetxid, 0);
 
@@ -136,8 +136,8 @@ consume_xids_common(FullTransactionId untilxid, uint64 nxids)
        if (consumed - last_reported_at >= REPORT_INTERVAL)
        {
            if (nxids > 0)
-               elog(NOTICE, "consumed %llu / %llu XIDs, latest %u:%u",
-                    (unsigned long long) consumed, (unsigned long long) nxids,
+               elog(NOTICE, "consumed %" PRIu64 " / %" PRIu64 " XIDs, latest %u:%u",
+                    consumed, nxids,
                     EpochFromFullTransactionId(lastxid),
                     XidFromFullTransactionId(lastxid));
            else