From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | Jay Dickon Glanville <dickon(dot)glanville(at)gmail(dot)com> |
Cc: | Martijn van Oosterhout <kleptog(at)svana(dot)org>, PostgreSQL General ML <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Event-driven programming? |
Date: | 2007-09-12 17:39:20 |
Message-ID: | 1189618760.17210.8.camel@dogma.ljc.laika.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 2007-09-12 at 13:10 -0400, Jay Dickon Glanville wrote:
> On 9/12/07, Martijn van Oosterhout <kleptog(at)svana(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-09-12 17:42:31 | Re: problems with large table |
Previous Message | Jay Dickon Glanville | 2007-09-12 17:10:17 | Re: Event-driven programming? |