Обсуждение: DefineIndex: function 'lower(varchar)' does not exist !?!?!?

Поиск
Список
Период
Сортировка

DefineIndex: function 'lower(varchar)' does not exist !?!?!?

От
Philip Hallstrom
Дата:
Hi -
    I swore that somewhere I read that you could create an index on a
function of one of the columns to speed things up... instead of having to
do:
SELECT... WHERE LOWER(col) = LOWER('string')
but I'm having a devil of a time getting it to work.  Can anyone tell me
what I'm doing wrong?  Do I need to create a separate SQL function called
say "varcharlower" which does "lower(text(x))" ???
Thanks!
test=> create table foo ( x varchar(10));
CREATE
test=> create index foo_idx on foo (lower(x));
ERROR:  DefineIndex: function 'lower(varchar)' does not exist
test=> create index foo_idx on foo (lower(text(x)));
ERROR:  parser: parse error at or near "("
test=> create table bar ( x text);
CREATE
test=> create index foo_idx on bar (lower(x));
CREATE