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 B121911F6B0E for ; Sun, 2 Apr 2006 09:11:33 -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 62779-02 for ; Sun, 2 Apr 2006 09:11:32 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from WS0005.indiatimes.com (smtp5.indiatimes.com [203.199.93.15]) by postgresql.org (Postfix) with ESMTP id 4131811F6B10 for ; Sun, 2 Apr 2006 09:11:28 -0300 (ADT) Received: from 192.168.57.15 (a2 [192.168.57.22]) by WS0005.indiatimes.com (8.9.3/8.9.3) with SMTP id RAA11482; Sun, 2 Apr 2006 17:00:20 +0530 From: "Amaresh Wakkar" Message-Id: <200604021130.RAA11482@WS0005.indiatimes.com> To: "Oliver Jowett", "babu_moshay" CC: Reply-To: "Amaresh Wakkar" Subject: Re: 25P02, current transaction is aborted, commands ignored Date: Sun, 02 Apr 2006 17:38:50 +0530 X-URL: http://indiatimes.com Content-Type: multipart/alternative; boundary="=_MAILER_ATTACH_BOUNDARY1_20064201738501949751108" MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.025 required=5 tests=[AWL=-0.826, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, HTML_IMAGE_ONLY_24=0.93, HTML_MESSAGE=0.001] X-Spam-Score: 2.025 X-Spam-Level: ** X-Archive-Number: 200604/6 X-Sequence-Number: 14940 --=_MAILER_ATTACH_BOUNDARY1_20064201738501949751108 Content-Type: text/plain; charset=us-ascii 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 --=_MAILER_ATTACH_BOUNDARY1_20064201738501949751108 Content-Type: text/html; charset=us-ascii

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!


--=_MAILER_ATTACH_BOUNDARY1_20064201738501949751108--