RE: Using functions with indexes

Поиск
Список
Период
Сортировка
От Mark Kirkwood
Тема RE: Using functions with indexes
Дата
Msg-id 199911172302.MAA12792@hudev0.hnz.co.nz
обсуждение исходный текст
Ответ на Using functions with indexes  ("Alain TESIO" <tesio@easynet.fr>)
Список pgsql-general
Hi Alain

try this :


create function mylower( varchar) returns varchar as '
  declare
    lowered  alias for $1;
  begin
    return lower(lowered);
  end;
' language 'plpgsql';

create index mytext_s1 on mytext ( mylower(col) varchar_ops);


( assuming table mytext has column "col" )

You will need to have the Language plpgsql installed, if you have not do  :

create function plpgsql_call_handler () returns opaque as
                '/usr/local/pgsql/lib/plpgsql.so' language 'C';

create trusted procedural language 'plpgsql'
               handler plpgsql_call_handler
               lancompiler 'PL/pgSQL';


I found that using language sql to create "mylower" gave an error
at index create time - something about cannot use sql in this context..

Cheers

Mark


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

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Slow Sort and Group By for Star Query
Следующее
От: Juuso Oikarinen
Дата:
Сообщение: indices not being used