Re: C locale sort in src/tools/make_ctags - Mailing list pgsql-patches

From Tom Lane
Subject Re: C locale sort in src/tools/make_ctags
Date
Msg-id 9387.1075734363@sss.pgh.pa.us
Whole thread Raw
In response to Re: C locale sort in src/tools/make_ctags  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: C locale sort in src/tools/make_ctags
Re: C locale sort in src/tools/make_ctags - solved
List pgsql-patches
Peter Eisentraut <peter_e@gmx.net> writes:
> Nicolai Tufar wrote:
>> Don't do it! I just tried it with only LC_ALL and it did not
>> work. Same "tags file is not sorted" error message from vi.

> On second look, the patch is completely wrong anyway, because it does
> not export the variables; it depends on the user having exported them
> beforehand.

I saw that, but it seemed a non-problem to me: if the variables have not
been exported then they won't affect the sort program anyway.

I tried to reproduce Nicolai's statement about LC_ALL not being
sufficient, but AFAICT Fedora Core 1 handles this as expected:

$ cat /etc/redhat-release
Fedora Core release 1 (Yarrow)
$ LANG=en_US LC_ALL=en_GB locale
LANG=en_US
LC_CTYPE="en_GB"
LC_NUMERIC="en_GB"
LC_TIME="en_GB"
LC_COLLATE="en_GB"
LC_MONETARY="en_GB"
LC_MESSAGES="en_GB"
LC_PAPER="en_GB"
LC_NAME="en_GB"
LC_ADDRESS="en_GB"
LC_TELEPHONE="en_GB"
LC_MEASUREMENT="en_GB"
LC_IDENTIFICATION="en_GB"
LC_ALL=en_GB
$ cat zzz
abc DEF
ABC DEF
$ LANG=C sort zzz
ABC DEF
abc DEF
$ LANG=en_US sort zzz
abc DEF
ABC DEF
$ LANG=en_US LC_ALL=C sort zzz
ABC DEF
abc DEF


What I suspect is that Nicolai's environment supplies an explicit value
for LC_COLLATE, overriding both LC_ALL and LANG.  If we want to be
bulletproof against that, then none of the proposals in this thread are
correct, and the correct patch is

+ LC_COLLATE=C
+ export LC_COLLATE


            regards, tom lane

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: CATALOG/NOCATALOG for new users
Next
From: David Fetter
Date:
Subject: Re: Patch for psql startup clarity