Re: Lower case

From: Dawid Kuroczko <qnex42(at)gmail(dot)com>
To: vladimir(at)sycore(dot)org
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Lower case
Date: 2005-01-26 10:15:16
Message-ID: 758d5e7f050126021535120c3a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-ru-general

On Wed, 26 Jan 2005 12:01:49 +0000, Vladimir S. Petukhov
<vladimir(at)sycore(dot)org> wrote:
> I want to do case-insensitivity search, like this
> ... WHERE lower (column_name) LIKE lower (%value%);
> This work fine for English..
> But i need search for Russian words, lower() operator does not work with
> Russian (non-English) chars, but ORDER works fine...
> ???????????????
> What's wrong?

Welllllll... Have you made an initdb with apropriate locale setting?
Try:
pg_controldata /var/lib/postgresql/data
(or wherever your db is)
You should see lines like:
LC_COLLATE: C
LC_CTYPE: C

If you are using Unicode these should be ru_RU.UTF-8, if not then
ru_RU.KOI8-R or something. If you see 'C', or 'en_EN' or similar
then you won't have Russian lower/upper support (and ORDER BY
was just a "luck" :)).

What you can do:
pg_dump the database, initdb --locale=ru_RU; pg_restore the database.

Ohhh, and since you're at it, there is one thing which makes me
wonder and if you don't mind, please try it. :) This will require
plperlu language, so 'createlang plperlu' and that you use
unicode encoding in your database.

Try if this function:
CREATE OR REPLACE FUNCTION lc(text) RETURNS text AS $$
utf8::decode($_[0]);
return lc($_[0]);
$$ LANGUAGE plperlu STABLE;

Used as select lc(your_text_column) from your_table;
works for Russian alphabet. :) I'm just cuuurious! :)

Regards,
Dawid

In response to

  • Lower case at 2005-01-26 12:01:49 from Vladimir S. Petukhov

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Chille 2005-01-26 10:22:48 Re: difficult JOIN
Previous Message Tino Wildenhain 2005-01-26 10:05:20 Re: Lower case

Browse pgsql-ru-general by date

  From Date Subject
Next Message Michal Hlavac 2005-01-26 10:41:19 Re: Lower case
Previous Message Tino Wildenhain 2005-01-26 10:05:20 Re: Lower case