Thread: LC_COLLATE problem between linux distros

LC_COLLATE problem between linux distros

From
Craig Longman
Date:
i have a problem. i needed to reinstall my system and decided to finally
tackle debian again (was redhat).  it went well, and now i'm setting
everything back up.  when i backed up the databases, i decided to simply
back the directory up for two reasons: 1) it was the same version of
pgsql on both, 2) i'm not sure what the definitive way of backing up
everything (included large fields) is, i know there are docs, but there
are so many options, and its confusing what to do.  i wish there was
just a 'backup this database fully with large everything and compress
it'  but you need to supply special parms for large objects, etc.

anyway, mea culpa there, no doubt.

now, i installed pgsql again, copied over the backed up database stuff,
and tried to restart.  i get this error:

FATAL 2:  The database cluster was initialized with LC_COLLATE 'en_US',
    which is not recognized by setlocale().
    It looks like you need to initdb.

seems pretty strange as i imagine that debian installs en_US as a locale
option.

any ideas as to whats wrong?  btw.  this is with pgsql 7.2.2 on debian,
installed from unstable branch.  i _think_ i might have had 7.2.1 on the
old redhat system, but i'm not sure.  anyway, given the error, i'm not
sure 7.2.1 would help.

--

    CraigL->Thx();
    Be Developer ID: 5852


Attachment

Re: LC_COLLATE problem between linux distros

From
Tom Lane
Date:
Craig Longman <craigl@begeek.com> writes:
> FATAL 2:  The database cluster was initialized with LC_COLLATE 'en_US',
>     which is not recognized by setlocale().
>     It looks like you need to initdb.

> seems pretty strange as i imagine that debian installs en_US as a locale
> option.

I'd have imagined that too, but it seems not; leastwise the error
message is pretty definitive about what Postgres is being told by
setlocale().  Look in /usr/share/locale/ --- is there an en_US
subdirectory?  If not, maybe you missed installing some locale RPMs?

            regards, tom lane

Re: LC_COLLATE problem between linux distros

From
Craig Longman
Date:
On Fri, 2002-10-04 at 01:37, Tom Lane wrote:
> Craig Longman <craigl@begeek.com> writes:
> > FATAL 2:  The database cluster was initialized with LC_COLLATE 'en_US',
> >     which is not recognized by setlocale().
> >     It looks like you need to initdb.
>
> > seems pretty strange as i imagine that debian installs en_US as a locale
> > option.
>
> I'd have imagined that too, but it seems not; leastwise the error
> message is pretty definitive about what Postgres is being told by
> setlocale().  Look in /usr/share/locale/ --- is there an en_US
> subdirectory?  If not, maybe you missed installing some locale RPMs?

initially, there wasn't in /use/share/locale, only:
en, en_AU, en_GB, en_RN

i created a link for en_US to en, but that didn't seem to help.

perhaps i can copy the en_US directory over from a redhat install i
have, or even duplicate the whole 'en' directory in there?   i'll try
that.  maybe the debian packagers simply assume that en_US is the
definitive en and doesn't need to be further qualified.  this is awfully
strange.

thanks for the response!

--

    CraigL->Thx();
    Be Developer ID: 5852


Attachment

Re: LC_COLLATE problem between linux distros

From
Martijn van Oosterhout
Date:
On Fri, Oct 04, 2002 at 01:48:49AM -0400, Craig Longman wrote:
> On Fri, 2002-10-04 at 01:37, Tom Lane wrote:
> > I'd have imagined that too, but it seems not; leastwise the error
> > message is pretty definitive about what Postgres is being told by
> > setlocale().  Look in /usr/share/locale/ --- is there an en_US
> > subdirectory?  If not, maybe you missed installing some locale RPMs?
>
> initially, there wasn't in /use/share/locale, only:
> en, en_AU, en_GB, en_RN
>
> i created a link for en_US to en, but that didn't seem to help.
>
> perhaps i can copy the en_US directory over from a redhat install i
> have, or even duplicate the whole 'en' directory in there?   i'll try
> that.  maybe the debian packagers simply assume that en_US is the
> definitive en and doesn't need to be further qualified.  this is awfully
> strange.

We have a similar setup here where only the directories shown appear. But
en_US seems to work fine here. have you tried: dpkg-reconfigure locales

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

Re: LC_COLLATE problem between linux distros

From
Craig Longman
Date:
On Fri, 2002-10-04 at 02:04, Martijn van Oosterhout wrote:
> We have a similar setup here where only the directories shown appear. But
> en_US seems to work fine here. have you tried: dpkg-reconfigure locales

ah-ha!  no i hadn't tried that yet.  still wrapping my brain around
these things.  during setup, i had simply left it to 'C' (whatever that
is) and skipped along.  forcibly choosing en_US allowed pgsql to start
up fine.   interestingly, there still isn't an en_US directory in the
/usr/share/locales, so i don't know what magic its using to track en_US
down, but so long as it works i guess.

thanks very much.

--

    CraigL->Thx();
    Be Developer ID: 5852


Attachment

Re: LC_COLLATE problem between linux distros

From
Martijn van Oosterhout
Date:
On Fri, Oct 04, 2002 at 02:12:11AM -0400, Craig Longman wrote:
> On Fri, 2002-10-04 at 02:04, Martijn van Oosterhout wrote:
> > We have a similar setup here where only the directories shown appear. But
> > en_US seems to work fine here. have you tried: dpkg-reconfigure locales
>
> ah-ha!  no i hadn't tried that yet.  still wrapping my brain around
> these things.  during setup, i had simply left it to 'C' (whatever that
> is) and skipped along.  forcibly choosing en_US allowed pgsql to start
> up fine.   interestingly, there still isn't an en_US directory in the
> /usr/share/locales, so i don't know what magic its using to track en_US
> down, but so long as it works i guess.

It's a bit tricky. There is a set of charmaps (ISO-8859-*,UTF-8,Big5,etc)
(usually in /usr/share/i18n/charmaps) and a set of locales (en_*,etc)
(usually in /usr/share/locale). These are then compiled by localedef into
usable form for setlocale(). These compiled forms are in /usr/lib/locale.

The long and short of it is that if you want to use a locale (other than
C/POSIX) with a charset, you need to make it first. /etc/locale.gen
contains a list of locales you want automatically recompiled each upgrade.

Hopefully this clears the confusion,

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.