X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1918D11F6971 for ; Sun, 2 Apr 2006 09:37:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66049-04 for ; Sun, 2 Apr 2006 09:37:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id 5FDB711F68E6 for ; Sun, 2 Apr 2006 09:37:00 -0300 (ADT) Received: (qmail 32147 invoked from network); 2 Apr 2006 12:37:00 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 2 Apr 2006 12:37:00 -0000 In-Reply-To: <200604021130.RAA11482@WS0005.indiatimes.com> References: <200604021130.RAA11482@WS0005.indiatimes.com> Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: multipart/alternative; boundary=Apple-Mail-25-317978664 Message-Id: <9B9703A9-2B17-4485-A035-D0DEF68C9932@fastcrypt.com> Cc: "Oliver Jowett" , From: Dave Cramer Subject: Re: 25P02, current transaction is aborted, commands ignored Date: Sun, 2 Apr 2006 08:36:59 -0400 To: "Amaresh Wakkar" X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.636 required=5 tests=[AWL=-0.379, HTML_IMAGE_ONLY_28=1.014, HTML_MESSAGE=0.001] X-Spam-Score: 0.636 X-Spam-Level: X-Archive-Number: 200604/8 X-Sequence-Number: 14942 --Apple-Mail-25-317978664 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Well, The concept of an atomic transaction means that it must either succeed completely or fail completely. PostgreSQL does this. Dave On 2-Apr-06, at 8:08 AM, Amaresh Wakkar wrote: > Thanks!! > > The code works fine after I added savepoints around "Okay,even if > fails" statement. > > What is the idea behind taking this route(i.e all statements > ignored till end of block) though? Is there any archive thread > discussing this? In this particular case, the autocommit is off and > the statement has failed so there is no risk of changes being made > permanent(presumable PG would rollback at database level the > changed buffers etc.,) unless the commit() method is invoked. Why > then explicit rollback is needed? Is it not best if it is left to > programmer to handle this in exception handling code? > > I just had to add two lines of savepoints but I added them for > making my code work rather than using them for some application > logic purpose. > > Cheers!! > > Amaresh Wakkar > > > > "Oliver Jowett" wrote: > > > babu_moshay wrote: > > > In my opinion, if there are reasons to throw 25P02 and abort > transaction unilaterally, then there are also good reasons not to > abort it and let programmer take the decision. A switching > mechanism would have been ideal. > > Create a savepoint before the possibly-failing query. If the query > fails > in the way you were expecting, roll back to the savepoint and > continue. > > -O > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > > Indiatimes Email now powered by APIC Advantage. Help! > Help > --Apple-Mail-25-317978664 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Well,

The concept of an atomic = transaction means that it must either succeed completely or fail = completely. PostgreSQL does this.=A0

Dave
On = 2-Apr-06, at 8:08 AM, Amaresh Wakkar wrote:

Thanks!!

The code=A0works fine after I added = savepoints around=A0=A0"Okay,even if fails" statement.

What is the = idea behind taking this route(i.e all statements ignored till end of = block) though? Is there any archive thread discussing this? In this = particular case, the autocommit is off and the statement has failed so = there is no risk of changes being made permanent(presumable PG would = rollback at database level the changed buffers etc.,) unless the = commit() method is invoked. Why then explicit rollback is needed? Is it = not best if it is left to programmer to handle this in exception = handling code?

I just had to add two lines of savepoints but I = added them for making my code work rather than using them for = some=A0application logic=A0purpose.

Cheers!!

Amaresh = Wakkar



"Oliver Jowett" wrote:

=

babu_moshay wrote:

> In my opinion, if = there are reasons to throw 25P02 and abort transaction unilaterally, = then there are also good reasons not to abort it and let programmer take = the decision. A switching mechanism would have been ideal.

Create = a savepoint before the possibly-failing query. If the query fails
in = the way you were expecting, roll back to the savepoint and = continue.

-O

---------------------------(end of = broadcast)---------------------------
TIP 3: Have you checked our = extensive FAQ?

http://www.postgresql.org/docs= /faq


Indiatimes = Email now powered by APIC Advantage. Help!



= --Apple-Mail-25-317978664--