From dbdf9679d7d61b03a3bf73af9b095831b7010eb5 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 12 Nov 2012 15:10:24 +0200 Subject: Use correct text domain for translating errcontext() messages. errcontext() is typically used in an error context callback function, not within an ereport() invocation like e.g errmsg and errdetail are. That means that the message domain that the TEXTDOMAIN magic in ereport() determines is not the right one for the errcontext() calls. The message domain needs to be determined by the C file containing the errcontext() call, not the file containing the ereport() call. Fix by turning errcontext() into a macro that passes the TEXTDOMAIN to use for the errcontext message. "errcontext" was used in a few places as a variable or struct field name, I had to rename those out of the way, now that errcontext is a macro. We've had this problem all along, but this isn't doesn't seem worth backporting. It's a fairly minor issue, and turning errcontext from a function to a macro requires at least a recompile of any external code that calls errcontext(). --- src/backend/access/transam/xlog.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/backend/access/transam/xlog.c') diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index bf76f6d24cb..c541b5a552d 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5698,7 +5698,7 @@ StartupXLOG(void) bool recoveryContinue = true; bool recoveryApply = true; bool recoveryPause = false; - ErrorContextCallback errcontext; + ErrorContextCallback errcallback; TimestampTz xtime; InRedo = true; @@ -5760,10 +5760,10 @@ StartupXLOG(void) } /* Setup error traceback support for ereport() */ - errcontext.callback = rm_redo_error_callback; - errcontext.arg = (void *) record; - errcontext.previous = error_context_stack; - error_context_stack = &errcontext; + errcallback.callback = rm_redo_error_callback; + errcallback.arg = (void *) record; + errcallback.previous = error_context_stack; + error_context_stack = &errcallback; /* * ShmemVariableCache->nextXid must be beyond record's xid. @@ -5808,7 +5808,7 @@ StartupXLOG(void) RmgrTable[record->xl_rmid].rm_redo(EndRecPtr, record); /* Pop the error context stack */ - error_context_stack = errcontext.previous; + error_context_stack = errcallback.previous; if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint) && XLByteLE(ControlFile->backupEndPoint, EndRecPtr)) -- cgit v1.2.3