On Wed, 2007-09-12 at 13:10 -0400, Jay Dickon Glanville wrote:
> On 9/12/07, Martijn van Oosterhout <kleptog@svana.org> wrote:
> > On Wed, Sep 12, 2007 at 12:36:22PM -0400, Jay Dickon Glanville wrote:
> > > Hello all.
> > >
> > > Is it possible for PostgreSQL to notify me of a successful transaction commit?
> >
> > There is the LISTEN/NOTIFY mechanism. It's not automatic but I think it
> > does most of what oyu want.
>
> Thanks for the suggestion Martijn, but I get the impression from the
> documentation that LISTEN/NOTIFY is for client to client
> communication. This type of communication isn't what I'm looking for.
> I want server to client communication, where the server is notifying
> me on successful commit of transaction.
>
LISTEN/NOTIFY may be closer to what you want than you think. If you have
a trigger that issues a "NOTIFY foo" for any INSERT/UPDATE/DELETE, it
will only generate one notification per transaction, and only as part of
a successful COMMIT.
Then, your application can check for this notification periodically or
perhaps before returning cached data.
LISTEN/NOTIFY are well suited for cache invalidation.
Regards,
Jeff Davis