agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedTranslation of the NextOID message in pg_controldata
10+ messages / 5 participants
[nested] [flat]
* Translation of the NextOID message in pg_controldata
@ 2026-09-14 03:46 Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:06 ` Re: Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 10+ messages in thread
From: Kyotaro Horiguchi @ 2026-09-14 03:46 UTC (permalink / raw)
To: pgsql-hackers@lists.postgresql.org
Hello,
Commit cb298616463 changed the following line:
- printf(_("Latest checkpoint's NextOID: %u\n"),
+ printf(_("Latest checkpoint's NextOID: " OID8_FORMAT "\n"),
It appears that xgettext does not recognize PostgreSQL's OID8_FORMAT
macro and therefore extracts only the preceding string literal as the
msgid. In contrast, PRIu64, which is used in the same file, is
correctly extracted as %<PRIu64>. Therefore, shouldn't we use "%"
PRIu64 instead of OID8_FORMAT here as well?
I confirmed that, with the attached patch, the complete string is
correctly extracted as the msgid in the PO files. The patch also adds
a comment at the macro definitions noting that *_FORMAT macros cannot
be used directly in translatable messages.
Regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachments:
[text/x-patch] 0001-Fix-translation-of-pg_controldata-s-NextOID-output.patch (2.1K, ../../20260914.124645.2220219320843846932.horikyota.ntt@gmail.com/2-0001-Fix-translation-of-pg_controldata-s-NextOID-output.patch)
download | inline diff:
From b5a8cabe8c9704f7b39de19ca263fdf68c7df9c2 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Mon, 14 Sep 2026 12:34:35 +0900
Subject: [PATCH] Fix translation of pg_controldata's NextOID output
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
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2026-09-14 04:06 ` Kyotaro Horiguchi <horikyota.ntt@gmail.com>
1 sibling, 0 replies; 10+ messages in thread
From: Kyotaro Horiguchi @ 2026-09-14 04:06 UTC (permalink / raw)
To: pgsql-hackers@lists.postgresql.org
Oops!
At Mon, 14 Sep 2026 12:46:45 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in
> I confirmed that, with the attached patch, the complete string is
I accidentally attached a broken patch. The attached patch is the
corrected version.
Sorry for the mistake.
Regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachments:
[text/x-patch] v2-0001-Fix-translation-of-pg_controldata-s-NextOID-outpu.patch (2.0K, ../../20260914.130628.526629644748606842.horikyota.ntt@gmail.com/2-v2-0001-Fix-translation-of-pg_controldata-s-NextOID-outpu.patch)
download | inline diff:
From ed2132b4a963dfd04098af8b753f1a7b8218606f Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Mon, 14 Sep 2026 12:34:35 +0900
Subject: [PATCH v2] Fix translation of pg_controldata's NextOID output
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 | 3 ++-
src/include/c.h | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index b785f7f4070..616df997d42 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -269,7 +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"),
+ /* Use PRIu64 because xgettext does not recognize OID8_FORMAT. */
+ printf(_("Latest checkpoint's NextOID: %" PRIu64 "\n"),
ControlFile->checkPointCopy.nextOid);
printf(_("Latest checkpoint's NextMultiXactId: %u\n"),
ControlFile->checkPointCopy.nextMulti);
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
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2026-09-14 04:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
1 sibling, 1 reply; 10+ messages in thread
From: Tom Lane @ 2026-09-14 04:32 UTC (permalink / raw)
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org, Michael Paquier <michael@paquier.xyz>
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> Commit cb298616463 changed the following line:
> - printf(_("Latest checkpoint's NextOID: %u\n"),
> + printf(_("Latest checkpoint's NextOID: " OID8_FORMAT "\n"),
> It appears that xgettext does not recognize PostgreSQL's OID8_FORMAT
> macro and therefore extracts only the preceding string literal as the
> msgid. In contrast, PRIu64, which is used in the same file, is
> correctly extracted as %<PRIu64>. Therefore, shouldn't we use "%"
> PRIu64 instead of OID8_FORMAT here as well?
That would be fairly sad, because it means hard-wiring the fact that
Oid8 is the same as uint64 in a bunch of non-obvious places.
Admittedly, we've lived with formatting Oid as %u for a long time.
But can we fix this some other way?
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
@ 2026-09-14 06:00 ` Michael Paquier <michael@paquier.xyz>
2026-09-14 06:41 ` Re: Translation of the NextOID message in pg_controldata Álvaro Herrera <alvherre@kurilemu.de>
0 siblings, 1 reply; 10+ messages in thread
From: Michael Paquier @ 2026-09-14 06:00 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org
On Mon, Sep 14, 2026 at 12:32:18AM -0400, Tom Lane wrote:
> Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> > Commit cb298616463 changed the following line:
>
> > - printf(_("Latest checkpoint's NextOID: %u\n"),
> > + printf(_("Latest checkpoint's NextOID: " OID8_FORMAT "\n"),
Oops, sorry about that. I can see the breakage with some update-po.
>> It appears that xgettext does not recognize PostgreSQL's OID8_FORMAT
>> macro and therefore extracts only the preceding string literal as the
>> msgid. In contrast, PRIu64, which is used in the same file, is
>> correctly extracted as %<PRIu64>. Therefore, shouldn't we use "%"
>> PRIu64 instead of OID8_FORMAT here as well?
Yes, it's not the first time that 64-bit values show this problem with
translatable strings.
> That would be fairly sad, because it means hard-wiring the fact that
> Oid8 is the same as uint64 in a bunch of non-obvious places.
> Admittedly, we've lived with formatting Oid as %u for a long time.
> But can we fix this some other way?
The proposed patch to use the Pri markers would work with gettext().
Just note that, I have.. cough.. also broken pg_resetwal in two
places.
The other places switched recently (amcheck, backend) only relate to
internal errors and places without po files, so they're out of the
picture, fine with the OID8_FORMAT markers.
Anyway, I really want to keep this code greppable with the Oid8
markers, so I don't think that the proposed patch is what I would do.
The magic solution I can think of is to remove the markers from the
translatable strings, and replace them with a set of %s, as of the
attached patch, then use a pre-built string that itself uses
OID8_FORMAT. I am pretty sure we have used this method in other
places of the tree, but I cannot pinpoint where, on top of my mind.
The idea of documenting this trick or equivalent in c.h is interesting
in the long term, for sure. Any suggestions how to word this
requirement close to the OID8_FORMAT declaration?
Thoughts?
--
Michael
From 00a59f976130a1bb569dce94a9f2ab32692a9c76 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Mon, 14 Sep 2026 14:47:48 +0900
Subject: [PATCH] Fix translation of pg_resetwal and pg_controldata's NextOID
output
xgettext() drops OID8_FORMAT and therefore extracts an incomplete
message. Let's use %s in these translatable strings, with a pre-built
buffer that relies on OID8_FORMAT.
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
---
src/bin/pg_controldata/pg_controldata.c | 6 ++++--
src/bin/pg_resetwal/pg_resetwal.c | 13 +++++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index b785f7f40701..31dba74f5996 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -101,6 +101,7 @@ main(int argc, char *argv[])
char pgctime_str[128];
char ckpttime_str[128];
char mock_auth_nonce_str[MOCK_AUTH_NONCE_LEN * 2 + 1];
+ char nextoid_str[32];
const char *strftime_fmt = "%c";
const char *progname;
char xlogfilename[MAXFNAMELEN];
@@ -269,8 +270,9 @@ 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);
+ snprintf(nextoid_str, sizeof(nextoid_str), OID8_FORMAT,
+ ControlFile->checkPointCopy.nextOid);
+ printf(_("Latest checkpoint's NextOID: %s\n"), nextoid_str);
printf(_("Latest checkpoint's NextMultiXactId: %u\n"),
ControlFile->checkPointCopy.nextMulti);
printf(_("Latest checkpoint's NextMultiOffset: %" PRIu64 "\n"),
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 63e4381e03f0..45146df30a56 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -757,6 +757,8 @@ GuessControlValues(void)
static void
PrintControlValues(bool guessed)
{
+ char nextoid_str[32];
+
if (guessed)
printf(_("Guessed pg_control values:\n\n"));
else
@@ -775,8 +777,9 @@ PrintControlValues(bool guessed)
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);
+ snprintf(nextoid_str, sizeof(nextoid_str), OID8_FORMAT,
+ ControlFile.checkPointCopy.nextOid);
+ printf(_("Latest checkpoint's NextOID: %s\n"), nextoid_str);
printf(_("Latest checkpoint's NextMultiXactId: %u\n"),
ControlFile.checkPointCopy.nextMulti);
printf(_("Latest checkpoint's NextMultiOffset: %" PRIu64 "\n"),
@@ -835,6 +838,7 @@ static void
PrintNewControlValues(void)
{
char fname[MAXFNAMELEN];
+ char nextoid_str[32];
/* This will be always printed in order to keep format same. */
printf(_("\n\nValues to be changed:\n\n"));
@@ -861,8 +865,9 @@ PrintNewControlValues(void)
if (next_oid_given)
{
- printf(_("NextOID: " OID8_FORMAT "\n"),
- ControlFile.checkPointCopy.nextOid);
+ snprintf(nextoid_str, sizeof(nextoid_str), OID8_FORMAT,
+ ControlFile.checkPointCopy.nextOid);
+ printf(_("NextOID: %s\n"), nextoid_str);
}
if (next_xid_given)
--
2.55.0
Attachments:
[text/plain] 0001-Fix-translation-of-pg_resetwal-and-pg_controldata-s-.patch (3.5K, ../../aqeNcd4403BGVZqc@paquier.xyz/2-0001-Fix-translation-of-pg_resetwal-and-pg_controldata-s-.patch)
download | inline diff:
From 00a59f976130a1bb569dce94a9f2ab32692a9c76 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Mon, 14 Sep 2026 14:47:48 +0900
Subject: [PATCH] Fix translation of pg_resetwal and pg_controldata's NextOID
output
xgettext() drops OID8_FORMAT and therefore extracts an incomplete
message. Let's use %s in these translatable strings, with a pre-built
buffer that relies on OID8_FORMAT.
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
---
src/bin/pg_controldata/pg_controldata.c | 6 ++++--
src/bin/pg_resetwal/pg_resetwal.c | 13 +++++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index b785f7f40701..31dba74f5996 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -101,6 +101,7 @@ main(int argc, char *argv[])
char pgctime_str[128];
char ckpttime_str[128];
char mock_auth_nonce_str[MOCK_AUTH_NONCE_LEN * 2 + 1];
+ char nextoid_str[32];
const char *strftime_fmt = "%c";
const char *progname;
char xlogfilename[MAXFNAMELEN];
@@ -269,8 +270,9 @@ 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);
+ snprintf(nextoid_str, sizeof(nextoid_str), OID8_FORMAT,
+ ControlFile->checkPointCopy.nextOid);
+ printf(_("Latest checkpoint's NextOID: %s\n"), nextoid_str);
printf(_("Latest checkpoint's NextMultiXactId: %u\n"),
ControlFile->checkPointCopy.nextMulti);
printf(_("Latest checkpoint's NextMultiOffset: %" PRIu64 "\n"),
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 63e4381e03f0..45146df30a56 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -757,6 +757,8 @@ GuessControlValues(void)
static void
PrintControlValues(bool guessed)
{
+ char nextoid_str[32];
+
if (guessed)
printf(_("Guessed pg_control values:\n\n"));
else
@@ -775,8 +777,9 @@ PrintControlValues(bool guessed)
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);
+ snprintf(nextoid_str, sizeof(nextoid_str), OID8_FORMAT,
+ ControlFile.checkPointCopy.nextOid);
+ printf(_("Latest checkpoint's NextOID: %s\n"), nextoid_str);
printf(_("Latest checkpoint's NextMultiXactId: %u\n"),
ControlFile.checkPointCopy.nextMulti);
printf(_("Latest checkpoint's NextMultiOffset: %" PRIu64 "\n"),
@@ -835,6 +838,7 @@ static void
PrintNewControlValues(void)
{
char fname[MAXFNAMELEN];
+ char nextoid_str[32];
/* This will be always printed in order to keep format same. */
printf(_("\n\nValues to be changed:\n\n"));
@@ -861,8 +865,9 @@ PrintNewControlValues(void)
if (next_oid_given)
{
- printf(_("NextOID: " OID8_FORMAT "\n"),
- ControlFile.checkPointCopy.nextOid);
+ snprintf(nextoid_str, sizeof(nextoid_str), OID8_FORMAT,
+ ControlFile.checkPointCopy.nextOid);
+ printf(_("NextOID: %s\n"), nextoid_str);
}
if (next_xid_given)
--
2.55.0
[application/pgp-signature] signature.asc (832B, ../../aqeNcd4403BGVZqc@paquier.xyz/3-signature.asc)
download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
@ 2026-09-14 06:41 ` Álvaro Herrera <alvherre@kurilemu.de>
2026-09-14 07:08 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 10+ messages in thread
From: Álvaro Herrera @ 2026-09-14 06:41 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org
On 2026-Sep-14, Michael Paquier wrote:
> The magic solution I can think of is to remove the markers from the
> translatable strings, and replace them with a set of %s, as of the
> attached patch, then use a pre-built string that itself uses
> OID8_FORMAT. I am pretty sure we have used this method in other
> places of the tree, but I cannot pinpoint where, on top of my mind.
Yeah, we used to do that for long long, until we got rid of it using the
%z format instead. I was happy about no longer having that coding
pattern TBH.
I think this change would break what I proposed in
https://postgr.es/m/202601310924.yoik5n3blgt4@alvherre.pgsql
(FTR I decided to heed Peter's advice and not implement it in the way
proposed there, but instead build some generic facility that can also be
used elsewhere.)
I'm not sure I understand why we care that we hardcode that Oid8 is the
same as uint64. It's never been a problem that Oid is the same as uin32 ...
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"No tengo por qué estar de acuerdo con lo que pienso"
(Carlos Caszeli)
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
2026-09-14 06:41 ` Re: Translation of the NextOID message in pg_controldata Álvaro Herrera <alvherre@kurilemu.de>
@ 2026-09-14 07:08 ` Michael Paquier <michael@paquier.xyz>
2026-09-14 13:57 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 19:01 ` Re: Translation of the NextOID message in pg_controldata Peter Eisentraut <peter@eisentraut.org>
0 siblings, 2 replies; 10+ messages in thread
From: Michael Paquier @ 2026-09-14 07:08 UTC (permalink / raw)
To: Álvaro Herrera <alvherre@kurilemu.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org
On Mon, Sep 14, 2026 at 08:41:59AM +0200, Alvaro Herrera wrote:
> I'm not sure I understand why we care that we hardcode that Oid8 is the
> same as uint64. It's never been a problem that Oid is the same as uin32 ...
For me, the reason is greppability of oid8 information as the
variables printed in the strings may not refer to variables declared
in the code.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (832B, ../../aqedWuHgzxirUrLo@paquier.xyz/2-signature.asc)
download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
2026-09-14 06:41 ` Re: Translation of the NextOID message in pg_controldata Álvaro Herrera <alvherre@kurilemu.de>
2026-09-14 07:08 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
@ 2026-09-14 13:57 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 10+ messages in thread
From: Tom Lane @ 2026-09-14 13:57 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Álvaro Herrera <alvherre@kurilemu.de>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org
Michael Paquier <michael@paquier.xyz> writes:
> On Mon, Sep 14, 2026 at 08:41:59AM +0200, Alvaro Herrera wrote:
>> I'm not sure I understand why we care that we hardcode that Oid8 is the
>> same as uint64. It's never been a problem that Oid is the same as uin32 ...
> For me, the reason is greppability of oid8 information as the
> variables printed in the strings may not refer to variables declared
> in the code.
Yeah. It's not a big deal, so maybe PRIu64 is the best option.
I just wanted to be sure we'd considered whether there's another way.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
2026-09-14 06:41 ` Re: Translation of the NextOID message in pg_controldata Álvaro Herrera <alvherre@kurilemu.de>
2026-09-14 07:08 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
@ 2026-09-14 19:01 ` Peter Eisentraut <peter@eisentraut.org>
2026-09-14 23:04 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
1 sibling, 1 reply; 10+ messages in thread
From: Peter Eisentraut @ 2026-09-14 19:01 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; Álvaro Herrera <alvherre@kurilemu.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org
On 14.09.26 09:08, Michael Paquier wrote:
> On Mon, Sep 14, 2026 at 08:41:59AM +0200, Alvaro Herrera wrote:
>> I'm not sure I understand why we care that we hardcode that Oid8 is the
>> same as uint64. It's never been a problem that Oid is the same as uin32 ...
>
> For me, the reason is greppability of oid8 information as the
> variables printed in the strings may not refer to variables declared
> in the code.
I don't understand what this means. Do you mean you want to grep for
where an oid8 value is being printed? I mean, that just won't work. We
don't accommodate that in the code for anything else in place of "oid8".
I think the symbol OID8_FORMAT should be purged from the code. Its
presence is just going to cause confusion, with people using it in
incorrect ways, and inviting more XXX_FORMAT symbols to be added. We
have just been working on getting rid of these after all.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
2026-09-14 06:41 ` Re: Translation of the NextOID message in pg_controldata Álvaro Herrera <alvherre@kurilemu.de>
2026-09-14 07:08 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
2026-09-14 19:01 ` Re: Translation of the NextOID message in pg_controldata Peter Eisentraut <peter@eisentraut.org>
@ 2026-09-14 23:04 ` Michael Paquier <michael@paquier.xyz>
2026-09-28 03:38 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 10+ messages in thread
From: Michael Paquier @ 2026-09-14 23:04 UTC (permalink / raw)
To: Peter Eisentraut <peter@eisentraut.org>; +Cc: Álvaro Herrera <alvherre@kurilemu.de>; Tom Lane <tgl@sss.pgh.pa.us>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org
On Mon, Sep 14, 2026 at 09:01:27PM +0200, Peter Eisentraut wrote:
> I think the symbol OID8_FORMAT should be purged from the code. Its presence
> is just going to cause confusion, with people using it in incorrect ways,
> and inviting more XXX_FORMAT symbols to be added. We have just been working
> on getting rid of these after all.
Okay. The string idea is discarded then, in profit of some PRIu64 in
these three spots.
Perhaps getting rid of OID8_FORMAT entirely is the best thing to do,
as you suggest. The attached does so, better applied down to v19
that's not been released yet. The xlogdesc.c feels slightly weird,
but perhaps that's OK. WDYT?
--
Michael
From 59b5de5c59075dc133f9d31d9628c862fbfffaab Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 15 Sep 2026 08:01:34 +0900
Subject: [PATCH] Remove OID8_FORMAT
---
src/include/c.h | 1 -
src/backend/access/heap/heaptoast.c | 10 ++++----
src/backend/access/rmgrdesc/xlogdesc.c | 4 ++--
src/backend/access/transam/varsup.c | 2 +-
src/backend/access/transam/xlogrecovery.c | 2 +-
.../replication/logical/reorderbuffer.c | 4 ++--
src/bin/pg_upgrade/pg_upgrade.c | 2 +-
contrib/amcheck/verify_heapam.c | 24 +++++++++----------
8 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/src/include/c.h b/src/include/c.h
index 20cfbac54e71..3b75f0b86106 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -692,7 +692,6 @@ typedef uint64_t uint64;
/* snprintf format strings to use for 64-bit integers */
#define INT64_FORMAT "%" PRId64
#define UINT64_FORMAT "%" PRIu64
-#define OID8_FORMAT "%" PRIu64
/*
* 128-bit signed and unsigned integers
diff --git a/src/backend/access/heap/heaptoast.c b/src/backend/access/heap/heaptoast.c
index 81154c17376c..20653b653c89 100644
--- a/src/backend/access/heap/heaptoast.c
+++ b/src/backend/access/heap/heaptoast.c
@@ -729,7 +729,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
else
{
/* should never happen */
- elog(ERROR, "found toasted toast chunk for toast value " OID8_FORMAT " in %s",
+ elog(ERROR, "found toasted toast chunk for toast value %" PRIu64 " in %s",
valueid, RelationGetRelationName(toastrel));
chunksize = 0; /* keep compiler quiet */
chunkdata = NULL;
@@ -741,13 +741,13 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
if (curchunk != expectedchunk)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("unexpected chunk number %d (expected %d) for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("unexpected chunk number %d (expected %d) for toast value %" PRIu64 " in %s",
curchunk, expectedchunk, valueid,
RelationGetRelationName(toastrel))));
if (curchunk > endchunk)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("unexpected chunk number %d (out of range %d..%d) for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("unexpected chunk number %d (out of range %d..%d) for toast value %" PRIu64 " in %s",
curchunk,
startchunk, endchunk, valueid,
RelationGetRelationName(toastrel))));
@@ -756,7 +756,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
if (chunksize != expected_size)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("unexpected chunk size %d (expected %d) in chunk %d of %d for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("unexpected chunk size %d (expected %d) in chunk %d of %d for toast value %" PRIu64 " in %s",
chunksize, expected_size,
curchunk, totalchunks, valueid,
RelationGetRelationName(toastrel))));
@@ -785,7 +785,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
if (expectedchunk != (endchunk + 1))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("missing chunk number %d for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("missing chunk number %d for toast value %" PRIu64 " in %s",
expectedchunk, valueid,
RelationGetRelationName(toastrel))));
diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c
index 64e749c1e6b7..323acd74467d 100644
--- a/src/backend/access/rmgrdesc/xlogdesc.c
+++ b/src/backend/access/rmgrdesc/xlogdesc.c
@@ -101,7 +101,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
CheckPoint *checkpoint = (CheckPoint *) rec;
appendStringInfo(buf, "redo %X/%08X; "
- "tli %u; prev tli %u; fpw %s; wal_level %s; logical decoding %s; xid %u:%u; oid " OID8_FORMAT "; multi %u; offset %" PRIu64 "; "
+ "tli %u; prev tli %u; fpw %s; wal_level %s; logical decoding %s; xid %u:%u; oid %" PRIu64 "; multi %u; offset %" PRIu64 "; "
"oldest xid %u in DB %u; oldest multi %u in DB %u; "
"oldest/newest commit timestamp xid: %u/%u; "
"oldest running xid %u; "
@@ -132,7 +132,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
Oid8 nextOid;
memcpy(&nextOid, rec, sizeof(Oid8));
- appendStringInfo(buf, OID8_FORMAT, nextOid);
+ appendStringInfo(buf, "%" PRIu64, nextOid);
}
else if (info == XLOG_RESTORE_POINT)
{
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 889bdebe1880..912f7cb1d2c4 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -652,7 +652,7 @@ SetNextObjectId(Oid8 nextOid)
LWLockAcquire(OidGenLock, LW_EXCLUSIVE);
if (TransamVariables->nextOid > nextOid)
- elog(ERROR, "too late to advance OID counter to " OID8_FORMAT ", it is now " OID8_FORMAT,
+ elog(ERROR, "too late to advance OID counter to %" PRIu64 ", it is now %" PRIu64,
nextOid, TransamVariables->nextOid);
TransamVariables->nextOid = nextOid;
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index fff8d57ac61d..54aaec9529f5 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -840,7 +840,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
LSN_FORMAT_ARGS(checkPoint.redo),
wasShutdown ? "true" : "false"));
ereport(DEBUG1,
- (errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: " OID8_FORMAT,
+ (errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %" PRIu64,
U64FromFullTransactionId(checkPoint.nextXid),
checkPoint.nextOid)));
ereport(DEBUG1,
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 534fe338b386..ab39e8cc12c7 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -5061,11 +5061,11 @@ ReorderBufferToastAppendChunk(ReorderBuffer *rb, ReorderBufferTXN *txn,
dlist_init(&ent->chunks);
if (chunk_seq != 0)
- elog(ERROR, "got sequence entry %d for toast chunk " OID8_FORMAT " instead of seq 0",
+ elog(ERROR, "got sequence entry %d for toast chunk %" PRIu64 " instead of seq 0",
chunk_seq, chunk_id);
}
else if (found && chunk_seq != ent->last_chunk_seq + 1)
- elog(ERROR, "got sequence entry %d for toast chunk " OID8_FORMAT " instead of seq %d",
+ elog(ERROR, "got sequence entry %d for toast chunk %" PRIu64 " instead of seq %d",
chunk_seq, chunk_id, ent->last_chunk_seq + 1);
chunk = DatumGetPointer(fastgetattr(newtup, 3, desc, &isnull));
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 3704c620603c..c0fadb3f3177 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -196,7 +196,7 @@ main(int argc, char **argv)
*/
prep_status("Setting next OID for new cluster");
exec_prog(UTILITY_LOG_FILE, NULL, true, true,
- "\"%s/pg_resetwal\" -o " OID8_FORMAT " \"%s\"",
+ "\"%s/pg_resetwal\" -o %" PRIu64 " \"%s\"",
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtoid,
new_cluster.pgdata);
check_ok();
diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index 33b00fa4dc5c..9af6a78e459e 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -1576,7 +1576,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (isnull)
{
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " has toast chunk with null sequence number",
+ psprintf("toast value %" PRIu64 " has toast chunk with null sequence number",
toast_valueid));
return;
}
@@ -1584,7 +1584,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
{
/* Either the TOAST index is corrupt, or we don't have all chunks. */
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " index scan returned chunk %d when expecting chunk %d",
+ psprintf("toast value %" PRIu64 " index scan returned chunk %d when expecting chunk %d",
toast_valueid,
chunk_seq, *expected_chunk_seq));
}
@@ -1596,7 +1596,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (isnull)
{
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d has null data",
+ psprintf("toast value %" PRIu64 " chunk %d has null data",
toast_valueid,
chunk_seq));
return;
@@ -1616,7 +1616,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
uint32 header = ((varattrib_4b *) chunk)->va_4byte.va_header;
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d has invalid varlena header %0x",
+ psprintf("toast value %" PRIu64 " chunk %d has invalid varlena header %0x",
toast_valueid,
chunk_seq, header));
return;
@@ -1628,7 +1628,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (chunk_seq > last_chunk_seq)
{
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d follows last expected chunk %d",
+ psprintf("toast value %" PRIu64 " chunk %d follows last expected chunk %d",
toast_valueid,
chunk_seq, last_chunk_seq));
return;
@@ -1639,7 +1639,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (chunksize != expected_size)
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d has size %u, but expected size %u",
+ psprintf("toast value %" PRIu64 " chunk %d has size %u, but expected size %u",
toast_valueid,
chunk_seq, chunksize, expected_size));
}
@@ -1785,7 +1785,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
/* Toasted attributes too large to be untoasted should never be stored */
if (toast_pointer.va_rawsize > VARLENA_SIZE_LIMIT)
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " rawsize %d exceeds limit %d",
+ psprintf("toast value %" PRIu64 " rawsize %d exceeds limit %d",
toast_pointer_valueid,
toast_pointer.va_rawsize,
VARLENA_SIZE_LIMIT));
@@ -1813,7 +1813,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
}
if (!valid)
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " has invalid compression method id %d",
+ psprintf("toast value %" PRIu64 " has invalid compression method id %d",
toast_pointer_valueid, cmid));
}
@@ -1821,7 +1821,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
if (!(infomask & HEAP_HASEXTERNAL))
{
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " is external but tuple header flag HEAP_HASEXTERNAL not set",
+ psprintf("toast value %" PRIu64 " is external but tuple header flag HEAP_HASEXTERNAL not set",
toast_pointer_valueid));
return true;
}
@@ -1830,7 +1830,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
if (!ctx->rel->rd_rel->reltoastrelid)
{
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " is external but relation has no toast relation",
+ psprintf("toast value %" PRIu64 " is external but relation has no toast relation",
toast_pointer_valueid));
return true;
}
@@ -1912,11 +1912,11 @@ check_toasted_attribute(HeapCheckContext *ctx, ToastedAttribute *ta)
if (!found_toasttup)
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " not found in toast table",
+ psprintf("toast value %" PRIu64 " not found in toast table",
toast_valueid));
else if (expected_chunk_seq <= last_chunk_seq)
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " was expected to end at chunk %d, but ended while expecting chunk %d",
+ psprintf("toast value %" PRIu64 " was expected to end at chunk %d, but ended while expecting chunk %d",
toast_valueid,
last_chunk_seq, expected_chunk_seq));
}
--
2.55.0
Attachments:
[text/plain] 0001-Remove-OID8_FORMAT.patch (12.2K, ../../aqh9gBSofzn0Ub88@paquier.xyz/2-0001-Remove-OID8_FORMAT.patch)
download | inline diff:
From 59b5de5c59075dc133f9d31d9628c862fbfffaab Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Tue, 15 Sep 2026 08:01:34 +0900
Subject: [PATCH] Remove OID8_FORMAT
---
src/include/c.h | 1 -
src/backend/access/heap/heaptoast.c | 10 ++++----
src/backend/access/rmgrdesc/xlogdesc.c | 4 ++--
src/backend/access/transam/varsup.c | 2 +-
src/backend/access/transam/xlogrecovery.c | 2 +-
.../replication/logical/reorderbuffer.c | 4 ++--
src/bin/pg_upgrade/pg_upgrade.c | 2 +-
contrib/amcheck/verify_heapam.c | 24 +++++++++----------
8 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/src/include/c.h b/src/include/c.h
index 20cfbac54e71..3b75f0b86106 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -692,7 +692,6 @@ typedef uint64_t uint64;
/* snprintf format strings to use for 64-bit integers */
#define INT64_FORMAT "%" PRId64
#define UINT64_FORMAT "%" PRIu64
-#define OID8_FORMAT "%" PRIu64
/*
* 128-bit signed and unsigned integers
diff --git a/src/backend/access/heap/heaptoast.c b/src/backend/access/heap/heaptoast.c
index 81154c17376c..20653b653c89 100644
--- a/src/backend/access/heap/heaptoast.c
+++ b/src/backend/access/heap/heaptoast.c
@@ -729,7 +729,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
else
{
/* should never happen */
- elog(ERROR, "found toasted toast chunk for toast value " OID8_FORMAT " in %s",
+ elog(ERROR, "found toasted toast chunk for toast value %" PRIu64 " in %s",
valueid, RelationGetRelationName(toastrel));
chunksize = 0; /* keep compiler quiet */
chunkdata = NULL;
@@ -741,13 +741,13 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
if (curchunk != expectedchunk)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("unexpected chunk number %d (expected %d) for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("unexpected chunk number %d (expected %d) for toast value %" PRIu64 " in %s",
curchunk, expectedchunk, valueid,
RelationGetRelationName(toastrel))));
if (curchunk > endchunk)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("unexpected chunk number %d (out of range %d..%d) for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("unexpected chunk number %d (out of range %d..%d) for toast value %" PRIu64 " in %s",
curchunk,
startchunk, endchunk, valueid,
RelationGetRelationName(toastrel))));
@@ -756,7 +756,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
if (chunksize != expected_size)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("unexpected chunk size %d (expected %d) in chunk %d of %d for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("unexpected chunk size %d (expected %d) in chunk %d of %d for toast value %" PRIu64 " in %s",
chunksize, expected_size,
curchunk, totalchunks, valueid,
RelationGetRelationName(toastrel))));
@@ -785,7 +785,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid8 valueid, int32 attrsize,
if (expectedchunk != (endchunk + 1))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("missing chunk number %d for toast value " OID8_FORMAT " in %s",
+ errmsg_internal("missing chunk number %d for toast value %" PRIu64 " in %s",
expectedchunk, valueid,
RelationGetRelationName(toastrel))));
diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c
index 64e749c1e6b7..323acd74467d 100644
--- a/src/backend/access/rmgrdesc/xlogdesc.c
+++ b/src/backend/access/rmgrdesc/xlogdesc.c
@@ -101,7 +101,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
CheckPoint *checkpoint = (CheckPoint *) rec;
appendStringInfo(buf, "redo %X/%08X; "
- "tli %u; prev tli %u; fpw %s; wal_level %s; logical decoding %s; xid %u:%u; oid " OID8_FORMAT "; multi %u; offset %" PRIu64 "; "
+ "tli %u; prev tli %u; fpw %s; wal_level %s; logical decoding %s; xid %u:%u; oid %" PRIu64 "; multi %u; offset %" PRIu64 "; "
"oldest xid %u in DB %u; oldest multi %u in DB %u; "
"oldest/newest commit timestamp xid: %u/%u; "
"oldest running xid %u; "
@@ -132,7 +132,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
Oid8 nextOid;
memcpy(&nextOid, rec, sizeof(Oid8));
- appendStringInfo(buf, OID8_FORMAT, nextOid);
+ appendStringInfo(buf, "%" PRIu64, nextOid);
}
else if (info == XLOG_RESTORE_POINT)
{
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 889bdebe1880..912f7cb1d2c4 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -652,7 +652,7 @@ SetNextObjectId(Oid8 nextOid)
LWLockAcquire(OidGenLock, LW_EXCLUSIVE);
if (TransamVariables->nextOid > nextOid)
- elog(ERROR, "too late to advance OID counter to " OID8_FORMAT ", it is now " OID8_FORMAT,
+ elog(ERROR, "too late to advance OID counter to %" PRIu64 ", it is now %" PRIu64,
nextOid, TransamVariables->nextOid);
TransamVariables->nextOid = nextOid;
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index fff8d57ac61d..54aaec9529f5 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -840,7 +840,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
LSN_FORMAT_ARGS(checkPoint.redo),
wasShutdown ? "true" : "false"));
ereport(DEBUG1,
- (errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: " OID8_FORMAT,
+ (errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %" PRIu64,
U64FromFullTransactionId(checkPoint.nextXid),
checkPoint.nextOid)));
ereport(DEBUG1,
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 534fe338b386..ab39e8cc12c7 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -5061,11 +5061,11 @@ ReorderBufferToastAppendChunk(ReorderBuffer *rb, ReorderBufferTXN *txn,
dlist_init(&ent->chunks);
if (chunk_seq != 0)
- elog(ERROR, "got sequence entry %d for toast chunk " OID8_FORMAT " instead of seq 0",
+ elog(ERROR, "got sequence entry %d for toast chunk %" PRIu64 " instead of seq 0",
chunk_seq, chunk_id);
}
else if (found && chunk_seq != ent->last_chunk_seq + 1)
- elog(ERROR, "got sequence entry %d for toast chunk " OID8_FORMAT " instead of seq %d",
+ elog(ERROR, "got sequence entry %d for toast chunk %" PRIu64 " instead of seq %d",
chunk_seq, chunk_id, ent->last_chunk_seq + 1);
chunk = DatumGetPointer(fastgetattr(newtup, 3, desc, &isnull));
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 3704c620603c..c0fadb3f3177 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -196,7 +196,7 @@ main(int argc, char **argv)
*/
prep_status("Setting next OID for new cluster");
exec_prog(UTILITY_LOG_FILE, NULL, true, true,
- "\"%s/pg_resetwal\" -o " OID8_FORMAT " \"%s\"",
+ "\"%s/pg_resetwal\" -o %" PRIu64 " \"%s\"",
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtoid,
new_cluster.pgdata);
check_ok();
diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index 33b00fa4dc5c..9af6a78e459e 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -1576,7 +1576,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (isnull)
{
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " has toast chunk with null sequence number",
+ psprintf("toast value %" PRIu64 " has toast chunk with null sequence number",
toast_valueid));
return;
}
@@ -1584,7 +1584,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
{
/* Either the TOAST index is corrupt, or we don't have all chunks. */
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " index scan returned chunk %d when expecting chunk %d",
+ psprintf("toast value %" PRIu64 " index scan returned chunk %d when expecting chunk %d",
toast_valueid,
chunk_seq, *expected_chunk_seq));
}
@@ -1596,7 +1596,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (isnull)
{
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d has null data",
+ psprintf("toast value %" PRIu64 " chunk %d has null data",
toast_valueid,
chunk_seq));
return;
@@ -1616,7 +1616,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
uint32 header = ((varattrib_4b *) chunk)->va_4byte.va_header;
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d has invalid varlena header %0x",
+ psprintf("toast value %" PRIu64 " chunk %d has invalid varlena header %0x",
toast_valueid,
chunk_seq, header));
return;
@@ -1628,7 +1628,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (chunk_seq > last_chunk_seq)
{
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d follows last expected chunk %d",
+ psprintf("toast value %" PRIu64 " chunk %d follows last expected chunk %d",
toast_valueid,
chunk_seq, last_chunk_seq));
return;
@@ -1639,7 +1639,7 @@ check_toast_tuple(HeapTuple toasttup, HeapCheckContext *ctx,
if (chunksize != expected_size)
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " chunk %d has size %u, but expected size %u",
+ psprintf("toast value %" PRIu64 " chunk %d has size %u, but expected size %u",
toast_valueid,
chunk_seq, chunksize, expected_size));
}
@@ -1785,7 +1785,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
/* Toasted attributes too large to be untoasted should never be stored */
if (toast_pointer.va_rawsize > VARLENA_SIZE_LIMIT)
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " rawsize %d exceeds limit %d",
+ psprintf("toast value %" PRIu64 " rawsize %d exceeds limit %d",
toast_pointer_valueid,
toast_pointer.va_rawsize,
VARLENA_SIZE_LIMIT));
@@ -1813,7 +1813,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
}
if (!valid)
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " has invalid compression method id %d",
+ psprintf("toast value %" PRIu64 " has invalid compression method id %d",
toast_pointer_valueid, cmid));
}
@@ -1821,7 +1821,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
if (!(infomask & HEAP_HASEXTERNAL))
{
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " is external but tuple header flag HEAP_HASEXTERNAL not set",
+ psprintf("toast value %" PRIu64 " is external but tuple header flag HEAP_HASEXTERNAL not set",
toast_pointer_valueid));
return true;
}
@@ -1830,7 +1830,7 @@ check_tuple_attribute(HeapCheckContext *ctx)
if (!ctx->rel->rd_rel->reltoastrelid)
{
report_corruption(ctx,
- psprintf("toast value " OID8_FORMAT " is external but relation has no toast relation",
+ psprintf("toast value %" PRIu64 " is external but relation has no toast relation",
toast_pointer_valueid));
return true;
}
@@ -1912,11 +1912,11 @@ check_toasted_attribute(HeapCheckContext *ctx, ToastedAttribute *ta)
if (!found_toasttup)
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " not found in toast table",
+ psprintf("toast value %" PRIu64 " not found in toast table",
toast_valueid));
else if (expected_chunk_seq <= last_chunk_seq)
report_toast_corruption(ctx, ta,
- psprintf("toast value " OID8_FORMAT " was expected to end at chunk %d, but ended while expecting chunk %d",
+ psprintf("toast value %" PRIu64 " was expected to end at chunk %d, but ended while expecting chunk %d",
toast_valueid,
last_chunk_seq, expected_chunk_seq));
}
--
2.55.0
[application/pgp-signature] signature.asc (832B, ../../aqh9gBSofzn0Ub88@paquier.xyz/3-signature.asc)
download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Translation of the NextOID message in pg_controldata
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Re: Translation of the NextOID message in pg_controldata Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
2026-09-14 06:41 ` Re: Translation of the NextOID message in pg_controldata Álvaro Herrera <alvherre@kurilemu.de>
2026-09-14 07:08 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
2026-09-14 19:01 ` Re: Translation of the NextOID message in pg_controldata Peter Eisentraut <peter@eisentraut.org>
2026-09-14 23:04 ` Re: Translation of the NextOID message in pg_controldata Michael Paquier <michael@paquier.xyz>
@ 2026-09-28 03:38 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 10+ messages in thread
From: Michael Paquier @ 2026-09-28 03:38 UTC (permalink / raw)
To: Peter Eisentraut <peter@eisentraut.org>; +Cc: Álvaro Herrera <alvherre@kurilemu.de>; Tom Lane <tgl@sss.pgh.pa.us>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org
On Tue, Sep 15, 2026 at 08:04:33AM +0900, Michael Paquier wrote:
> Perhaps getting rid of OID8_FORMAT entirely is the best thing to do,
> as you suggest. The attached does so, better applied down to v19
> that's not been released yet. The xlogdesc.c feels slightly weird,
> but perhaps that's OK. WDYT?
Hearing no opinions, I have removed these markers on HEAD. I'll go
remove the definition on HEAD and REL_19_STABLE in a bit, to avoid
issues similar to this thread in the future.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (832B, ../../arnhHUEHLEKZhEM5@paquier.xyz/2-signature.asc)
download
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2026-09-28 03:38 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 03:46 Translation of the NextOID message in pg_controldata Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:06 ` Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-09-14 04:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 06:00 ` Michael Paquier <michael@paquier.xyz>
2026-09-14 06:41 ` Álvaro Herrera <alvherre@kurilemu.de>
2026-09-14 07:08 ` Michael Paquier <michael@paquier.xyz>
2026-09-14 13:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2026-09-14 19:01 ` Peter Eisentraut <peter@eisentraut.org>
2026-09-14 23:04 ` Michael Paquier <michael@paquier.xyz>
2026-09-28 03:38 ` Michael Paquier <michael@paquier.xyz>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox