Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> Sort of, but it still isn't sufficient. There's no way to say for certain
> that a later deferred trigger won't send an exception that will roll back
> the transaction. What he'd really need would be something that occurs
> after the deferred trigger queue and after the transaction has committed
> that cannot cause the transaction to rollback (I'm not sure what an
> error condition raised in such a state would do...)
Good point. One possibility is to do the external action outside the
database, perhaps in a daemon process that's listening for NOTIFYs sent
by the trigger. (NOTIFY events are delivered only if the transaction
commits.) You'd need some additional tables to record the actions the
daemon is supposed to take, since NOTIFY alone can't carry much of an
information payload.
regards, tom lane