X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 22D45D1B1BC for ; Mon, 5 Jul 2004 00:16:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43622-04 for ; Mon, 5 Jul 2004 03:16:25 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id DF5EDD1B1B7 for ; Mon, 5 Jul 2004 00:16:24 -0300 (ADT) Received: from flood.opencloud.co.nz ([192.168.0.31] helo=opencloud.com ident=oliver) by yass.opencloud.co.nz with esmtp (Exim 3.35 #1 (Debian)) id 1BhJxv-0006Gy-00 for ; Mon, 05 Jul 2004 15:16:23 +1200 Message-ID: <40E8C806.6070902@opencloud.com> Date: Mon, 05 Jul 2004 15:16:22 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-jdbc@postgresql.org" Subject: patch: complain obviously about unknown transaction states Content-Type: multipart/mixed; boundary="------------040804020101070707080400" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=TO_ADDRESS_EQ_REAL X-Spam-Level: X-Archive-Number: 200407/35 X-Sequence-Number: 10419 This is a multi-part message in MIME format. --------------040804020101070707080400 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 --------------040804020101070707080400 Content-Type: text/plain; name="pgjdbc-check-transaction-state.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pgjdbc-check-transaction-state.txt" 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); } } --------------040804020101070707080400--