From: Dave Cramer <pg@fastcrypt.com>
To: Amaresh Wakkar <babu_moshay@indiatimes.com>
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: 25P02, current transaction is aborted, commands ignored
Date: Sun, 2 Apr 2006 08:36:59 -0400
Message-ID: <9B9703A9-2B17-4485-A035-D0DEF68C9932@fastcrypt.com> (raw)
In-Reply-To: <200604021130.RAA11482@WS0005.indiatimes.com>
References: <200604021130.RAA11482@WS0005.indiatimes.com>
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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pg@fastcrypt.com, babu_moshay@indiatimes.com, oliver@opencloud.com
Subject: Re: 25P02, current transaction is aborted, commands ignored
In-Reply-To: <9B9703A9-2B17-4485-A035-D0DEF68C9932@fastcrypt.com>
References: <200604021130.RAA11482@WS0005.indiatimes.com> <9B9703A9-2B17-4485-A035-D0DEF68C9932@fastcrypt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox