Re: Asynchronous queries - processing listen (notify) in a procedural language

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Petr Chmelar <chmelarp(at)fit(dot)vutbr(dot)cz>, pgsql-general(at)postgresql(dot)org
Subject: Re: Asynchronous queries - processing listen (notify) in a procedural language
Date: 2010-02-22 02:22:31
Message-ID: 3347.1266805351@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> On Sat, Feb 20, 2010 at 9:38 PM, Petr Chmelar <chmelarp(at)fit(dot)vutbr(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yan Cheng Cheok 2010-02-22 02:31:01 Question on RETURNS TABLE example in PostgreSQL documentation
Previous Message Merlin Moncure 2010-02-22 01:26:29 Re: Asynchronous queries - processing listen (notify) in a procedural language