diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2012-11-12 15:10:24 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2012-11-12 17:07:29 +0200 |
commit | dbdf9679d7d61b03a3bf73af9b095831b7010eb5 (patch) | |
tree | 0279dd90603c25774d69bf57870f494b7526405d /src/backend/storage/buffer/bufmgr.c | |
parent | c9d44a75d48ed8a9b9275b95be1fadaa562f3826 (diff) | |
download | postgresql-dbdf9679d7d61b03a3bf73af9b095831b7010eb5.tar.gz postgresql-dbdf9679d7d61b03a3bf73af9b095831b7010eb5.zip |
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().
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index bdcbe47ac9e..dddb6c0321f 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1888,7 +1888,7 @@ static void FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln) { XLogRecPtr recptr; - ErrorContextCallback errcontext; + ErrorContextCallback errcallback; instr_time io_start, io_time; @@ -1901,10 +1901,10 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln) return; /* Setup error traceback support for ereport() */ - errcontext.callback = shared_buffer_write_error_callback; - errcontext.arg = (void *) buf; - errcontext.previous = error_context_stack; - error_context_stack = &errcontext; + errcallback.callback = shared_buffer_write_error_callback; + errcallback.arg = (void *) buf; + errcallback.previous = error_context_stack; + error_context_stack = &errcallback; /* Find smgr relation for buffer */ if (reln == NULL) @@ -1967,7 +1967,7 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln) reln->smgr_rnode.node.relNode); /* Pop the error context stack */ - error_context_stack = errcontext.previous; + error_context_stack = errcallback.previous; } /* @@ -2253,13 +2253,13 @@ FlushRelationBuffers(Relation rel) if (RelFileNodeEquals(bufHdr->tag.rnode, rel->rd_node) && (bufHdr->flags & BM_VALID) && (bufHdr->flags & BM_DIRTY)) { - ErrorContextCallback errcontext; + ErrorContextCallback errcallback; /* Setup error traceback support for ereport() */ - errcontext.callback = local_buffer_write_error_callback; - errcontext.arg = (void *) bufHdr; - errcontext.previous = error_context_stack; - error_context_stack = &errcontext; + errcallback.callback = local_buffer_write_error_callback; + errcallback.arg = (void *) bufHdr; + errcallback.previous = error_context_stack; + error_context_stack = &errcallback; smgrwrite(rel->rd_smgr, bufHdr->tag.forkNum, @@ -2270,7 +2270,7 @@ FlushRelationBuffers(Relation rel) bufHdr->flags &= ~(BM_DIRTY | BM_JUST_DIRTIED); /* Pop the error context stack */ - error_context_stack = errcontext.previous; + error_context_stack = errcallback.previous; } } |