upgrading tsearch2: how to call function in trigger

From: robert <robert(at)redcor(dot)ch>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, Herzberg Daniel <daniel(dot)herzberg(at)aerodynamics(dot)ch>, robert rottermann <robert(at)redcor(dot)ch>
Subject: upgrading tsearch2: how to call function in trigger
Date: 2011-12-07 07:57:43
Message-ID: 4EDF1C77.6070202@redcor.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-12-07 08:18:00 Re: [pgadmin-support] Help for Migration
Previous Message Mamatha_Kagathi_Chan 2011-12-07 07:23:24 Re: [pgadmin-support] Help for Migration