lower() for varchar data by creating an index - Mailing list pgsql-sql

From Alex Guryanow
Subject lower() for varchar data by creating an index
Date
Msg-id 11494.000517@nlr.ru
Whole thread Raw
List 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




pgsql-sql by date:

Previous
From: "Rudolph, Michael"
Date:
Subject: AW: What is the difference between NULL and "undef"
Next
From: Yamini Sharma
Date:
Subject: Storing binary data in a column