Add errhint_internal()

Andres Freund <andres@anarazel.de>

Commit: 4244cf68769773ba30b868354f1f2fe93238e98b
Author: Andres Freund <andres@anarazel.de>
Date: 2025-03-30T20:10:51Z
Releases: 18.0
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: https://postgr.es/m/ym3dqpa4xcvoeknewcw63x77vnqdosbqcetjinb2zfoh65k55m@m4ozmwhr6lk6

Files

PathChange+/−
src/backend/utils/error/elog.c modified +21 −0
src/include/utils/elog.h modified +1 −0

Discussion

  • AIO v2.0 213 messages · 2024-09-01 → 2025-07-29