Re: Problem with Async (multiple) notifications

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Olarte <olarte(dot)andres(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problem with Async (multiple) notifications
Date: 2005-06-25 04:14:25
Message-ID: 17989.1119672865@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Andres Olarte <olarte(dot)andres(at)gmail(dot)com> writes:
> I've been playing with async notifications lately, and I've found a
> small problem: when several notifications are issued at once (for
> example within a transaction) normally only one of those gets to the
> client.

The documentation:
http://www.postgresql.org/docs/8.0/static/sql-notify.html
quoth:
> NOTIFY behaves like Unix signals in one important respect: if the same
> notification name is signaled multiple times in quick succession,
> recipients may get only one notification event for several executions of
> NOTIFY. So it is a bad idea to depend on the number of notifications
> received. Instead, use NOTIFY to wake up applications that need to pay
> attention to something, and use a database object (such as a sequence)
> to keep track of what happened or how many times it happened.

Are you sure you are following this advice?

(In particular, I can absolutely positively guarantee that N NOTIFYs
executed within a single transaction have the same effect as one
NOTIFY. This is not a bug, it is the design intention.)

regards, tom lane

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message enrique.ibarra 2005-06-25 04:41:03 Problems loading the driver
Previous Message Oliver Jowett 2005-06-25 00:55:02 Re: Problem with Async (multiple) notifications