Re: [GENERAL] non-case sensitive searches - Mailing list pgsql-general

From Tim Williams
Subject Re: [GENERAL] non-case sensitive searches
Date
Msg-id 199901131612.KAA24820@ug.eds.com
Whole thread Raw
In response to Re: [GENERAL] non-case sensitive searches  (Kevin Heflin <kheflin@shreve.net>)
List pgsql-general
>
> On Wed, 13 Jan 1999, Gilles Darold wrote:
>
> > Hi Kevin,
> >
> > You can also use regexp expression like this :
> >
> >     SELECT * FROM photos WHERE keywords ~* '.*$cat_name.*';
> >
> > it works fine.
>
>
> Thanks for the tip. Any recommendations as to which would be faster when
> searching about 2,000 records or so..
>
> WHERE keywords ~* '.*$cat_name.*';
>
> or
>
> WHERE lower(keywords) LIKE lower('%$cat_name%')

Well, you could (1) omit the second "lower()" function
(like '%cat_name%' is already in lower case!) (2) insure that your
table already contains nothing but lower-case (or upper-case) entries,
if appropriate.

- Tim

pgsql-general by date:

Previous
From: Jeremiah Davis
Date:
Subject: Re: [GENERAL] non-case sensitive searches
Next
From: Dustin Sallings
Date:
Subject: Re: [GENERAL] Tricky SQL query (tried [SQL])