Re: Asynchronous queries - processing listen (notify) in a procedural language - Mailing list pgsql-general

From Tom Lane
Subject Re: Asynchronous queries - processing listen (notify) in a procedural language
Date
Msg-id 3347.1266805351@sss.pgh.pa.us
Whole thread Raw
In response to Re: Asynchronous queries - processing listen (notify) in a procedural language  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Asynchronous queries - processing listen (notify) in a procedural language
List pgsql-general
Merlin Moncure <mmoncure@gmail.com> writes:
> On Sat, Feb 20, 2010 at 9:38 PM, Petr Chmelar <chmelarp@fit.vutbr.cz> wrote:
>> Is there a way how to listen and trigger the notify messages in the
>> database (+-)immediately and/or to execute additional (trigger) queries
>> in other transactions?

> The only way that I know of to send notify 'in-transaction' is via
> dblink...you just send 'notify x' as the query which commits and fires
> the action.  It doesn't make sense to do this if your outer
> transaction is very short in duration.

It's not clear that it makes sense to do that in a long transaction,
either.  What are you notifying other sessions *about*?  Not your own
changes --- they won't be able to see those till you commit.  There's
a reason why NOTIFY is delayed till commit ...

            regards, tom lane

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Asynchronous queries - processing listen (notify) in a procedural language
Next
From: Yan Cheng Cheok
Date:
Subject: Question on RETURNS TABLE example in PostgreSQL documentation