From 04be80b539fa8d3d2ea8cf5523b6b7353c83278a Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Thu, 12 Feb 2026 08:10:54 +0800
Subject: [PATCH v1] bufmgr: Fix wrong usage of errmsg_internal in
 buffer_readv_report()

buffer_readv_report() used errmsg_internal() (and related
*_internal() variants) for user-facing corruption messages. These
functions are intended for non-translatable messages and bypass normal
translation handling.

Switch to errmsg(), errdetail(), and errhint() instead.

Author: Chao Li <lic@highgo.com>
---
 src/backend/storage/buffer/bufmgr.c | 32 ++++++++++++++---------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index d1babaff023..a4c9a93a545 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -8420,26 +8420,26 @@ buffer_readv_report(PgAioResult result, const PgAioTargetData *td,
 	{
 		Assert(!zeroed_any);	/* can't have invalid pages when zeroing them */
 		affected_count = zeroed_or_error_count;
-		msg_one = _("invalid page in block %u of relation \"%s\"");
-		msg_mult = _("%u invalid pages among blocks %u..%u of relation \"%s\"");
-		det_mult = _("Block %u held the first invalid page.");
-		hint_mult = _("See server log for the other %u invalid block(s).");
+		msg_one = "invalid page in block %u of relation \"%s\"";
+		msg_mult = "%u invalid pages among blocks %u..%u of relation \"%s\"";
+		det_mult = "Block %u held the first invalid page.";
+		hint_mult = "See server log for the other %u invalid block(s).";
 	}
 	else if (zeroed_any && !ignored_any)
 	{
 		affected_count = zeroed_or_error_count;
-		msg_one = _("invalid page in block %u of relation \"%s\"; zeroing out page");
-		msg_mult = _("zeroing out %u invalid pages among blocks %u..%u of relation \"%s\"");
-		det_mult = _("Block %u held the first zeroed page.");
-		hint_mult = _("See server log for the other %u zeroed block(s).");
+		msg_one = "invalid page in block %u of relation \"%s\"; zeroing out page";
+		msg_mult = "zeroing out %u invalid pages among blocks %u..%u of relation \"%s\"";
+		det_mult = "Block %u held the first zeroed page.";
+		hint_mult = "See server log for the other %u zeroed block(s).";
 	}
 	else if (!zeroed_any && ignored_any)
 	{
 		affected_count = checkfail_count;
-		msg_one = _("ignoring checksum failure in block %u of relation \"%s\"");
-		msg_mult = _("ignoring %u checksum failures among blocks %u..%u of relation \"%s\"");
-		det_mult = _("Block %u held the first ignored page.");
-		hint_mult = _("See server log for the other %u ignored block(s).");
+		msg_one = "ignoring checksum failure in block %u of relation \"%s\"";
+		msg_mult = "ignoring %u checksum failures among blocks %u..%u of relation \"%s\"";
+		det_mult = "Block %u held the first ignored page.";
+		hint_mult = "See server log for the other %u ignored block(s).";
 	}
 	else
 		pg_unreachable();
@@ -8447,10 +8447,10 @@ buffer_readv_report(PgAioResult result, const PgAioTargetData *td,
 	ereport(elevel,
 			errcode(ERRCODE_DATA_CORRUPTED),
 			affected_count == 1 ?
-			errmsg_internal(msg_one, first + first_off, rpath.str) :
-			errmsg_internal(msg_mult, affected_count, first, last, rpath.str),
-			affected_count > 1 ? errdetail_internal(det_mult, first + first_off) : 0,
-			affected_count > 1 ? errhint_internal(hint_mult, affected_count - 1) : 0);
+			errmsg(msg_one, first + first_off, rpath.str) :
+			errmsg(msg_mult, affected_count, first, last, rpath.str),
+			affected_count > 1 ? errdetail(det_mult, first + first_off) : 0,
+			affected_count > 1 ? errhint(hint_mult, affected_count - 1) : 0);
 }
 
 static void
-- 
2.50.1 (Apple Git-155)

