Re: tsearch2: How to use different configurations for two columns?

Поиск
Список
Период
Сортировка
От Andrew J. Kopciuch
Тема Re: tsearch2: How to use different configurations for two columns?
Дата
Msg-id 200512090935.44264.akopciuch@bddf.ca
обсуждение исходный текст
Ответ на Re: tsearch2: How to use different configurations for two columns?  ("Andrew J. Kopciuch" <akopciuch@bddf.ca>)
Ответы Re: tsearch2: How to use different configurations for two  (Stephan Vollmer <svollmer@gmx.de>)
Re: tsearch2: How to use different configurations for two  (Stephan Vollmer <svollmer@gmx.de>)
Список pgsql-general
> You could write a one trigger for the table to handle both.
>

Something like this :


-----

CREATE OR REPLACE FUNCTION multi_tsearch2() RETURNS TRIGGER AS '
DECLARE
BEGIN
    NEW.fti_title = to_tsvector(''default'', NEW.title);
    NEW.fti_author_list = to_tsvector(''simple'', NEW.author_list);
    RETURN NEW;
END;
' LANGUAGE 'PLPGSQL';

CREATE TRIGGER tsvectorupdate_all
  BEFORE INSERT OR UPDATE ON publications
  FOR EACH ROW
  EXECUTE PROCEDURE multi_tsearch2();

----


You can modify the function to be slightly more configurable with parameters
taking the column names, and config names and make it a little more reusable.
You can accomplish what you want though.



Andy

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

Предыдущее
От: William
Дата:
Сообщение: PgSQL 8.1.0 Solaris w/ Sun's cc
Следующее
От: Luca Pireddu
Дата:
Сообщение: Re: bug or not? Trigger preventing delete causes circumvention