agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Subject: [PATCH] Fix translation of pg_controldata's NextOID output
Date: Mon, 14 Sep 2026 12:34:35 +0900
xgettext does not recognize OID8_FORMAT and therefore extracts an
incomplete message. Use PRIu64 instead, and document that the *_FORMAT
macros should not be used in translatable strings.
---
src/bin/pg_controldata/pg_controldata.c | 4 ++--
src/include/c.h | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index b785f7f4070..7011adeeb87 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -269,8 +269,8 @@ main(int argc, char *argv[])
printf(_("Latest checkpoint's NextXID: %u:%u\n"),
EpochFromFullTransactionId(ControlFile->checkPointCopy.nextXid),
XidFromFullTransactionId(ControlFile->checkPointCopy.nextXid));
- printf(_("Latest checkpoint's NextOID: " OID8_FORMAT "\n"),
- ControlFile->checkPointCopy.nextOid);
+ /* Use PRIu64 because xgettext does not recognize OID8_FORMAT. */
+ printf(_("Latest checkpoint's NextOID: %" PRIu64 "\n"),
printf(_("Latest checkpoint's NextMultiXactId: %u\n"),
ControlFile->checkPointCopy.nextMulti);
printf(_("Latest checkpoint's NextMultiOffset: %" PRIu64 "\n"),
diff --git a/src/include/c.h b/src/include/c.h
index 20cfbac54e7..219346e8fae 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -689,7 +689,12 @@ typedef uint64_t uint64;
#define INT64CONST(x) INT64_C(x)
#define UINT64CONST(x) UINT64_C(x)
-/* snprintf format strings to use for 64-bit integers */
+/*
+ * snprintf format strings to use for 64-bit integers
+ * xgettext does not recognize these macros, resulting in incomplete
+ * msgids in PO files. Use the corresponding PRI* macros directly in
+ * translatable strings instead.
+ */
#define INT64_FORMAT "%" PRId64
#define UINT64_FORMAT "%" PRIu64
#define OID8_FORMAT "%" PRIu64
--
2.52.0
----Next_Part(Mon_Sep_14_12_46_45_2026_013)----
Message-ID: <no-message-id-1780495@localhost>
Permalink: ../no-message-id-1780495@localhost/
Also on: postgresql.org/message-id/no-message-id-1780495@localhost
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: horikyota.ntt@gmail.com
Subject: Re: [PATCH] Fix translation of pg_controldata's NextOID output
In-Reply-To: <no-message-id-1780495@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox