Using functions with indexes

Поиск
Список
Период
Сортировка
От Alain TESIO
Тема Using functions with indexes
Дата
Msg-id 008c01bf2fc8$cd5c34c0$f65f72c3@atesio
обсуждение исходный текст
Список pgsql-general
Hello,

I want to use an index for comparisons on strings which are
not case-sensitive (I'm currently using col2=lower(col1))

The type of the column is char(30), it looks like I can't
use the function lower directly as it's not working on
the right type :

dip=> create index idx_tmpplayer_add_low on TMPPLAYER ( lower ( EM_ADDRESS )
text_ops );
ERROR:  BuildFuncTupleDesc: function 'lower(bpchar)' does not exist

But I can't manage to define such a function I need for the index, what's
the trick ?

dip=> create function mylower(char) returns char as 'select lower($1)'
language 'sql';
ERROR:  return type mismatch in function: declared to return char, returns
text
dip=> create function mylower(char) returns char as 'select
char(lower(char_text($1)))' language 'sql';
ERROR:  parser: parse error at or near "lower"


Thanks
Alain



В списке pgsql-general по дате отправления:

Предыдущее
От: "Alain TESIO"
Дата:
Сообщение: Basic question about indexes (6.5.2)
Следующее
От: "Aaron J. Seigo"
Дата:
Сообщение: Re: [GENERAL] Basic question about indexes (6.5.2)