diff options
| author | Andres Freund | 2025-03-30 20:10:51 +0000 |
|---|---|---|
| committer | Andres Freund | 2025-03-30 20:10:51 +0000 |
| commit | 4244cf68769773ba30b868354f1f2fe93238e98b (patch) | |
| tree | 55f286503652fe88b1f219697746c24b8766b341 /src/include/utils | |
| parent | 49b82522f13fa5f756687f5609f687877fc970ff (diff) | |
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
Diffstat (limited to 'src/include/utils')
| -rw-r--r-- | src/include/utils/elog.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 855c147325b..a5313c5d2d5 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -195,6 +195,7 @@ extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errhint_internal(const char *fmt,...) pg_attribute_printf(1, 2); extern int errhint_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); |
