diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-05 00:55:24 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-05 00:55:24 +0000 |
commit | d514752dbf15b0a8428e6d8a1dc6cca9b9da5684 (patch) | |
tree | 66b35409b82d60017da511ef476d8f8463429002 /src/backend/main/main.c | |
parent | 37cdf43eaa58ffc8a361cefc013917ff61c8bb3d (diff) |
Arrange to set the LC_XXX environment variables to match our locale setup.
Back-patch of previous fix in HEAD for plperl-vs-locale issue.
Diffstat (limited to 'src/backend/main/main.c')
-rw-r--r-- | src/backend/main/main.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/backend/main/main.c b/src/backend/main/main.c index 6b20dcb5763..33100724d01 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.65 2003/10/18 22:59:08 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.65.2.1 2006/01/05 00:55:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,6 +38,7 @@ #include "bootstrap/bootstrap.h" #include "tcop/tcopprot.h" #include "utils/help_config.h" +#include "utils/pg_locale.h" #include "utils/ps_status.h" @@ -130,19 +131,26 @@ main(int argc, char *argv[]) * set later during GUC option processing, but we set it here to allow * startup error messages to be localized. */ - setlocale(LC_COLLATE, ""); - setlocale(LC_CTYPE, ""); + pg_perm_setlocale(LC_COLLATE, ""); + pg_perm_setlocale(LC_CTYPE, ""); #ifdef LC_MESSAGES - setlocale(LC_MESSAGES, ""); + pg_perm_setlocale(LC_MESSAGES, ""); #endif /* * We keep these set to "C" always, except transiently in pg_locale.c; * see that file for explanations. */ - setlocale(LC_MONETARY, "C"); - setlocale(LC_NUMERIC, "C"); - setlocale(LC_TIME, "C"); + pg_perm_setlocale(LC_MONETARY, "C"); + pg_perm_setlocale(LC_NUMERIC, "C"); + pg_perm_setlocale(LC_TIME, "C"); + + /* + * Now that we have absorbed as much as we wish to from the locale + * environment, remove any LC_ALL setting, so that the environment + * variables installed by pg_perm_setlocale have force. + */ + unsetenv("LC_ALL"); #ifdef ENABLE_NLS bindtextdomain("postgres", LOCALEDIR); |