Thread: postgresql unicode lower/upper problem

postgresql unicode lower/upper problem

From
Sergey Levchenko
Date:
I am not able to get work lower and upper functions on postgresql
v8.0.1 and 8.1b(current cvs copy). I use Debian SID i686 GNU/Linux.
Locale: ru_RU.KOI8-R

createdb -E UNICODE test
psql test

test=> SET client_encoding TO KOI8;
SET
test=> SELECT t FROM t1;
   t
--------
 пРиВЕТ
 tEsT
(2 rows)

test=> SELECT upper(t) FROM t1;
 upper
--------
 пРиВЕТ
 TEST

test=> SELECT lower(t) FROM t1;
 lower
--------
 пРиВЕТ
 test
(2 rows)

How you can see it work perfect with latin and does not do any
lower/upper with koi8.
what I do wrong?

Re: postgresql unicode lower/upper problem

From
Tom Lane
Date:
Sergey Levchenko <sector119@gmail.com> writes:
> I am not able to get work lower and upper functions on postgresql
> v8.0.1 and 8.1b(current cvs copy). I use Debian SID i686 GNU/Linux.
> Locale: ru_RU.KOI8-R

> createdb -E UNICODE test

I think the problem is you selected a database encoding that doesn't
match what the locale expects.  You can't really mix-and-match if you
expect locale-specific stuff like upper/lower to work.  For that
locale you must use -E KOI8.

            regards, tom lane

Re: postgresql unicode lower/upper problem

From
Sergey Levchenko
Date:
I modify pg_createcluster and add locale options
exec $initdb, '--locale', 'ru_RU.UTF-8', '--encoding', 'UTF-8', '-D', $datadir
then drop and create cluster with my locale. now lower and upper work
good with unicode.

P.S.
it's bad that we can not modify lc_ctype and lc_collate from
postgresql.conf like lc_messages, lc_monetary, ...
I think that it will be good idea to add locale specific options to
pg_createcluster...


On Wed, 23 Mar 2005 12:17:14 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Sergey Levchenko <sector119@gmail.com> writes:
> > I am not able to get work lower and upper functions on postgresql
> > v8.0.1 and 8.1b(current cvs copy). I use Debian SID i686 GNU/Linux.
> > Locale: ru_RU.KOI8-R
>
> > createdb -E UNICODE test
>
> I think the problem is you selected a database encoding that doesn't
> match what the locale expects.  You can't really mix-and-match if you
> expect locale-specific stuff like upper/lower to work.  For that
> locale you must use -E KOI8.
>
>                         regards, tom lane
>