Re: Odd usage of errmsg_internal in bufmgr.c

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Odd usage of errmsg_internal in bufmgr.c
Date: 2026-02-13 08:31:50
Message-ID: CAN4CZFNrWZNdVBmrUzTnnrwUTA9JwW4aPbo_EoVAmJp-zpiOeQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> That gets complicated with translation, because you need to translate the %s
> arguments need to be translated separately, as the translation cannot be done
> together with the error/detail message. Doable, but it's not an no-cost win.

I am aware of this, but the translation can be again at one place at the end.
As for the cost, if I understand correctly in this error path the
server has already generated possibly many log messages already, is
one more translation really a significant cost that we have to worry
about?

I would also probably add the first slightly different if into the
same message, by adding the two counts together, and mentioning
"invalid pages or checksum errors" at the end - since we already
suggest checking the server logs for more details, is it useful to
display 2 separate exact counts for that?

And that way we have only 1 error message for everything.

> and introducing a function-scoped macro to reduce the repetitive ereport() structure

I tried something similar initially, but I didn't find this too readable

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Srirama Kucherlapati 2026-02-13 08:49:56 RE: AIX support
Previous Message Michael Paquier 2026-02-13 08:24:30 Re: Our ABI diff infrastructure ignores enum SysCacheIdentifier