Re: a primer on trigger? - Mailing list pgsql-general

From Joel Burton
Subject Re: a primer on trigger?
Date
Msg-id Pine.LNX.4.21.0105041241140.29487-100000@olympus.scw.org
Whole thread Raw
In response to Re: a primer on trigger?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: Re: a primer on trigger?
Re: a primer on trigger?
Re: Re: a primer on trigger?
List pgsql-general
On Fri, 4 May 2001, Stephan Szabo wrote:

> However (and it's a big one), you should
> only ever consider modifying something outside
> of the database from a trigger if it's
> something that is absolutely safe to do
> if the transaction rolls back.

Hmmm... this raises an interesting question.

Would it be possible to hook into (via trigger or other mechanism) so that
we could execute a function on commit? There are PG triggers to do things
like send email, etc., which, yes, can't be undone if the transaction
ultimately fails. Instead, could we:

1) have a trigger that (in this case) instead of sending email, just adds
the information to an 'email-to-send' table.

2) commit the transaction

3) the trigger TRANSACTION_AFTER is called, and from that, we can scan the
table, and actually do some of these system calls?


Can this be done? Is this terrible design? Is there any other reasonable
way to handle things like this?

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


pgsql-general by date:

Previous
From: Joel Burton
Date:
Subject: Re: a primer on trigger?
Next
From: "Gyozo Papp"
Date:
Subject: Re: arbitrary number of values from a sequence