Thread: Character collating order

Character collating order

From
Allan Engelhardt
Date:
I'm having problems with the regression tests.  In particular, the CHAR test fails because of an unexpected character
collatingsequence: 

test=> select 'a' < 'A' AS "Lowercase is low", 'a' > 'A' AS "Uppercase is low";
 Lowercase is low | Uppercase is low
------------------+------------------
 t                | f
(1 row)

The test scripts seems to expect that 'A' < 'a', which is not a completely unreasonable assumption :-)

I'm using the SQL_ASCII encoding, and un-setting the LANG environment variable (which is the only locale variable set
forthe account; it defaults to en_US) for postgres when starting postmaster does not fix it. 

Any suggestions on what I could try?


Allan.

bash-2.04$ rpm -qi postgresql
Name        : postgresql                   Relocations: (not relocateable)
Version     : 7.1.2                             Vendor: (none)
Release     : 4PGDG                         Build Date: Wed 13 Jun 2001 10:18:46 PM BST
Install date: Fri 29 Jun 2001 08:43:51 PM BST      Build Host: lowen.wgcr.org
Group       : Applications/Databases        Source RPM: postgresql-7.1.2-4PGDG.src.rpm
Size        : 4426307                          License: BSD
URL         : http://www.postgresql.org/
Summary     : PostgreSQL client programs and libraries.
[...]
bash-2.04$ uname -a
Linux XXXX 2.4.2-2 #17 SMP Tue Jul 3 14:48:45 BST 2001 i686 unknown



Re: Character collating order

From
Tom Lane
Date:
Allan Engelhardt <allane@cybaea.com> writes:
> I'm using the SQL_ASCII encoding, and un-setting the LANG environment
> variable (which is the only locale variable set for the account; it
> defaults to en_US) for postgres when starting postmaster does not fix
> it.

In 7.1, collation is determined by the locale variables seen at initdb
time.  You probably need to re-initdb with LANG=C.  Try
contrib/pg_controldata to verify the guess that the database's locale
is not C ...

            regards, tom lane

Re: Character collating order

From
Allan Engelhardt
Date:
Tom Lane wrote:

> Allan Engelhardt <allane@cybaea.com> writes:
> > I'm using the SQL_ASCII encoding, and un-setting the LANG environment
> > variable (which is the only locale variable set for the account; it
> > defaults to en_US) for postgres when starting postmaster does not fix
> > it.
>
> In 7.1, collation is determined by the locale variables seen at initdb
> time.  You probably need to re-initdb with LANG=C.  Try
> contrib/pg_controldata to verify the guess that the database's locale
> is not C ...

Bingo!  Re-init and re-start fixes the test script.  Now I just need to figure out how I want to run my
database.........

Thanks a million: you're a hero.


Allan.