Обсуждение: upgrading tsearch2: how to call function in trigger

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

upgrading tsearch2: how to call function in trigger

От
robert
Дата:
Hi there,

I am in the process of porting an application from V8.1 to 9.x
Now I have the following situation:

there is a function tsearch2:
CREATE FUNCTION tsearch2() RETURNS "trigger"
     AS '$libdir/tsearch2', 'tsearch2'
     LANGUAGE c;

a second function:
CREATE FUNCTION dropatsymbols(text) RETURNS text
     AS $_$select replace($1,'-', ' ');select replace($1,':', ' ');$_$
     LANGUAGE sql;

and an update trigger that is fired when a record is inserted:
CREATE TRIGGER dok_tsvectorupdate
     BEFORE INSERT OR UPDATE ON dokument
     FOR EACH ROW
     EXECUTE PROCEDURE tsearch2('idxfti_dok', 'dropatsymbols', 'docnum',
'titel', 'deskriptoren', 'ablage', 'ort');


Now my problem:
In above trigger tsearch2 is called with:
     tsearch2('idxfti_dok', 'dropatsymbols', 'docnum', 'titel', 'deskriptoren',
'ablage', 'ort');
which generates the error:
ERROR:  column "dropatsymbols" does not exist

which is correct as dropatsymbols is a function and not a column.

what should I do to avoid said error?

thanks for your time

robert