Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id B84F1194E782 for ; Wed, 6 Jun 2012 17:12:23 -0300 (ADT) Received: from mailhub131.itcs.purdue.edu ([128.210.5.131]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ScMac-00021Z-Hn for pgsql-jdbc@postgresql.org; Wed, 06 Jun 2012 20:12:23 +0000 Received: from math.purdue.edu (gauss.math.purdue.edu [128.210.3.205]) by mailhub131.itcs.purdue.edu (8.14.4/8.14.4/mta.smtp.purdue.edu) with ESMTP id q56KC9Sn025974 for ; Wed, 6 Jun 2012 16:12:09 -0400 Received: from mailrelay.math.purdue.edu (mailrelay.math.purdue.edu [128.210.3.183]) by math.purdue.edu (8.14.4+Sun/8.14.4/RPM-20111028-1) with ESMTP id q56KC9RI022355 for ; Wed, 6 Jun 2012 16:12:09 -0400 (EDT) Received: from hardy.math.purdue.edu [128.210.3.54] by mailrelay.math.purdue.edu (Alligate(TM) SMTP Gateway v3.11.5.9) with ESMPT id <8670A30454EF3FA0.9308933D3C69403E@mailrelay.math.purdue.edu> for ; Wed, 06 Jun 2012 16:11:53 -0400 Message-ID: <4FCFB988.2080408@math.purdue.edu> Date: Wed, 06 Jun 2012 16:11:52 -0400 From: J Chapman Flack User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120307 Thunderbird/10.0.3 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: get/setReadOnly broken if default_transaction_read_only on Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Alligate-SMTP: Whitelisted X-Alligate-ReceivingIP: [128.210.3.183] X-Originating-IP: 128.210.3.54 X-Destination-IP: X-Alligate-ID: 19862 X-Alligate-RcptTo: X-Alligate-Out: IGNORED - WhiteListed From: (@*purdue.edu) X-PMX-Version: 5.5.9.388399 X-PerlMx-Virus-Scanned: Yes X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201206/21 X-Sequence-Number: 23015 Hi, I've found this in the git head so it applies to current versions. AbstractJdbc2Connection initializes its readOnly member to a hardcoded false instead of to 'show default_transaction_read_only' from the backend. That means two things: 1. getReadOnly() is wrong in case the backend has default_transaction_read_only on, and 2. setReadOnly(false) doesn't work in that case, because the value is compared to readOnly and looks the same, so no set session characteristics command is sent to the backend. An application can work around (2) by always calling setReadOnly(true);setReadOnly(false); if it wants to write. But that's a bit ugly. The driver could do that too for a quick hack, but it would be nice to query the correct value from the backend and use that. Cheers, Chapman Flack