Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D18F69FB682 for ; Mon, 23 Apr 2007 16:06:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 43261-05 for ; Mon, 23 Apr 2007 16:06:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id E3BEC9FB6A7 for ; Mon, 23 Apr 2007 16:06:37 -0300 (ADT) Received: MIR3-FS.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes by MIR3-FS.mir3.com; 23 Apr 2007 12:06:35 -0700 Subject: Re: JDBC feature request: auto savepoint per command From: Mark Lewis To: Tom Lane Cc: pgsql-jdbc@postgreSQL.org In-Reply-To: <11539.1177352713@sss.pgh.pa.us> References: <11539.1177352713@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Mon, 23 Apr 2007 12:06:35 -0700 Message-Id: <1177355195.20922.17.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/87 X-Sequence-Number: 16936 The idea has been raised on this list before: http://archives.postgresql.org/pgsql-performance/2006-07/msg00245.php There is a negative performance impact but there's no reason it couldn't be a driver option. There isn't one right now though. -- Mark Lewis On Mon, 2007-04-23 at 14:25 -0400, Tom Lane wrote: > Some folk at JBoss (now part of Red Hat) are complaining to me that > there's no way to deal with failing statements within a transaction > in the context of CMT (Container Managed Transactions). The normal > advice would be to do SAVEPOINT and RELEASE around each statement, > but they say this is disallowed: > > > It's really a question of granularity. When using CMT a global > > transaction is not committed until the end of method completion. > > Prior to the JDBC connection being used, autocommit is set to false > > and the global transaction is officially started. When the global > > transaction completes, the transaction is committed as a whole. JDBC > > Rollback and commit within a managed transaction is prohibited as > > this is the responsibility of the container. So, setting a savepoint > > and rolling back (and subsequently committing) won't work in this > > context which is what the Postgres driver requires. > > Can anyone see a solution for this in the context of the existing driver > facilities? If not, is it reasonable to ask for a driver option to do > auto-savepointing? There is already an equivalent facility in psql, so > the idea doesn't seem unreasonable to me. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend