Hi,
The relevant code looks like this:
```
msg_one = _("invalid page in block %u of relation \"%s\””);
ereport(elevel,
errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal(msg_one, first + first_off, rpath.str) :
```
Here, the string is first translated via _() and stored in msg_one, and then passed to errmsg_internal(). However,
accordingto the header comment of errmsg_internal():
```
/*
* errmsg_internal --- add a primary error message text to the current error
*
* This is exactly like errmsg() except that strings passed to errmsg_internal
* are not translated, and are customarily left out of the
* internationalization message dictionary. This should be used for "can't
* happen" cases that are probably not worth spending translation effort on.
* We also use this for certain cases where we *must* not try to translate
* the message because the translation would fail and result in infinite
* error recursion.
*/
int
errmsg_internal(const char *fmt,...)
```
errmsg_internal() is explicitly intended for non-translatable, internal messages. Passing an already translated string
toit feels inconsistent with its documented purpose.
In bufmgr.c, these corruption-related messages are clearly user-facing, so it seems more appropriate to use errmsg()
hereinstead of errmsg_internal(). If my understanding is correct, the attached patch fixes the usages in bufmgr.c.
This patch doesn't affect runtime behavior, but it avoids confusion for future readers, and helps prevent similar
misuseelsewhere.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/