Re: Trigger problem

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Henry Molina <henrymolina(at)cmn-consulting(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger problem
Date: 2004-12-05 05:44:17
Message-ID: 20041204213432.D69922@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 4 Dec 2004, Henry Molina wrote:

> drop table t1;
> drop table t2;
> create table t1 (id integer);
> create table t2 (id integer);
> CREATE OR REPLACE FUNCTION myfunc() RETURNS trigger AS '
> BEGIN
> insert into t2 values(NEW.id);
> END;
> ' LANGUAGE plpgsql;
>
> CREATE TRIGGER
> mytri
> AFTER INSERT ON t1 FOR EACH STATEMENT
> EXECUTE PROCEDURE myfunc();
> insert into t1 values(1);

Currently statement triggers don't have any way to get at the affected
rowset. A FOR EACH ROW trigger should work for a case like the above,
although I think you'll need to add a return statement to the function as
well.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guy Rouillier 2004-12-05 06:07:39 Select distinct sorting all rows 8.0rc1
Previous Message Michael Fuhr 2004-12-05 05:36:20 Re: Trigger problem