pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Maciek Sakrejda <msakrejda@truviso.com>
Cc: PG-JDBC Mailing List <pgsql-jdbc@postgresql.org>
Subject: Re: Cheapest way to poll for notifications? & Driver 	improvement question re SSL and notify
Date: Mon, 21 Dec 2009 09:36:55 +0800
Message-ID: <4B2ED137.50501@postnewspapers.com.au> (raw)
In-Reply-To: <895e58dd0912201724r6b798469t4879e48a0d0abae2@mail.gmail.com>
References: <C746D04C.CAE15%scott_ribe@killerbytes.com>
	<4B2267A9.1080302@postnewspapers.com.au>
	<4B2C7A13.9080807@postnewspapers.com.au>
	<895e58dd0912201724r6b798469t4879e48a0d0abae2@mail.gmail.com>

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



view thread (11+ messages)  latest in thread

Message-ID: <4B2ED137.50501@postnewspapers.com.au>
Permalink:  ../4B2ED137.50501@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4B2ED137.50501@postnewspapers.com.au

 · 

reply

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-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au, msakrejda@truviso.com
  Subject: Re: Cheapest way to poll for notifications? & Driver 	improvement question re SSL and notify
  In-Reply-To: <4B2ED137.50501@postnewspapers.com.au>
  References: <C746D04C.CAE15%scott_ribe@killerbytes.com> <4B2267A9.1080302@postnewspapers.com.au> <4B2C7A13.9080807@postnewspapers.com.au> <895e58dd0912201724r6b798469t4879e48a0d0abae2@mail.gmail.com> <4B2ED137.50501@postnewspapers.com.au>

* 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