Thread: Re: Does Postgres rollback transactions on all errors?

Re: Does Postgres rollback transactions on all errors?

From
"Eric Naujock "
Date:
Yes postgress does do rollbacks but you have to wrap your actions to make them work.

You have to end your actions with either a commit or rollback. That will make the tranaction  finish as you would
expect. 

The commit command is covered on page 127 of the manual and rollback is on 253.

It may just take a bit of experimentation to get it to behave right.

>>> Tom Lane <tgl@sss.pgh.pa.us> 04/22/01 05:56PM >>>
Ryan Ho <ryanho@cyberronins.com> writes:
> In a transaction, should any of the sql statements fail to execute, does Postgres rollback all the previous
statements?

Yes.

> To my best knowledge, it should but I have observed that on some occasions, half my transaction can get committed,
whilethe other half is unsuccessful. 

Hard to believe.  Can you provide some evidence?

            regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly