pgsql: Add errhint_internal()

Started by Andres Freundover 1 year ago1 messagescomitters
Jump to latest
#1Andres Freund
andres@anarazel.de

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@leadboat.com>
Discussion: /messages/by-id/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(+)