Triggers have to return type "opaque" for procedural language functions (like
if they're written in pl/pgsql). If you need the function defined in C, it
looks like this link might help you out:
http://www.postgresql.org/idocs/index.php?triggers.html
Note that it's pretty easy to make a trigger in pl/pgsql, and from first
glance it looks somewhat more difficult to write it in C. It, of course,
depends on how important performance is to your particular application.
Regards,
Jeff Davis
On Tuesday 03 September 2002 01:22 am, Jenia wrote:
> Hi
>
> I am having troubles creating triggers using my functions ..
> I have created the shared library with some functions which
> appear to work in SELECT statement ..
> But when I try to use those function in CREATE TRIGGER statement
> it says that function doesn't exist ...
>
> Any ideas ?
> Thanks a lot
>
> Yevgeny
>
> I am using PostgresQL 7.2 on RedHat 7.3 ..
>
>
> # load '/usr/local/lib/libtest.so';
> LOAD
> # create function more_than(integer,integer) returns integer
> # as '/usr/local/lib/libtest.so','test' language c;
> CREATE
> # select more_than(4,6) as answer;
> answer
> --------
> 0
> (1 row)
>
> # select more_than(14,6) as answer;
> answer
> --------
> 1
> (1 row)
>
> # create trigger t_one
> # after insert on t_table1 for each row
> # execute procedure more_than(7, 4);
> ERROR: CreateTrigger: function more_than() does not exist
> #
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)