Re: Simple Question: Case sensitivity

From: Vince Vielhaber <vev(at)michvhf(dot)com>
To: Tomas Berndtsson <tomas(at)nocrew(dot)org>
Cc: "Hancock, David \(DHANCOCK\)" <DHANCOCK(at)arinc(dot)com>, "'pgsql-general(at)postgresql(dot)org '" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Simple Question: Case sensitivity
Date: 2000-12-11 14:22:29
Message-ID: Pine.BSF.4.30.0012110921070.19745-100000@paprika.michvhf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11 Dec 2000, Tomas Berndtsson wrote:

> "Hancock, David (DHANCOCK)" <DHANCOCK(at)arinc(dot)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(at)michvhf(dot)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
==========================================================================

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Fabrice Scemama 2000-12-11 14:24:05 Re: one other big mysql->postgresql item
Previous Message Alessio Bragadini 2000-12-11 12:20:11 Re: Problems with starting Postgres