Re: Simple Question: Case sensitivity - Mailing list pgsql-general

From Vince Vielhaber
Subject Re: Simple Question: Case sensitivity
Date
Msg-id Pine.BSF.4.30.0012110921070.19745-100000@paprika.michvhf.com
Whole thread Raw
In response to Re: Simple Question: Case sensitivity  (Tomas Berndtsson <tomas@nocrew.org>)
List pgsql-general
On 11 Dec 2000, Tomas Berndtsson wrote:

> "Hancock, David (DHANCOCK)" <DHANCOCK@arinc.com> writes:
>
> > Abe: It's an SQL thing or a scripting thing.  It's probably easiest and
> > safest in the SQL:
> >
> >    select firstname, surname from employees
> >       where upper(firstname) like upper('%$criteria%') or
> >       upper(surname) like upper('%$criteria%')
> >
> > That is, force the column and the search string to uppercase befor
> > comparing, and it won't matter how it's stored in the database.
>
> Related to this, is there any way to make an index for a table
> case-insensitive? If you have an index, but use upper() in the select,
> the index is not used.

You can create your index as upper or lower and it'll be used in a
select that uses upper().

Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
 128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================




pgsql-general by date:

Previous
From: "George Johnson"
Date:
Subject: one other big mysql->postgresql item
Next
From: Tom Lane
Date:
Subject: Re: Regular expression question