Textdomains - Mailing list pgsql-hackers

From Magnus Hagander
Subject Textdomains
Date
Msg-id 49749375.9080307@hagander.net
Whole thread Raw
Responses Re: Textdomains  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
I've extracted this patch from Hiroshi Inoues patch about bug #4186. Per
his comment, "It also includes the changes to mbutils.c and elog.c which
fix recently introduced bug by the domain name change from "postgres" to
"postgres-8.4"."


Can somebody who actually knows how that works comment on it, please :-)

//Magnus
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 89163d6..a33c94e 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -308,7 +308,7 @@ errstart(int elevel, const char *filename, int lineno,
     edata->lineno = lineno;
     edata->funcname = funcname;
     /* the default text domain is the backend's */
-    edata->domain = domain ? domain : "postgres";
+    edata->domain = domain ? domain : PG_TEXTDOMAIN("postgres");
     /* Select default errcode based on elevel */
     if (elevel >= ERROR)
         edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c
index 3467c31..7725df4 100644
--- a/src/backend/utils/mb/mbutils.c
+++ b/src/backend/utils/mb/mbutils.c
@@ -873,7 +873,7 @@ SetDatabaseEncoding(int encoding)
      */
 #ifdef ENABLE_NLS
     if (encoding == PG_UTF8)
-        if (bind_textdomain_codeset("postgres", "UTF-8") == NULL)
+        if (bind_textdomain_codeset(textdomain(NULL), "UTF-8") == NULL)
             elog(LOG, "bind_textdomain_codeset failed");
 #endif
 }

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Hot Standby dev build (v8)
Next
From: Peter Eisentraut
Date:
Subject: tsearch with Turkish locale ( was Re: foreign_data test fails with non-C locale)