mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Use PRI?64 instead of "ll?" in format strings (continued).
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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, '}');
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user