pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: patch: complain obviously about unknown transaction states
Date: Mon, 05 Jul 2004 15:16:22 +1200
Message-ID: <40E8C806.6070902@opencloud.com> (raw)

ReadyForQuery may change in 7.5, per discussion on -hackers:

   http://archives.postgresql.org/pgsql-hackers/2004-07/msg00184.php

The attached patch makes the driver generate errors on unknown 
transaction states in a ReadyForQuery message, rather than silently 
ignoring them (and probably getting confused).

-O

Attachments:

pgjdbc-check-transaction-state.txt (text/plain, 1.4K) download Index: org/postgresql/core/v3/QueryExecutorImpl.java =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/core/v3/QueryExecutorImpl.java,v retrieving revision 1.1 diff -u -c -r1.1 QueryExecutorImpl.java *** org/postgresql/core/v3/QueryExecutorImpl.java 29 Jun 2004 06:43:25 -0000 1.1 --- org/postgresql/core/v3/QueryExecutorImpl.java 5 Jul 2004 02:38:21 -0000 *************** *** 1175,1181 **** private void receiveRFQ() throws IOException { if (pgStream.ReceiveIntegerR(4) != 5) ! throw new IOException("unexpected length of ReadyForQuery packet"); char tStatus = (char)pgStream.ReceiveChar(); if (Driver.logDebug) --- 1175,1181 ---- private void receiveRFQ() throws IOException { if (pgStream.ReceiveIntegerR(4) != 5) ! throw new IOException("unexpected length of ReadyForQuery message"); char tStatus = (char)pgStream.ReceiveChar(); if (Driver.logDebug) *************** *** 1193,1200 **** protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_FAILED); break; default: ! // Huh? ! break; } } --- 1193,1199 ---- protoConnection.setTransactionState(ProtocolConnection.TRANSACTION_FAILED); break; default: ! throw new IOException("unexpected transaction state in ReadyForQuery message: " + (int)tStatus); } }

view thread (2+ messages)  latest in thread

Message-ID: <40E8C806.6070902@opencloud.com>
Permalink:  ../40E8C806.6070902@opencloud.com/
Also on:    postgresql.org/message-id/40E8C806.6070902@opencloud.com

 · 

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: oliver@opencloud.com
  Subject: Re: patch: complain obviously about unknown transaction states
  In-Reply-To: <40E8C806.6070902@opencloud.com>
  References: <40E8C806.6070902@opencloud.com>

* 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