Re: BUG #7783: lower & upper function incorrect work - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #7783: lower & upper function incorrect work
Date
Msg-id 3144.1357252168@sss.pgh.pa.us
Whole thread Raw
In response to BUG #7783: lower & upper function incorrect work  (alex.shniperson@gmail.com)
List pgsql-bugs
alex.shniperson@gmail.com writes:
> PostgreSQL version: 9.1.7
> Operating system:   osx lion 10.7.5

> 1) create DataBase with
> ENCODING = 'UTF8'
> LC_COLLATE = 'C'
> LC_CTYPE = 'C'

> 3) insert one simple record with Russian word

> INSERT INTO testtable (id, name) VALUES (1, 'Залог');

> 4) try to select data with upper & lower functions with 'like' operator

> select *, lower(name), upper(name) from testtable where lower(name) like
> '%залог%'

This is not a bug.  You specified LC_CTYPE = "C", so upper/lower case
conversion converts only ASCII letters.  You need to specify a Russian
locale if you want case conversion to work on Russian letters.

Now having said that, I'm pretty sure that UTF8 locales are completely
broken on OS X, so that this wouldn't work even if you had specified
the right locale.  But that's Apple's fault; there's little we can do
about it.  I believe locale ru_RU.ISO8859-5 (with the matching encoding)
would behave sanely on OS X, if that's an acceptable fix for you.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Aleksander Shniperson
Date:
Subject: Re: BUG #7783: lower & upper function incorrect work
Next
From: David Johnston
Date:
Subject: Re: BUG #7784: trouble with pl ERROR: missing FROM-clause entry for table