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

From Tomas Berndtsson
Subject Re: Simple Question: Case sensitivity
Date
Msg-id 80wvd71beg.fsf@junk.nocrew.org
Whole thread Raw
In response to RE: Simple Question: Case sensitivity  ("Hancock, David (DHANCOCK)" <DHANCOCK@arinc.com>)
Responses Re: Simple Question: Case sensitivity  (Vince Vielhaber <vev@michvhf.com>)
Re: Simple Question: Case sensitivity  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
"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.


Tomas

pgsql-general by date:

Previous
From: Wooi K
Date:
Subject: function that return multiple fields and rows
Next
From: Alessio Bragadini
Date:
Subject: Re: Problems with starting Postgres