Re: [GENERAL] Problem with async notifications of table updates

2008-03-20 Thread Karsten Hilbert
On Thu, Mar 20, 2008 at 02:08:13PM +0100, Martijn van Oosterhout wrote: > > It's great fun to watch people from all across the globe > > change data on test patients in our public test database. > > The frontend is written to display such updates in realtime > > (well, whatever it takes to get the

Re: [GENERAL] Problem with async notifications of table updates

2008-03-20 Thread Martijn van Oosterhout
On Thu, Mar 20, 2008 at 12:40:46PM +0100, Karsten Hilbert wrote: > It's great fun to watch people from all across the globe > change data on test patients in our public test database. > The frontend is written to display such updates in realtime > (well, whatever it takes to get the notification de

Re: [GENERAL] Problem with async notifications of table updates

2008-03-20 Thread Karsten Hilbert
On Wed, Mar 19, 2008 at 11:37:16AM +1030, Tyler, Mark wrote: > > Oh, you can, you can calculate the name of the NOTIFY dynamically > > in the trigger sending the notify, for example embedding a primary key > value. > > I don't understand how this can work. Surely my subscriber applications > hav

Re: [GENERAL] Problem with async notifications of table updates

2008-03-19 Thread Klint Gore
Tom Lane wrote: "Tyler, Mark" <[EMAIL PROTECTED]> writes: What I want to do is to guarantee that the row is available for selection prior to sending the message. You cannot do that with an AFTER trigger, because whatever it does necessarily happens before your transaction commits. I s

Re: [GENERAL] Problem with async notifications of table updates

2008-03-18 Thread Alban Hertroys
On Mar 19, 2008, at 2:35 AM, Tyler, Mark wrote: Alban Hertroys wrote: On Mar 18, 2008, at 3:58 AM, Tyler, Mark wrote: I suggest rethinking your dislike of NOTIFY. I have thought very hard about using NOTIFY for this but it has two large problems (from my point of view). The first is that it f

Re: [GENERAL] Problem with async notifications of table updates

2008-03-18 Thread Tyler, Mark
Karsten Hilbert wrote: > On Tue, Mar 18, 2008 at 01:28:36PM +1030, Tyler, Mark wrote: >> This >> is because I cannot pass any information with the NOTIFY apart from >> the fact that "something happened". > > Oh, you can, you can calculate the name of the NOTIFY dynamically > in the trigger sendin

Re: [GENERAL] Problem with async notifications of table updates

2008-03-18 Thread Tyler, Mark
Alban Hertroys wrote: >On Mar 18, 2008, at 3:58 AM, Tyler, Mark wrote: >> I suggest rethinking your dislike of NOTIFY. >> >> I have thought very hard about using NOTIFY for this but it has two >> large problems (from my point of view). The first is that it forces me >> to put far more smarts and

Re: [GENERAL] Problem with async notifications of table updates

2008-03-18 Thread Tyler, Mark
Vivek Khera wrote: > Wait a while and you will learn to detest Spread, too. I know this is probably off-topic for this group but why do you say this? I guess I don't want to go too far down a particular route if there are big traps waiting so I am interested in the basis for your comment. Mark I

Re: [GENERAL] Problem with async notifications of table updates

2008-03-18 Thread Vivek Khera
On Mar 17, 2008, at 10:58 PM, Tyler, Mark wrote: I suggest rethinking your dislike of NOTIFY. I have thought very hard about using NOTIFY for this but it has two large problems (from my point of view). The first is that it forces me Wait a while and you will learn to detest Spread, too. -

Re: [GENERAL] Problem with async notifications of table updates

2008-03-18 Thread Karsten Hilbert
On Tue, Mar 18, 2008 at 01:28:36PM +1030, Tyler, Mark wrote: > This > is because I cannot pass any information with the NOTIFY apart from the > fact that "something happened". Oh, you can, you can calculate the name of the NOTIFY dynamically in the trigger sending the notify, for example embedding

Re: [GENERAL] Problem with async notifications of table updates

2008-03-18 Thread Alban Hertroys
On Mar 18, 2008, at 3:58 AM, Tyler, Mark wrote: I suggest rethinking your dislike of NOTIFY. I have thought very hard about using NOTIFY for this but it has two large problems (from my point of view). The first is that it forces me to put far more smarts and state into the subscriber applicati

Re: [GENERAL] Problem with async notifications of table updates

2008-03-17 Thread Tyler, Mark
Tom Lane wrote: >"Tyler, Mark" <[EMAIL PROTECTED]> writes: >> Secondly, the lack of any delivery guarantee means my subscriber >> applications may miss event notifications. This is a very bad thing >> for my particular application. > > What makes you think NOTIFY doesn't guarantee delivery? If t

Re: [GENERAL] Problem with async notifications of table updates

2008-03-17 Thread Tom Lane
"Tyler, Mark" <[EMAIL PROTECTED]> writes: > Secondly, the lack of any delivery guarantee means my subscriber > applications may miss event notifications. This is a very bad thing for > my particular application. What makes you think NOTIFY doesn't guarantee delivery? If the transaction commits th

Re: [GENERAL] Problem with async notifications of table updates

2008-03-17 Thread Tyler, Mark
Tom Lane wrote: >"Tyler, Mark" <[EMAIL PROTECTED]> writes: >> What I want to do is to guarantee that the row is available for >> selection prior to sending the message. > > You cannot do that with an AFTER trigger, because whatever it > does necessarily happens before your transaction commits.

Re: [GENERAL] Problem with async notifications of table updates

2008-03-17 Thread Tom Lane
"Tyler, Mark" <[EMAIL PROTECTED]> writes: > What I want to do is to guarantee that the row is available for > selection prior to sending the message. You cannot do that with an AFTER trigger, because whatever it does necessarily happens before your transaction commits. I suggest rethinking your d

Re: [GENERAL] Problem with async notifications of table updates

2008-03-17 Thread Tyler, Mark
Rodrigo Gonzalez wrote: > I am almost sure you've defined a BEFORE trigger and > you need and AFTER trigger, so it's fired after commiting. No - I am definitely using an AFTER trigger. Following is a simplified version of what I am trying to do. /* messages - log messages */ CREATE TABLE messag

Re: [GENERAL] Problem with async notifications of table updates

2008-03-17 Thread Rodrigo Gonzalez
Tyler, Mark escribió: Hi, I am trying to set up a PostGreSQL database to send asynchronous notifications when certain inserts or updates are performed on the tables. The idea is I want to have publish / subscirbe model with the database in the centre as the information hub. An application wi

[GENERAL] Problem with async notifications of table updates

2008-03-17 Thread Tyler, Mark
Hi, I am trying to set up a PostGreSQL database to send asynchronous notifications when certain inserts or updates are performed on the tables. The idea is I want to have publish / subscirbe model with the database in the centre as the information hub. An application will insert a record into a ta