Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Why can't we call the callback before we commit so it can modify the
He wanted that too...
A user callback before we start the commit sequence seems doable,
although there's some question in my mind of exactly when it should
happen. The last point at which it'd really be safe to execute
arbitrary actions is just before DeferredTriggerEndXact() --- what
if you make a database change that fires deferred triggers? Surely
those would have to be executed before we can commit. As you move
further down in the sequence, successively larger chunks of
functionality become unsafe to invoke. But depending on what you
want the callback for, you might not want all that stuff running
after you get called; all of it can potentially cause errors and thereby
prevent the commit from occurring.
I got the impression that Thomas wanted this in order to kluge up
some kind of two-phase-commit support, in which case he really needs
to get control at the point where we're just about to really truly
commit (ie, write the commit WAL record). That's certainly not a
location where we want random users to be inserting code; as such
I don't think that exposing a callback hook is the right answer.
My advice to him is to go in and change the code.
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Bruce Momjian||Date: 2004-01-31 19:44:32|
|Subject: Re: Transaction callback|
|Previous:||From: David Helgason||Date: 2004-01-31 19:23:43|
|Subject: Re: Transaction callback |