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

From Tomas Berndtsson
Subject Re: Simple Question: Case sensitivity
Date
Msg-id 80ofyj0y1h.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
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Tomas Berndtsson <tomas@nocrew.org> writes:
> > 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.
>
> Sure, make a functional index:
>
> play=> create table foo (f1 text);
> CREATE
> play=> create index fooi on foo (upper(f1));
> CREATE

Ah, great, thanks. Couldn't see anything about that in the manual.

> This index will be considered for queries like:
>
> play=> explain select * from foo where upper(f1) = 'z';

Don't you need upper('z')?


Tomas

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Simple Question: Case sensitivity
Next
From: "Robert D. Nelson"
Date:
Subject: RE: storing passwords