diff options
Diffstat (limited to 'src/backend/main/main.c')
-rw-r--r-- | src/backend/main/main.c | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/backend/main/main.c b/src/backend/main/main.c index 7b18f8c7582..a9edbfd4a44 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -99,42 +99,24 @@ main(int argc, char *argv[]) MemoryContextInit(); /* - * Set up locale information from environment. Note that LC_CTYPE and - * LC_COLLATE will be overridden later from pg_control if we are in an - * already-initialized database. We set them here so that they will be - * available to fill pg_control during initdb. LC_MESSAGES will get set - * later during GUC option processing, but we set it here to allow startup - * error messages to be localized. + * Set up locale information */ - set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("postgres")); -#ifdef WIN32 - /* - * Windows uses codepages rather than the environment, so we work around - * that by querying the environment explicitly first for LC_COLLATE and - * LC_CTYPE. We have to do this because initdb passes those values in the - * environment. If there is nothing there we fall back on the codepage. + * In the postmaster, absorb the environment values for LC_COLLATE and + * LC_CTYPE. Individual backends will change these later to settings + * taken from pg_database, but the postmaster cannot do that. If we leave + * these set to "C" then message localization might not work well in the + * postmaster. */ - { - char *env_locale; - - if ((env_locale = getenv("LC_COLLATE")) != NULL) - init_locale("LC_COLLATE", LC_COLLATE, env_locale); - else - init_locale("LC_COLLATE", LC_COLLATE, ""); - - if ((env_locale = getenv("LC_CTYPE")) != NULL) - init_locale("LC_CTYPE", LC_CTYPE, env_locale); - else - init_locale("LC_CTYPE", LC_CTYPE, ""); - } -#else init_locale("LC_COLLATE", LC_COLLATE, ""); init_locale("LC_CTYPE", LC_CTYPE, ""); -#endif + /* + * LC_MESSAGES will get set later during GUC option processing, but we set + * it here to allow startup error messages to be localized. + */ #ifdef LC_MESSAGES init_locale("LC_MESSAGES", LC_MESSAGES, ""); #endif |