diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2009-07-08 17:53:32 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2009-07-08 17:53:32 +0000 |
commit | 35863c9557085d0a116ffb48dc371efe18b85fea (patch) | |
tree | c5a6a3ad299e3d8e762924b3e43bc5725acf5f84 | |
parent | b6ff6309c252ee252605e8aa03baced064e82b04 (diff) | |
download | postgresql-35863c9557085d0a116ffb48dc371efe18b85fea.tar.gz postgresql-35863c9557085d0a116ffb48dc371efe18b85fea.zip |
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 | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 34685cba3ce..a3d029f59ce 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.191 2009/06/11 14:49:05 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.191.2.1 2009/07/08 17:53:32 heikki Exp $ * * *------------------------------------------------------------------------- @@ -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\", " |