]>
Commit | Line | Data |
---|---|---|
a1c47f7c | 1 | From bfb56a2ad7b489c04bfc90628e0cb3766763ecca Mon Sep 17 00:00:00 2001 |
2 | From: Heikki Linnakangas <heikki@enterprisedb.com> | |
3 | Date: Wed, 8 Jul 2009 17:53:32 +0000 | |
4 | Subject: [PATCH] Need to use pg_perm_setlocale when setting LC_CTYPE and LC_COLLATE at startup. | |
5 | Otherwise, the LC_CTYPE/COLLATE setting gets reverted when using plperl, which | |
6 | leads to incorrect query results and index corruption. | |
7 | ||
8 | This was accidentally broken in the per-database locale patch in 8.4. Pointed | |
9 | out by Andrew Gierth. | |
10 | --- | |
11 | src/backend/utils/init/postinit.c | 5 +++-- | |
12 | 1 files changed, 3 insertions(+), 2 deletions(-) | |
13 | ||
14 | diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c | |
15 | index 6b98bed..327ba7c 100644 | |
16 | --- a/src/backend/utils/init/postinit.c | |
17 | +++ b/src/backend/utils/init/postinit.c | |
18 | @@ -44,6 +44,7 @@ | |
19 | #include "utils/acl.h" | |
20 | #include "utils/flatfiles.h" | |
21 | #include "utils/guc.h" | |
22 | +#include "utils/pg_locale.h" | |
23 | #include "utils/plancache.h" | |
24 | #include "utils/portal.h" | |
25 | #include "utils/relcache.h" | |
26 | @@ -247,14 +248,14 @@ CheckMyDatabase(const char *name, bool am_superuser) | |
27 | collate = NameStr(dbform->datcollate); | |
28 | ctype = NameStr(dbform->datctype); | |
29 | ||
30 | - if (setlocale(LC_COLLATE, collate) == NULL) | |
31 | + if (pg_perm_setlocale(LC_COLLATE, collate) == NULL) | |
32 | ereport(FATAL, | |
33 | (errmsg("database locale is incompatible with operating system"), | |
34 | errdetail("The database was initialized with LC_COLLATE \"%s\", " | |
35 | " which is not recognized by setlocale().", collate), | |
36 | errhint("Recreate the database with another locale or install the missing locale."))); | |
37 | ||
38 | - if (setlocale(LC_CTYPE, ctype) == NULL) | |
39 | + if (pg_perm_setlocale(LC_CTYPE, ctype) == NULL) | |
40 | ereport(FATAL, | |
41 | (errmsg("database locale is incompatible with operating system"), | |
42 | errdetail("The database was initialized with LC_CTYPE \"%s\", " | |
43 | -- | |
44 | 1.6.3.1 | |
45 |