Re: Does Postgres rollback transactions on all errors?

From: "Eric Naujock " <naujocke(at)abacusii(dot)com>
To: <ryanho(at)cyberronins(dot)com>, <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Does Postgres rollback transactions on all errors?
Date: 2001-04-22 23:33:09
Message-ID: sae33205.048@gw5.abacusii.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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(at)sss(dot)pgh(dot)pa(dot)us> 04/22/01 05:56PM >>>
Ryan Ho <ryanho(at)cyberronins(dot)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, while the 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(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

Browse pgsql-novice by date

  From Date Subject
Next Message Joel Burton 2001-04-23 02:06:31 Re: CAST doesn't work :-( (fwd)
Previous Message Tom Lane 2001-04-22 21:56:42 Re: Does Postgres rollback transactions on all errors?