Re: ROLLBACK triggers?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Daisuke Maki <daisuke(at)wafu(dot)ne(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ROLLBACK triggers?
Date: 2006-01-23 20:19:19
Message-ID: 878xt6wvco.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Jim C. Nasby" <jnasby(at)pervasive(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-01-23 20:20:05 Re: Libpq COPY optimization
Previous Message Jonah H. Harris 2006-01-23 18:36:22 Re: ROLLBACK triggers?