Re: Transaction callback

Started by Kevin Fieldabout 19 years ago2 messagesgeneral
Jump to latest
#1Kevin Field
kev@brantaero.com

http://archives.postgresql.org/pgsql-hackers/2004-01/msg00861.php

(Just to dredge up another old thread...)

While its true that a post-commit operation cannot modify a database, it
might still for instance propagate the outcome of the transaction to another
resource outside of the database, it might invalidate a transaction local
in-memory cache, or it might clear resources occupied in memory for a rule
system, etc.

This is exactly what I'd like to do. Is there a way to do it nowadays?
What I'm going for is an AJAX app that doesn't need to poll the
server, but rather can have the server callback to it when a transaction
messes with the data a user at which a user is looking.

Any advice would be much appreciated.

Thanks,
Kev

#2Jorge Godoy
jgodoy@gmail.com
In reply to: Kevin Field (#1)

Kevin Field <kev@brantaero.com> writes:

http://archives.postgresql.org/pgsql-hackers/2004-01/msg00861.php

(Just to dredge up another old thread...)

While its true that a post-commit operation cannot modify a database, it
might still for instance propagate the outcome of the transaction to another
resource outside of the database, it might invalidate a transaction local
in-memory cache, or it might clear resources occupied in memory for a rule
system, etc.

This is exactly what I'd like to do. Is there a way to do it nowadays? What
I'm going for is an AJAX app that doesn't need to poll the server, but rather
can have the server callback to it when a transaction messes with the data a
user at which a user is looking.

Any advice would be much appreciated.

I believe that you'll be wanting to take a look at the NOTIFY and LISTEN
commands.

http://www.postgresql.org/docs/8.1/interactive/sql-notify.html
http://www.postgresql.org/docs/8.1/interactive/sql-listen.html

Be seeing you,
--
Jorge Godoy <jgodoy@gmail.com>