pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brian Blaha <bblaha@umr.edu>
To: pgsql-sql@postgresql.org
Subject: SQL function triggers
Date: Tue, 15 Oct 2002 06:06:03 +0000
Message-ID: <3DABB04B.8000104@umr.edu> (raw)

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 );





view thread (3+ messages)  latest in thread

Message-ID: <3DABB04B.8000104@umr.edu>
Permalink:  ../3DABB04B.8000104@umr.edu/
Also on:    postgresql.org/message-id/3DABB04B.8000104@umr.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bblaha@umr.edu
  Subject: Re: SQL function triggers
  In-Reply-To: <3DABB04B.8000104@umr.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox