X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7674930F001 for ; Tue, 17 Jun 2003 13:08:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 24064-01 for ; Tue, 17 Jun 2003 10:08:47 -0300 (ADT) Received: from 2kmail.ppc.com (unknown [12.38.16.36]) by svr1.postgresql.org (Postfix) with ESMTP id 639A830DC8A for ; Tue, 17 Jun 2003 10:08:47 -0300 (ADT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Can the frontend get notifications from the postgres server? Date: Tue, 17 Jun 2003 09:07:49 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [ADMIN] Can the frontend get notifications from the postgres server? Thread-Index: AcM0zogeZtss/2ePQJKoX90YQT7ICAAAl/Bg From: "Brent Howard" To: Cc: X-Archive-Number: 200306/197 X-Sequence-Number: 9188 =20 On Tue, Jun 17, 2003 at 08:39:00 AM weigelt@metux.de [mailto:weigelt@metux.= de] wrote: |>> > But the problem still is: how to receive the NOTIFY from an php scrip= t ? |>> > which function of the c-client lib can be used for this ? |>>=20 |>> If you're talking about a PHP script running under apache as a module o= r=20 |>> CGI, then you probably can't (or if you can, you shouldn't due to time = out=20 |>> 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 NO= TIFY commands. If the backend registers its interest in a particular relati= on with the LISTEN command, then all backends listening on a particular rel= ation will be notified asynchronously when a NOTIFY of that relation name i= s executed by another backend.=20 No additional information is passed from the notifier to the listener. Thus= , typically, any actual data that needs to be communicated is transferred t= hrough the relation.=20 libpq applications are notified whenever a connected backend has received a= n 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 ap= plication must poll the backend to see if there is any pending notification= information. After the execution of a query, a frontend may call PQNotifie= s to see if any notification data is available from the backend.=20 --------------------------------------------------------------------- Enrico Weigelt =3D=3D metux ITS=20 Webhosting ab 5 EUR/Monat. UUCP, rawIP und vieles mehr. phone: +49 36207 519931 www: http://www.metux.de/=20=20= =20=20=20 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