diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 079220c..0510412 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -2749,12 +2749,12 @@ quickdie(SIGNAL_ARGS) */ ereport(WARNING, (errcode(ERRCODE_CRASH_SHUTDOWN), - errmsg("terminating connection because of crash of another server process"), - errdetail("The postmaster has commanded this server process to roll back" + errmsg_no_translateit("terminating connection because of crash of another server process"), + errdetail_no_translateit("The postmaster has commanded this server process to roll back" " the current transaction and exit, because another" " server process exited abnormally and possibly corrupted" " shared memory."), - errhint("In a moment you should be able to reconnect to the" + errhint_no_translateit("In a moment you should be able to reconnect to the" " database and repeat your command."))); /* diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index a7ca41d..793c02a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -831,6 +831,26 @@ errmsg(const char *fmt,...) return 0; /* return value does not matter */ } +/* + * errmsg_no_translateit --- same as errmsg except not translateit message + */ +int +errmsg_no_translateit(const char *fmt,...) +{ + ErrorData *edata = &errordata[errordata_stack_depth]; + MemoryContext oldcontext; + + recursion_depth++; + CHECK_STACK_DEPTH(); + oldcontext = MemoryContextSwitchTo(edata->assoc_context); + + edata->message_id = fmt; + EVALUATE_MESSAGE(edata->domain, message, false, false); + + MemoryContextSwitchTo(oldcontext); + recursion_depth--; + return 0; /* return value does not matter */ +} /* * errmsg_internal --- add a primary error message text to the current error @@ -906,6 +926,25 @@ errdetail(const char *fmt,...) return 0; /* return value does not matter */ } +/* + * errdetail_no_translateit --- same as errdetail except not translateit message + */ +int +errdetail_no_translateit(const char *fmt,...) +{ + ErrorData *edata = &errordata[errordata_stack_depth]; + MemoryContext oldcontext; + + recursion_depth++; + CHECK_STACK_DEPTH(); + oldcontext = MemoryContextSwitchTo(edata->assoc_context); + + EVALUATE_MESSAGE(edata->domain, detail, false, false); + + MemoryContextSwitchTo(oldcontext); + recursion_depth--; + return 0; /* return value does not matter */ +} /* * errdetail_internal --- add a detail error message text to the current error @@ -1020,6 +1059,26 @@ errhint(const char *fmt,...) return 0; /* return value does not matter */ } +/* + * errdetail_no_translateit --- same as errhint except not translateit message + */ +int +errhint_no_translateit(const char *fmt,...) +{ + ErrorData *edata = &errordata[errordata_stack_depth]; + MemoryContext oldcontext; + + recursion_depth++; + CHECK_STACK_DEPTH(); + oldcontext = MemoryContextSwitchTo(edata->assoc_context); + + EVALUATE_MESSAGE(edata->domain, hint, false, false); + + MemoryContextSwitchTo(oldcontext); + recursion_depth--; + return 0; /* return value does not matter */ +} + /* * errcontext_msg --- add a context error message text to the current error diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index 3b8c1d0..81a3981 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -153,6 +153,10 @@ extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errmsg_no_translateit(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errdetail_no_translateit(const char *fmt,...) pg_attribute_printf(1, 2); +extern int errhint_no_translateit(const char *fmt,...) pg_attribute_printf(1, 2); + /* * errcontext() is typically called in error context callback functions, not * within an ereport() invocation. The callback function can be in a different