lower() for varchar data by creating an index

From: Alex Guryanow <gav(at)nlr(dot)ru>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: lower() for varchar data by creating an index
Date: 2000-05-17 07:51:49
Message-ID: 11494.000517@nlr.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I have a table called t1 with field f1 of type varchar(40):

CREATE TABLE t1 (f1 varchar(40));

To make a case insensitive search I build the query like

SELECT f1 FROM t1 WHERE lower( f1 ) LIKE 'alex%';

This works fine. But when I try to make an index to speed up the query using the command

CREATE INDEX t1_f1_idx ON t1 (lower(f1));

I receive the following error:

ERROR: DefineIndex: function 'lower(varchar)' does not exist

Why by executing the query the function 'lower(varchar)' exists and by creating the index don't?

I use Postgres 7.0.

Best regards,
Alex

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Yamini Sharma 2000-05-17 12:43:47 Storing binary data in a column
Previous Message Rudolph, Michael 2000-05-17 06:11:22 AW: What is the difference between NULL and "undef"