Skip site navigation (1) Skip section navigation (2)

pgsql: Use correct text domain for translating errcontext() messages.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use correct text domain for translating errcontext() messages.
Date: 2012-11-12 15:20:36
Message-ID: E1TXvoS-0007zu-DY@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
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().

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/dbdf9679d7d61b03a3bf73af9b095831b7010eb5

Modified Files
--------------
src/backend/access/transam/xlog.c   |   12 ++++----
src/backend/commands/copy.c         |   12 ++++----
src/backend/parser/parse_node.c     |   10 +++---
src/backend/storage/buffer/bufmgr.c |   24 +++++++-------
src/backend/utils/error/elog.c      |   56 ++++++++++++++++++++++++----------
src/include/parser/parse_node.h     |    2 +-
src/include/utils/elog.h            |   14 ++++++++-
7 files changed, 82 insertions(+), 48 deletions(-)

Responses

pgsql-committers by date

Next:From: Tom LaneDate: 2012-11-12 15:54:12
Subject: Re: pgsql: Use correct text domain for translating errcontext() messages.
Previous:From: Heikki LinnakangasDate: 2012-11-12 13:04:55
Subject: pgsql: Silence "expression result unused" warnings inAssertVariableIsO

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group