Re: Cheapest way to poll for notifications?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cheapest way to poll for notifications?
Date: 2009-12-10 17:06:36
Message-ID: 24912.1260464796@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> writes:
> Tom Lane wrote:
>> The backend certainly will push the notification. Maybe you just have
>> a client-side-software issue?

> Testing with two plain old psql sessions to an 8.4.1 DB on linux (Ubuntu
> 9.10) here, I don't see the asynchronous notification until I send some
> other command to the database from the client. It's the same over a
> local UNIX socket or a loopback TCP/IP connection (with SSL).

psql is not too bright about that; when it's waiting for user input it
just waits. But I don't think it matters because nobody is going to
write an application that depends on this in psql anyway. If you are
writing something that uses libpq directly, it's certainly possible to
watch for incoming notifies along with whatever else your event loop is
watching for. (I had an application that did so a dozen years ago...)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Postgre Novice 2009-12-10 17:17:47 Re: Fw: ERROR: could not open relation with OID 59132
Previous Message Adrian Klaver 2009-12-10 16:53:21 Re: Fw: ERROR: could not open relation with OID 59132

Browse pgsql-jdbc by date

  From Date Subject
Next Message John R Pierce 2009-12-10 22:17:31 Connection.setReadOnly()
Previous Message Craig Ringer 2009-12-10 16:14:39 Re: Cheapest way to poll for notifications?