Re: Operator "=" not unicode-safe? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Operator "=" not unicode-safe?
Date
Msg-id 26649.1124476820@sss.pgh.pa.us
Whole thread Raw
In response to Operator "=" not unicode-safe?  (Jörg Haustein <Joerg.Haustein@urz.uni-heidelberg.de>)
List pgsql-bugs
Jörg Haustein <Joerg.Haustein@urz.uni-heidelberg.de> writes:
> I have a UNICODE database, trying to compare two unicode strings (Ethiopic
> characters). Client encoding is also UNICODE:
> ===================================================
> testdb=> select 'በድሩ ሁሴን'='ሰይፉ ከበደ';
>  ?column?
> ----------
>  t
> (1 row)

> Clearly, it can be seen that they are not equal.

Sounds to me like you chose a locale that is expecting some non-Unicode
encoding.  "=" ultimately depends on the system's strcoll() routine,
and in many locales strcoll doesn't behave very sanely when handed data
that's illegal in whatever it thinks the encoding is.

Redo your initdb in a locale that is UTF-8 based, and make sure to keep
the database encoding UTF8.  The apparent flexibility to choose
different database encodings really only works if the underlying locale
is "C".

There is a warning about this in the docs, though perhaps not prominent
enough:
http://www.postgresql.org/docs/8.0/static/multibyte.html#AEN20633
        regards, tom lane


pgsql-bugs by date:

Previous
From: Jörg Haustein
Date:
Subject: Operator "=" not unicode-safe?
Next
From: "Jim C. Nasby"
Date:
Subject: Re: [GENERAL] BUG #1830: Non-super-user must be able to copy