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
Re: tsearch2: How to use different configurations for two |
| Список | 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 по дате отправления: