On Thu, 22 Mar 2001, Peter Choe wrote:
> can i use pl/pgsql to write a trigger to update a separate table?
You should be able to. You can use update, etc, from the trigger.
For example a simple summing one might be (not really tested)
create function summer() returns opaque
as '
begin;
update table2 set val=val+NEW.val where id=NEW.id;
return NEW;
end;
' language 'plpgsql';
)
create trigger tr after insert on table1 for each row execute
procedure summer();