Skip site navigation (1) Skip section navigation (2)

Re: ORDER BY and Unicode

From: Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de>
To: marcbastin(at)mindspring(dot)com (M(dot) Bastin)
Cc: sszabo(at)megazone(dot)bigpanda(dot)com (Stephan Szabo),pgsql-novice(at)postgresql(dot)org
Subject: Re: ORDER BY and Unicode
Date: 2004-05-12 17:41:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I'd like to make a small comment on this one ...

M. Bastin wrote:
 > "locale -a" isn't recognized on OS X.  How else can I find the 
 > possible locales?

On most UNIX-like systems they're under /usr/share/locale
or similar.  Maybe the setlocale(3) manpage will help you
(at least on BSD it mentions the default location of the

 > And how can I do an initdb so that sorting on Unicode will work for 
 > French, Greek, Japanase, etc. users of a single database?

You can't do that in general, because different languages
can use different rules for sorting and case conversion of
the same characters.

For example, in the Turkish language there is a character
"i" without a dot, and "I" with a dot (I only have an ISO-
8859-15 set right now, so I can't demonstrate them), where
upper("i") == "I" with dot, and lower("I") == "i" without
dot.  Most other languages have upper("i") == "I" and
lower("I") == "i", so it's not possible to have a locale
setting that supports both at the same time.

I guess that PostgreSQL's ORDER BY and case conversions
ignore the client's locale setting completely, and only
respect the locale of the database (when it was created).
Beware, I'm not a PostgreSQL developer, so don't take that
as an authoritative statement.  ;-)


Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 M√ľnchen
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"The scanf() function is a large and complex beast that often does
something almost but not quite entirely unlike what you desired."
        -- Chris Torek

In response to

pgsql-novice by date

Next:From: Stephan SzaboDate: 2004-05-12 21:51:52
Subject: Re: ORDER BY and Unicode
Previous:From: Tom LaneDate: 2004-05-12 17:04:40
Subject: Re: pg_dump problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group