diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-06-09 13:37:08 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-06-09 13:37:08 -0400 |
commit | abdeb3504d079eb622264c248a0eff4a86d2614e (patch) | |
tree | df5263167a35e993db379ea8acfea490c447a20c /src | |
parent | 0db10d4e92b655dbb3cb3a08830783107e5f9e60 (diff) | |
download | postgresql-abdeb3504d079eb622264c248a0eff4a86d2614e.tar.gz postgresql-abdeb3504d079eb622264c248a0eff4a86d2614e.zip |
Report more information if pg_perm_setlocale() fails at startup.
We don't know why a few Windows users have seen this fail, but the
taciturnity of the error message certainly isn't helping debug it.
Let's at least find out which LC category isn't working.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/main/main.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/backend/main/main.c b/src/backend/main/main.c index 196d4846f79..9f0b4c4e014 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -50,7 +50,7 @@ const char *progname; static void startup_hacks(const char *progname); -static void init_locale(int category, const char *locale); +static void init_locale(const char *categoryname, int category, const char *locale); static void help(const char *progname); static void check_root(const char *progname); @@ -123,31 +123,31 @@ main(int argc, char *argv[]) char *env_locale; if ((env_locale = getenv("LC_COLLATE")) != NULL) - init_locale(LC_COLLATE, env_locale); + init_locale("LC_COLLATE", LC_COLLATE, env_locale); else - init_locale(LC_COLLATE, ""); + init_locale("LC_COLLATE", LC_COLLATE, ""); if ((env_locale = getenv("LC_CTYPE")) != NULL) - init_locale(LC_CTYPE, env_locale); + init_locale("LC_CTYPE", LC_CTYPE, env_locale); else - init_locale(LC_CTYPE, ""); + init_locale("LC_CTYPE", LC_CTYPE, ""); } #else - init_locale(LC_COLLATE, ""); - init_locale(LC_CTYPE, ""); + init_locale("LC_COLLATE", LC_COLLATE, ""); + init_locale("LC_CTYPE", LC_CTYPE, ""); #endif #ifdef LC_MESSAGES - init_locale(LC_MESSAGES, ""); + init_locale("LC_MESSAGES", LC_MESSAGES, ""); #endif /* * We keep these set to "C" always, except transiently in pg_locale.c; see * that file for explanations. */ - init_locale(LC_MONETARY, "C"); - init_locale(LC_NUMERIC, "C"); - init_locale(LC_TIME, "C"); + init_locale("LC_MONETARY", LC_MONETARY, "C"); + init_locale("LC_NUMERIC", LC_NUMERIC, "C"); + init_locale("LC_TIME", LC_TIME, "C"); /* * Now that we have absorbed as much as we wish to from the locale @@ -308,11 +308,12 @@ startup_hacks(const char *progname) * category's environment variable. */ static void -init_locale(int category, const char *locale) +init_locale(const char *categoryname, int category, const char *locale) { if (pg_perm_setlocale(category, locale) == NULL && pg_perm_setlocale(category, "C") == NULL) - elog(FATAL, "could not adopt C locale"); + elog(FATAL, "could not adopt \"%s\" locale nor C locale for %s", + locale, categoryname); } |