git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 21187cf)
Report more information if pg_perm_setlocale() fails at startup.
Tue, 9 Jun 2015 17:37:08 +0000 (13:37 -0400)
Tue, 9 Jun 2015 17:37:08 +0000 (13:37 -0400)
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.


diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 2f07a58a4c89b5d45606b14f1b0f697db6a23bda..2ecadd660cfda5fd16524e818e9cd528bd1d4967 100644 (file)
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -43,7 +43,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);
@@ -116,31 +116,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
@@ -280,11 +280,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);
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /