From: | "Richard Huxton" <dev(at)archonet(dot)com> |
---|---|
To: | <depesz(at)depesz(dot)pl>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: how do i create trigger with params? |
Date: | 2001-03-11 20:48:19 |
Message-ID: | 005e01c0aa6c$9d8801a0$1001a8c0@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
From: "hubert depesz lubaczewski" <depesz(at)depesz(dot)pl>
> i would like to create c-type trigger which is used with params.
> so i created function:
> CREATE function dfti(text) RETURNS opaque as
> '/home/users/pgdba/work/lib/dfti.so' language 'C';
> o.k. created
> byt when i try to:
> CREATE trigger dfti_trg after INSERT or UPDATE or DELETE on newstexts for
each
> row execute procedure dfti ('newstexts');
> i get:
> psql:create.sql:9: ERROR: CreateTrigger: function dfti() does not exist
>
> which is of course true. function dfti() doesn't exist, but i wanted to
use
> dfti(text)!
I'll quote Stephen Szabo from a couple of days ago (check archive for full
details)
>
> Right, because triggers take arguments differently. Trigger functions
> must return opaque and take no arguments. Arguments passed at create
> trigger time are passed in via TG_ARGV[] (number in TG_NARGS i believe)
>
I think there's probably an example of this in contrib/noupdate.
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2001-03-11 21:15:36 | Re: Money... |
Previous Message | Chris Humphries | 2001-03-11 19:41:16 | Re: Anyone can create tables! |