Skip site navigation (1) Skip section navigation (2)

Re: Does Postgres rollback transactions on allerrors?

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 allerrors?
Date: 2001-04-22 23:33:09
Message-ID: (view raw, whole thread or download thread mbox)
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?


> 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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group