Sorting problems with SELECT * FROM table WHERE name LIKE 'Ö%'

From: Nico Grubert <nicogrubert(at)arcor(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Sorting problems with SELECT * FROM table WHERE name LIKE 'Ö%'
Date: 2005-10-30 16:17:01
Message-ID: 4364F1FD.6040102@arcor.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there,

I have a problem when sorting records with:
SELECT * FROM table WHERE name LIKE 'Ö%'

I am running Postgres 8.02 with a database whose character encoding is
UNICODE.

The SQL Query

SELECT *
FROM member
WHERE name LIKE 'O%'
OR
name like 'Ö%'
ORDER BY name

returns this:
Öhlmann
Öhmann
Obenaus
Ochoa
O'Donovan
Oehme
Oklant
Oltub
Oltüch
Oltutz
Oltüwer

According to german sorting rules the result is fine except the both
first entries "Öhlmann" and "Öhmann".
Why do appear these records at the beginning of the list?
The proper result should read like this:
Obenaus
Ochoa
O'Donovan
Oehme
Öhlmann
Öhmann
Oklant
Oltub
Oltüch
Oltutz
Oltüwer

The same problem accours when using "E" where my result is this:
Élie de Beaumont
Eberer
Ecü
Edding
Emmer

The proper result should be:
Eberer
Ecü
Edding
Élie de Beaumont
Emmer

Any idea how I can solve this problem?

Thank you very much in advance,
Nico

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2005-10-30 16:24:01 Re: mysql replace in postgreSQL?
Previous Message Tom Lane 2005-10-30 16:05:28 Re: Please HELP - URGENT - transaction wraparound error