From: Brent Howard <BHoward@ppc.com>
To: weigelt@metux.de
Cc: pgsql-admin@postgresql.org
Subject: Re: Can the frontend get notifications from the postgres server?
Date: Tue, 17 Jun 2003 09:07:49 -0400
Message-ID: <B7D27A23094E40428993B399E9CD427234F115@2kmail> (raw)
On Tue, Jun 17, 2003 at 08:39:00 AM weigelt@metux.de [mailto:weigelt@metux.de] wrote:
<snip?
<snip>
|>> > But the problem still is: how to receive the NOTIFY from an php script ?
|>> > which function of the c-client lib can be used for this ?
|>>
|>> If you're talking about a PHP script running under apache as a module or
|>> CGI, then you probably can't (or if you can, you shouldn't due to time out
|>> issues and such.)
|>No. The script is running as an standalone process (works as application server).
|>The Problem is, how to get the NOTIFY message, which is received from the
|>RDBMS somewhere in the client lib, to the php script.
|>When using psql, the NOTIFY is displayed after sending an query. It seems
|>that it is sent within the server's reply to the query. But i dont know
|>how the clientlib hands it to the application.
|>
|>cu
|>--
I believe Postgres supports asynchronous notification via the LISTEN and NOTIFY commands. If the backend registers its interest in a particular relation with the LISTEN command, then all backends listening on a particular relation will be notified asynchronously when a NOTIFY of that relation name is executed by another backend.
No additional information is passed from the notifier to the listener. Thus, typically, any actual data that needs to be communicated is transferred through the relation.
libpq applications are notified whenever a connected backend has received an asynchronous notification. However, the communication from the backend to the frontend is not asynchronous. Notification comes piggy-backed on other query results. Thus, an application must submit queries, even empty ones, in order to receive notice of backend notification. In effect, the libpq application must poll the backend to see if there is any pending notification information. After the execution of a query, a frontend may call PQNotifies to see if any notification data is available from the backend.
---------------------------------------------------------------------
Enrico Weigelt == metux ITS
Webhosting ab 5 EUR/Monat. UUCP, rawIP und vieles mehr.
phone: +49 36207 519931 www: http://www.metux.de/
fax: +49 36207 519932 email: contact@metux.de
cellphone: +49 174 7066481 smsgate: sms.weigelt@metux.de
---------------------------------------------------------------------
Diese Mail wurde mit UUCP versandt. http://www.metux.de/uucp/
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: BHoward@ppc.com, weigelt@metux.de
Subject: Re: Can the frontend get notifications from the postgres server?
In-Reply-To: <B7D27A23094E40428993B399E9CD427234F115@2kmail>
References: <B7D27A23094E40428993B399E9CD427234F115@2kmail>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox