Re: Simple Question: Case sensitivity

From: Tomas Berndtsson <tomas(at)nocrew(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 15:37:14
Message-ID: 80ofyj0y1h.fsf@junk.nocrew.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Tomas Berndtsson <tomas(at)nocrew(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Ansley 2000-12-11 15:41:13 RE: Regular expression question
Previous Message Tom Lane 2000-12-11 15:32:58 Re: [HACKERS] AW: Oracle-compatible lpad/rpad behavior