SQL function triggers

From: Brian Blaha <bblaha(at)umr(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: SQL function triggers
Date: 2002-10-15 06:06:03
Message-ID: 3DABB04B.8000104@umr.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I would like to write a function as a set of SQL statements, and then
use that function
in a trigger. However, since triggers require a return type of opaque,
and SQL functions
cannot return type opaque, this doesn't look possible. Am I missing
something? The SQL
that I would expect to do this is below. Incidentally, on an insert,
would the trigger fire
once, twice, or infinitely?

create table test(
a integer,
b integer
) without oids;

create function test_func( test.a%TYPE )
RETURNS ?????
AS
'update test set b = a where a = $1;'
language SQL
with (isstrict);

create trigger test_trig after update
on test for each row
execute procedure test_func( a );

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ludwig Lim 2002-10-15 07:16:28 Re: Slow performance on MAX(primary_key)
Previous Message Keith Gray 2002-10-15 05:01:58 Slow performance on MAX(primary_key)