diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-05 00:55:36 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-05 00:55:36 +0000 |
commit | 040d3e63a7eb2840e957a036209496492febd5f7 (patch) | |
tree | 0901fb43ea078d0cea4483f6568f96fc3da06adc /src/backend/main/main.c | |
parent | 3abc36786b422136917d12dcdfa1031fef05f843 (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 163d57d0df2..fa494658c4e 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.55 2002/10/31 22:37:19 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.55.2.1 2006/01/05 00:55:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,6 +38,7 @@ #include "miscadmin.h" #include "bootstrap/bootstrap.h" #include "tcop/tcopprot.h" +#include "utils/pg_locale.h" #include "utils/ps_status.h" @@ -130,19 +131,26 @@ main(int argc, char *argv[]) * get already localized behavior during startup (e.g., error * messages). */ - 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 don't use these during startup. See also pg_locale.c about why * these are set to "C". */ - 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); |