Skip site navigation (1) Skip section navigation (2)

Re: Bug receiving NotificationResponse Message v3

From: Kris Jurka <books(at)ejurka(dot)com>
To: Hans Näther <Hans(dot)Naether(at)charite(dot)de>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Bug receiving NotificationResponse Message v3
Date: 2004-01-28 12:25:40
Message-ID: Pine.LNX.4.33.0401280720430.28547-100000@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

On Wed, 28 Jan 2004, [ISO-8859-1] Hans Nther wrote:

> Hello,
>
> I found a problem in the current jdbc driver. My application receives
> asynchronous notification messages from the backend. Using postgresql
> 7.1, it works. When I switch to postgresql 7.4, it doesn't work anymore.
> An exception postgresql.con.type is thrown in
> org.postgresql.core.QueryExecutor.executeV3. This is because 7.1 uses
> protocol version 2 and 7.4 uses protocol version 3. In version 3, the
> message format has changed, the message contains additional data
> (message length, additional information) => see
> http://www.postgresql.org/docs/current/interactive/protocol-message-formats.html
> under NotificationResponse.
>
> So the function executeV3 needs to be changed, I propose the following
> change:
>
> ... (line 129):
> switch (c)
> {
>    case 'A': // Asynchronous Notify
>      int msglen = pgStream.ReceiveInteger(4); // added
>      int pid = pgStream.ReceiveInteger(4);
>      String msg = pgStream.ReceiveString(connection.getEncoding());
>      String param = pgStream.ReceiveString(connection.getEncoding()); //
> added
>      connection.addNotification(new
> org.postgresql.core.Notification(msg, pid));
>      break;
> case 'B':	// Binary Data Transfer
> ...

Good catch.  I've applied the attached patch to the gborg cvs driver.  I'm
not sure how well it will apply to the 7.4 version.  This problem was also
present in the notification receiving in fastpath.  Further the pid
field was being read in the wrong byte order.

Kris Jurka



In response to

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2004-01-28 12:27:45
Subject: Re: Bug receiving NotificationResponse Message v3
Previous:From: Bhushan BhangaleDate: 2004-01-28 10:47:42
Subject: Re: jdbc connection string

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group