Re: ORDER BY and Unicode - Mailing list pgsql-novice

From Oliver Fromme
Subject Re: ORDER BY and Unicode
Date
Msg-id 200405121741.i4CHfDvW062018@lurza.secnetix.de
Whole thread Raw
In response to Re: ORDER BY and Unicode  ("M. Bastin" <marcbastin@mindspring.com>)
List 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
locales).

 > 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.  ;-)

Regards
   Oliver

--
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

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump problem
Next
From: "M. Bastin"
Date:
Subject: Re: ORDER BY and Unicode