Re: taking actions on rollback (PHP)

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Ivan Sergio Borgonovo" <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: taking actions on rollback (PHP)
Date: 2008-04-27 02:58:06
Message-ID: dcc563d10804261958l12003314la83fa2022f778983@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Apr 26, 2008 at 4:19 PM, Ivan Sergio Borgonovo
<mail(at)webthatworks(dot)it> wrote:
>
> With the added @ everything seemed to be OK.

No, the @ is just making php quietly swallow the postgresql errors
that are being returned. It changes nothing in operation.

> I had to refresh a second time to get rid of the error.
> I'd like to be sure I've understood how it works since I wouldn't
> like the error went away just by chance and under heavy load I may
> have troubles.

I'm pretty sure you're not undestanding how it works.

With postgresql, ANY error in a transaction results in the whole
transaction being rolled back. Any commands thrown at the database
after that result in this error message:

> Why did I get the
> ERROR: current transaction is aborted, commands ignored until end of
> transaction block
> from 2 different pages?

because each page got an error in a statement inside its transaction.
It then issued the above error over and over as you attempted to
execute the next statement.

In postgresql, without using savepoints, any error in the transaction
will cause the whole transaction to fail, whether you type commit or
rollback at the end. All the changes are lost either way.

So, there's no "cleanup" to do for the transaction, it's already cleaned up.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Dennis 2008-04-27 06:06:09 plpgsql functions and the planner
Previous Message Robert Treat 2008-04-27 00:33:28 Re: How to modify ENUM datatypes?