Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 8BB119FA4B4 for ; Mon, 30 Oct 2006 15:07:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 25671-04 for ; Mon, 30 Oct 2006 19:07:02 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with SMTP id CDE139FA376 for ; Mon, 30 Oct 2006 15:07:01 -0400 (AST) Received: (qmail 27636 invoked by uid 1112); 30 Oct 2006 19:07:00 -0000 Date: Mon, 30 Oct 2006 14:07:00 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: Heikki Linnakangas cc: Ludovic Orban , pgsql-jdbc@postgresql.org Subject: Re: Postgres XA support In-Reply-To: <452BA80C.7060605@enterprisedb.com> Message-ID: References: <45288F3C.1030906@ejurka.com> <45297847.7060304@ejurka.com> <452A2CA0.2080900@enterprisedb.com> <452ABFFE.3000108@enterprisedb.com> <452BA80C.7060605@enterprisedb.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200610/141 X-Sequence-Number: 16024 On Tue, 10 Oct 2006, Heikki Linnakangas wrote: > Ludovic Orban wrote: > >> This is a common way of using a XA connection pool that mixes both >> local and global transactions: >> >> c = ds.getConnection() >> c.executeUpdate("UPDATE 1") >> c.setAutoCommit(false) >> c.executeUpdate("UPDATE 2") >> tm.begin() >> c.executeUpdate("UPDATE 3") >> tm.rollback() >> c.commit() >> >> UPDATE 1 is done in a local transaction while in autocommit mode, it >> is committed. >> UPDATE 2 is done in a local transaction manually committed, it is >> committed. >> UPDATE 3 is done in a global transaction which is rolled back, it is >> rolled back. >> >> Does PostgreSQL supports this ? If not, applications using Hibernate >> might not work as it runs queries in local transaction mode on its own >> during startup. > > Hmm, we should be supporting that, but it might not work with the current > released version given the bug with setAutoCommit reported by Allan Saddi > recently. We should add a test case for that... > I see how Allan's patch would get UPDATE 1 to commit, but UPDATE 2 and 3 are the equivalent of an interleaved transaction and I don't see how that could possibly work. I'm not sure what sort of protection we need to add to prevent people from doing this or other transaction handling actions on the connection. Right now the Connection object doesn't know if it is being used by a XADatasource. Kris Jurka