Re: ROLLBACK triggers? - Mailing list pgsql-hackers

From Greg Stark
Subject Re: ROLLBACK triggers?
Date
Msg-id 878xt6wvco.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: ROLLBACK triggers?  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-hackers
"Jim C. Nasby" <jnasby@pervasive.com> writes:

> On Mon, Jan 23, 2006 at 06:35:18PM +0900, Daisuke Maki wrote:
> > A quick scan of the docs and the source code tree seems to indicate that
> > there is no such thing as a rollback trigger, short of hacking it.
> > 
> > Now, I'm wondering:
> >   1. Is there a rollback/commit trigger? If not, is it planned to be
> >      implemented at all?
> >   2. Is there a way to undo changes to data external to postgres
> >      when a rollback occurs, OR, only update that external data
> >      when a commit occurs?
> 
> Actually, this is something that often comes up in terms of
> LISTEN/NOTIFY and doing external non-transactional stuff like sending
> emails. AFAIK there's no plans to add support for anything like a
> rollback trigger.

Well, note that in the case of LISTEN/NOTIFY the receiving side doesn't see
the message until the sender commits. Precisely to maintain transactional
integrity.

If the external work can never fail then it seems like just postponing the
processing of it until transaction commit time like deferred constraints would
be better. I'm not sure you can really do that currently though.

-- 
greg



pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: ROLLBACK triggers?
Next
From: Bruce Momjian
Date:
Subject: Re: Libpq COPY optimization