Collation in ORDER BY not lexicographical

From: Paul Gaspar <devlist(at)revolversoft(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Collation in ORDER BY not lexicographical
Date: 2009-09-29 08:52:02
Message-ID: 20BC5D30-5677-4E0F-A9EB-A05DBC2CE866@revolversoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

We have big problems with collation in ORDER BY, which happens in
binary order, not alphabetic (lexicographical), like:.

A
B
Z
a
z
Ä
Ö
ä
ö

This is what we have done:

1. initdb -U myuser -E UTF-8 --locale=de_DE.UTF-8 -D /mydata

2. pg_ctl -U myuser -D /mydata -l logfile start

3. createdb -U myuser mydb

4. create table mytable(name text)

5. insert into mytable values('Adam'); ....

6. select * from mytable order by name

The result is:

"Adam"
"Berta"
"Mann"
"Zoo"
"Zoodirektor"
"adam"
"Äpfel"
"Öl"
"äpfel"

"locale -a" shows:

de_DE
de_DE.ISO8859-1
de_DE.ISO8859-15
de_DE.UTF-8

"psql -l" shows:

List of databases
Name | Owner | Encoding | Collation | Ctype
| Access privileges
----------+-----------+----------+-------------+-------------
+-----------------------------------
postgres | myuser | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 |
template0 | myuser | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 | =c/myuser
: myuser =CTc/myuser
template1 | myuser | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 | =c/myuser
:
myuser =CTc/myuser
mydb | myuser | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 |

PG is running on Mac OS X 10.5 and 10.6 Intel.

Any help is appreciated. Thanks very much in advance.

Paul

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-09-29 09:21:24 Re: Collation in ORDER BY not lexicographical
Previous Message Richard Huxton 2009-09-29 08:34:19 Re: Using Insert - Default in a condition expression ??