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 421B43A1AAE for ; Fri, 14 Jan 2005 16:57:53 +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 90019-02 for ; Fri, 14 Jan 2005 16:57:39 +0000 (GMT) Received: from webmail.muc.domeus.com (mail.ecircle.de [195.140.186.200]) by svr1.postgresql.org (Postfix) with ESMTP id 44A973A1AE0 for ; Fri, 14 Jan 2005 16:57:38 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by webmail.muc.domeus.com (READY) with ESMTP id 43E8F4637F; Fri, 14 Jan 2005 17:57:36 +0100 (CET) Received: from webmail.muc.domeus.com ([127.0.0.1]) by localhost (webmail.muc.domeus.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03636-06; Fri, 14 Jan 2005 17:57:33 +0100 (CET) Received: from [192.168.1.110] (unknown [192.168.1.110]) by webmail.muc.domeus.com (READY) with ESMTP id 45BD346382; Fri, 14 Jan 2005 17:57:33 +0100 (CET) Subject: Re: Weird behavior in transaction handling (Possible bug ?) From: Csaba Nagy To: "j.random.programmer" Cc: pg@fastcrypt.com, Postgres JDBC In-Reply-To: <20050114162956.91766.qmail@web14227.mail.yahoo.com> References: <20050114162956.91766.qmail@web14227.mail.yahoo.com> Content-Type: text/plain Message-Id: <1105721842.14493.52.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Fri, 14 Jan 2005 17:57:22 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/122 X-Sequence-Number: 12002 Dear random programmer, I understand your grief perfectly, and agree completely, I've been there. But I think the spec is at least ambiguous about this matter, if not leaning towards the postgres behavior of rolling back everything on an error. And I don't believe commit fails silently, it should give you an error. The demand for the convenience of deciding after a failed query to continue or not comes from other DB engines readily implementing it (notably Oracle). So I would expect you're coming from an oracle DB experience... In any case, if you want similar behavior in postgres > 8.0, you could use a savepoint before the auxialiary query and roll back to it on an error. Then the result of the queries before the savepoint can be committed. Please note that setting a savepoint in postgres is not nearly free, so be careful how often you do it. HTH, Csaba. Fri, 2005-01-14 at 17:29, j.random.programmer wrote: > > With postgres once an error occurs in a transaction > block you need > > to rollback. None of the transaction will commit. > > > > This behaviour makes sense as it assumes that the > transaction block > > is atomic and it should all succeed or all fail. > > > This is VERY counter-intuitive. I can have really > important data > for say 5 tables which has committed properly but at > the 6th > insert into a non-important auxillary table, I may > encounter a > transient exception. I still want to be able to commit > my data. > > There are many similar scenarios such as the above, > right ? > > As a programmer, shouldn't it be upto me to decide > when to > commit and when to rollback ? Is this even within > spec ? And > at the very least, commit() should then not fail > SILENTLY ! (and > this should be documented). > > :-] > > Best regards, > > --j > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - Helps protect you from nasty viruses. > http://promotions.yahoo.com/new_mail > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org