Re: BUG #7783: lower & upper function incorrect work

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: alex(dot)shniperson(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7783: lower & upper function incorrect work
Date: 2013-01-03 22:29:28
Message-ID: 3144.1357252168@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

alex(dot)shniperson(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Johnston 2013-01-04 01:30:21 Re: BUG #7784: trouble with pl ERROR: missing FROM-clause entry for table
Previous Message Aleksander Shniperson 2013-01-03 19:52:03 Re: BUG #7783: lower & upper function incorrect work