Search

From: Dmitry Popov <mitlas(at)auricvision(dot)com>
To: pgsql-general(at)hub(dot)org
Subject: Search
Date: 1999-07-31 08:15:18
Message-ID: 37A2B096.75EB7EF8@auricvision.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

I store text data in windows-1251 encoding in my pgSQL database
and when I execute SQL command like

SELECT title, firstname, lastname, description FROM stuff
WHERE title LIKE '%<keyword>%' AND firtsname LIKE '%<keyword>%'
AND lastname LIKE '%<keyword>%' AND description LIKE '%<keyword>%'

the response comes really quick, but if I want case independent
search, I should convert, using my own PHP3 function, both search
field and keyword to low case just becouse PostgreSQL by itself
doesn't know how to convert characters in windows-1251 encoding
to low case. And response time grows from 0:07 to 1:10!

Is there any solution? May be stored procedures (that doesn't
require to recompile pgSQL)? Thank you in advance!!!

P.S.: as far as I know there is no locale for windows-1251 and,
unfortunately, I can't store data in koi8-r whose locale present
in almost all UNIX'es.

Mentioned above function:
function lower($str)
{
$length = strlen($str);

for ($i = 0; $i < $length; ++$i)
{
$sym = ord($str[$i]);
if (($sym > 34 && $sym < 60) || ($sym > 191 && $sym < 224))
$str[$i] = chr($sym + 32);
}

return $str;
}

--
BEST WISHES, Dmitry
Webmaster, DeltaCube Studio
http://www.deltacube.com/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hub.Org News Admin 1999-07-31 23:01:56
Previous Message Bruce Momjian 1999-07-30 18:10:00 Re: [GENERAL] Is "OFFSET" a reserved word?