Skip site navigation (1) Skip section navigation (2)

Re: Transaction callback

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Thomas Hallgren <thhal(at)mailblocks(dot)com>,pgsql-hackers(at)postgresql(dot)org
Subject: Re: Transaction callback
Date: 2004-01-31 19:26:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
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
> 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

In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 2004-01-31 19:44:32
Subject: Re: Transaction callback
Previous:From: David HelgasonDate: 2004-01-31 19:23:43
Subject: Re: Transaction callback

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group