On Sat, 29 May 2004, Alvaro Herrera wrote:
> On Sat, May 29, 2004 at 08:25:27AM -0700, Stephan Szabo wrote:
>
> > BTW: For the deferred trigger stuff, I am guessing you haven't touched
> > that at all in the current patch?
> >
> > I wonder if the following would work assuming that we want deferred
> > triggers to run at outer transaction end?
>
> Ah, this seems to work. I'll implement it and I'll let you know how it
> goes.
Ugh... There's one further wrinkle I hadn't thought about, imagine the
following:
begin;
-- here the transaction does something that makes deferred trigger
-- entries
begin;
set constraints all immediate;
-- we now run through doing the deferred trigger items
rollback;
-- we need to unmark that the deferred items from the
-- outer transaction have been run. However, in general,
-- it might not be all entries nor all entries that are marked
-- as done.
I'm not sure how expensive it is to check if a given subxact has
committed, but maybe instead of just done/not done, we need to say
something like what xid marked the trigger and instead of
if (!(event->dte_event & (TRIGGER_DEFERRED_DONE |
TRIGGER_DEFERRED_CANCELED)))
inside deferredTriggerInvokeEvents we do something like:
if (!((event->dte_event & (TRIGGER_DEFERRED_DONE |
TRIGGER_DEFERRED_CANCELED)) && /*something to check that the marking xact
is either myself or a committed subxact*/))
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org