Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1B22B475C29 for ; Wed, 7 Aug 2002 14:05:01 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 5447C475C26 for ; Wed, 7 Aug 2002 14:05:00 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g77I4UVk018625; Wed, 7 Aug 2002 14:04:30 -0400 (EDT) To: Drew Wilson Cc: pgsql-admin@postgresql.org, Peter Eisentraut Subject: Re: initdb "Fails to initialize lc_time" (using 7.3.1) In-reply-to: <5142A832-A9CA-11D6-B462-00039362D52E@speakeasy.net> References: <5142A832-A9CA-11D6-B462-00039362D52E@speakeasy.net> Comments: In-reply-to Drew Wilson message dated "Tue, 06 Aug 2002 22:55:46 -0700" Date: Wed, 07 Aug 2002 14:04:30 -0400 Message-ID: <18624.1028743470@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/63 X-Sequence-Number: 5178 Drew Wilson writes: > [ tip-of-tree fails on OS X with ] > creating template1 database in data/base/1... Failed to initialize > lc_monetaryFailed to initialize lc_numericFailed to initialize lc_timeok > creating configuration files... ok Yeah, I can reproduce that here. And although initdb gets to completion, the postmaster won't start: FATAL: invalid value for option 'LC_MONETARY': 'en_US' The trigger for this problem is that you have LANG = en_US in your environment, but it seems that OS X doesn't really support that setting fully. At least setlocale() rejects it for the MONETARY, NUMERIC, and TIME categories. This causes two problems: * guc.c's initialization of the LC_foo variables fails; this is harmless but produces annoying warnings on stderr. (I've fixed the misformatting of those messages, at least.) We could perhaps have the init-time values be "C" not "", but that would mean lack of localization of some startup error messages; I'd rather live with the warnings on misconfigured systems than lose functionality on correctly configured ones. * initdb puts LC_MONETARY = 'en_US', etc, into postgresql.conf, causing a FATAL error during postmaster startup when the assign_hook rejects the value. I am not sure if initdb can do much to detect and reject bad locale settings. locale(1) is apparently not portable (at least I don't see it on my OS X system), and it's probably not worth compiling a test program to probe what setlocale() does. Peter, any ideas? Also, although initdb --no-locale gets around the startup failure, you still see all the "Failed to initialize" chatter. This is because initdb massages its own variables but doesn't unset LANG when you use that option. Peter, why did you set up initdb's locale switches that way? Why don't you have them set/unset the standard environment variable names, so that the effects are actually seen by programs called by initdb? regards, tom lane