diff options
author | Heikki Linnakangas | 2009-07-08 17:53:29 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2009-07-08 17:53:29 +0000 |
commit | 4e766f1cd94a1193b747a796ddd2d31db9a51197 (patch) | |
tree | 76c2bd3785fb2e052441fcda01786baef36167e6 | |
parent | 7bc0f82c36cad50789cc3c242dd0448e496bd006 (diff) |
Need to use pg_perm_setlocale when setting LC_CTYPE and LC_COLLATE at startup.
Otherwise, the LC_CTYPE/COLLATE setting gets reverted when using plperl, which
leads to incorrect query results and index corruption.
This was accidentally broken in the per-database locale patch in 8.4. Pointed
out by Andrew Gierth.
-rw-r--r-- | src/backend/utils/init/postinit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 6b98bedd5c..327ba7c180 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -44,6 +44,7 @@ #include "utils/acl.h" #include "utils/flatfiles.h" #include "utils/guc.h" +#include "utils/pg_locale.h" #include "utils/plancache.h" #include "utils/portal.h" #include "utils/relcache.h" @@ -247,14 +248,14 @@ CheckMyDatabase(const char *name, bool am_superuser) collate = NameStr(dbform->datcollate); ctype = NameStr(dbform->datctype); - if (setlocale(LC_COLLATE, collate) == NULL) + if (pg_perm_setlocale(LC_COLLATE, collate) == NULL) ereport(FATAL, (errmsg("database locale is incompatible with operating system"), errdetail("The database was initialized with LC_COLLATE \"%s\", " " which is not recognized by setlocale().", collate), errhint("Recreate the database with another locale or install the missing locale."))); - if (setlocale(LC_CTYPE, ctype) == NULL) + if (pg_perm_setlocale(LC_CTYPE, ctype) == NULL) ereport(FATAL, (errmsg("database locale is incompatible with operating system"), errdetail("The database was initialized with LC_CTYPE \"%s\", " |