Bruce Momjian <[EMAIL PROTECTED]> writes: > Why can't we call the callback before we commit so it can modify the > database?
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 ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org