Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2E52A6330A8 for ; Sun, 20 Dec 2009 21:37:16 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 01492-01 for ; Mon, 21 Dec 2009 01:37:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by mail.postgresql.org (Postfix) with ESMTP id 9C13A632CD4 for ; Sun, 20 Dec 2009 21:37:08 -0400 (AST) Received: from localhost (access [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 178C11E044D; Mon, 21 Dec 2009 09:36:58 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (access.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OYAuQUjrOrnS; Mon, 21 Dec 2009 09:36:56 +0800 (WST) Received: from [10.1.1.5] (124-169-133-89.dyn.iinet.net.au [124.169.133.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 2DDBF1E044A; Mon, 21 Dec 2009 09:36:56 +0800 (WST) Message-ID: <4B2ED137.50501@postnewspapers.com.au> Date: Mon, 21 Dec 2009 09:36:55 +0800 From: Craig Ringer User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Maciek Sakrejda CC: PG-JDBC Mailing List Subject: Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify References: <4B2267A9.1080302@postnewspapers.com.au> <4B2C7A13.9080807@postnewspapers.com.au> <895e58dd0912201724r6b798469t4879e48a0d0abae2@mail.gmail.com> In-Reply-To: <895e58dd0912201724r6b798469t4879e48a0d0abae2@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/64 X-Sequence-Number: 20145 Maciek Sakrejda wrote: > Does the jdbc driver work with EmptyQueryResponse? At the protocol > level, if you send a Query message with an all-whitespace sql string, > the backend is supposed to reply with a single EmptyQueryResponse > message and then issue ReadyForQuery again. I have a feeling that jdbc > is probably "too smart" for this to work, but it could be worth a > shot. Even if the JDBC driver avoids sending such a query, it'd be a handy behavior to use if explicit polling was implemented in the driver interface. Send an empty Query message, read() from the buffer now that you know there's something in it (the server's empty query response) and see if there are any async notifications in the buffer before the empty query response. Thanks for the tip. If the JDBC folks ever stick their heads up here to comment on any of this or to respond to the docs patches I've sent them I'll see if they'd accept a patch for this and put one together if so. It wouldn't be as efficient as purely client-side polling as it'd require a network round trip, but it'd be a whole lot simpler and would avoid spamming the db logs. -- Craig Ringer