Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DE709475E20 for ; Tue, 15 Oct 2002 02:05:06 -0400 (EDT) Received: from smtp.umr.edu (mrelay1.cc.umr.edu [131.151.1.120]) by postgresql.org (Postfix) with ESMTP id 40C15475DDB for ; Tue, 15 Oct 2002 02:05:06 -0400 (EDT) Received: from umr.edu (d-131-151-186-104.dynamic.umr.edu [131.151.186.104]) via ESMTP by mrelay1.cc.umr.edu (8.12.1/) id g9F656Gs025955; Tue, 15 Oct 2002 01:05:06 -0500 Message-ID: <3DABB04B.8000104@umr.edu> Date: Tue, 15 Oct 2002 06:06:03 +0000 From: Brian Blaha User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.1) Gecko/20020815 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: SQL function triggers Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/151 X-Sequence-Number: 9868 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 );