*** original/pgsql/src/backend/utils/error/elog.c 2012-11-06 02:11:02.942057121 +0900 --- new/pgsql/src/backend/utils/error/elog.c 2012-11-06 02:11:02.871000898 +0900 *************** *** 673,685 **** * to the edata field because the buffer might be considerably larger than * really necessary. */ ! #define EVALUATE_MESSAGE(targetfield, appendval, translateit) \ { \ char *fmtbuf; \ StringInfoData buf; \ /* Internationalize the error format string */ \ if (translateit && !in_error_recursion_trouble()) \ ! fmt = dgettext(edata->domain, fmt); \ /* Expand %m in format string */ \ fmtbuf = expand_fmt_string(fmt, edata); \ initStringInfo(&buf); \ --- 673,685 ---- * to the edata field because the buffer might be considerably larger than * really necessary. */ ! #define EVALUATE_MESSAGE_DOMAIN(textdomain, targetfield, appendval, translateit) \ { \ char *fmtbuf; \ StringInfoData buf; \ /* Internationalize the error format string */ \ if (translateit && !in_error_recursion_trouble()) \ ! fmt = dgettext((textdomain == NULL ? edata->domain : textdomain), fmt); \ /* Expand %m in format string */ \ fmtbuf = expand_fmt_string(fmt, edata); \ initStringInfo(&buf); \ *************** *** 708,713 **** --- 708,716 ---- pfree(buf.data); \ } + #define EVALUATE_MESSAGE(targetfield, appendval, translateit) \ + EVALUATE_MESSAGE_DOMAIN(NULL, targetfield, appendval, translateit) + /* * Same as above, except for pluralized error messages. The calling routine * must be declared like "const char *fmt_singular, const char *fmt_plural, *************** *** 952,958 **** * states. */ int ! errcontext(const char *fmt,...) { ErrorData *edata = &errordata[errordata_stack_depth]; MemoryContext oldcontext; --- 955,961 ---- * states. */ int ! errcontext_domain(const char *domain, const char *fmt,...) { ErrorData *edata = &errordata[errordata_stack_depth]; MemoryContext oldcontext; *************** *** 961,974 **** CHECK_STACK_DEPTH(); oldcontext = MemoryContextSwitchTo(ErrorContext); ! EVALUATE_MESSAGE(context, true, true); MemoryContextSwitchTo(oldcontext); recursion_depth--; return 0; /* return value does not matter */ } - /* * errhidestmt --- optionally suppress STATEMENT: field of log entry * --- 964,976 ---- CHECK_STACK_DEPTH(); oldcontext = MemoryContextSwitchTo(ErrorContext); ! EVALUATE_MESSAGE_DOMAIN(domain, context, true, true); MemoryContextSwitchTo(oldcontext); recursion_depth--; return 0; /* return value does not matter */ } /* * errhidestmt --- optionally suppress STATEMENT: field of log entry *