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 8830A3A2B56 for ; Sat, 15 Jan 2005 07:28:03 +0000 (GMT) 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 84973-06 for ; Sat, 15 Jan 2005 07:27:52 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id A731A3A295E for ; Sat, 15 Jan 2005 07:27:53 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CpiLd-0005Vh-00; Sat, 15 Jan 2005 20:27:49 +1300 Message-ID: <41E8C5F1.1030800@opencloud.com> Date: Sat, 15 Jan 2005 20:27:45 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-jdbc@postgresql.org Subject: Re: Weird behavior in transaction handling (Possible bug ?) References: <20050114161304.32600.qmail@web14223.mail.yahoo.com> <41E83BE1.2020909@opencloud.com> <200501141707.38043@vadim.nasardinov> <27168.1105746293@sss.pgh.pa.us> In-Reply-To: <27168.1105746293@sss.pgh.pa.us> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/147 X-Sequence-Number: 12027 Tom Lane wrote: > Vadim Nasardinov writes: > >>On Friday 14 January 2005 16:38, Oliver Jowett wrote: >> >>>It might be worthwhile having commit() throw an exception if the >>>transaction did not actually commit, rather than only reporting >>>server-generated errors. What do people think? > > >>Sounds like a good idea. > > > Doesn't the JDBC spec have anything to say about what this should do? The JDBC spec is vague as usual. The Connection.commit() javadoc says: === Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this Connection object. This method should be used only when auto-commit mode has been disabled. Throws: SQLException - if a database access error occurs or this Connection object is in auto-commit mode === What counts as a "database access error"? We currently throw on communication errors or server-generated errors only. A previous error causing transaction rollback doesn't seem like an access error really, but given that you can get other errors thrown when the transaction does not commit for other reasons, I'm not sure why that case should be different. -O