Thread: Re: 25P02, current transaction is aborted, commands ignored
"Oliver Jowett" wrote:
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?
There should be tons, it comes up regularly whenever someone ports an
app from Oracle..>>>>Ok, Thanks!!
> 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?
There are arguments both ways. To some extent it depends on who you
trust more to get the code right: the DB developer (once) or the app
developer (once per query).
>>>>> Once a statement fails, to continue further, savepoints need to be used so that postgreSQL implicit rollback is not done. If implicit rollback by postgreSQL is done, I will get 25P02 next time I try some query so I have lost the transaction anyway unless there is a way to recover from 25P02.Amaresh
-O
Indiatimes Email now powered by APIC Advantage. Help!
Dear all, Actually i am trying to insert some values within a transaction. I am also carrying out some data select operations after opening the transaction. But i am getting the above mentioned error. But i want the insert to happen. Please reply back to me as early as possible. i would be very thankful to you guys. I am sending through mail because i am unable to post my issue. Regards, Sangeetha (Team lead/GBBPR Soft).
Any error in your transaction causes it to abort. Dave On 13-May-08, at 8:50 AM, sangeetha wrote: > Dear all, > Actually i am trying to insert some values within a transaction. I > am also carrying out some data select operations after opening the > transaction. But i am getting the above mentioned error. But i want > the insert to happen. Please reply back to me as early as possible. > i would be very thankful to you guys. I am sending through mail > because i am unable to post my issue. > > Regards, > Sangeetha > (Team lead/GBBPR Soft). > > -- > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc
sangeetha wrote: > Actually i am trying to insert some values within a transaction. I am > also carrying out some data select operations after opening the > transaction. But i am getting the above mentioned error. But i want the > insert to happen. Please reply back to me as early as possible. i would > be very thankful to you guys. I am sending through mail because i am > unable to post my issue. One of the statements within you transaction caused an error. Every following statement in the transaction will raise the error message you get until you ROLLBACK the whole transaction. To preempt the question what you can do if you do not want to rollback the whole transaction because of an error, I recommend the use of savepoints: http://www.postgresql.org/docs/current/static/sql-savepoint.html Just set one before every statement that might cause an error, and ROLLBACK TO SAVEPOINT if you get one. Yours, Laurenz Albe