pgsql: Add errhint_internal()

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add errhint_internal()
Date: 2025-03-30 20:28:43
Message-ID: E1tyzGt-001oaN-0D@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add errhint_internal()

We have errmsg_internal(), errdetail_internal(), but not errhint_internal().

Sometimes it is useful to output a hint with already translated format
string (e.g. because there different messages depending on the condition). For
message/detail we do that with the _internal() variants, but we can't do that
with hint today. It's possible to work around that that by using something
like
str = psprintf(translated_format, args);
ereport(...
errhint("%s", str);
but that's not exactly pretty and makes it harder to avoid memory leaks.

Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Discussion: https://postgr.es/m/ym3dqpa4xcvoeknewcw63x77vnqdosbqcetjinb2zfoh65k55m@m4ozmwhr6lk6

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4244cf68769773ba30b868354f1f2fe93238e98b

Modified Files
--------------
src/backend/utils/error/elog.c | 21 +++++++++++++++++++++
src/include/utils/elog.h | 1 +
2 files changed, 22 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-03-30 21:43:20 pgsql: bufmgr: Implement AIO read support
Previous Message Jeff Davis 2025-03-30 18:12:20 Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing