Thread: transaction aborted with error

transaction aborted with error

From
DaVinci
Date:
 Hello. I have a problem with Postgresql 7.1 beta (Debian packages).

 When I am in middle of transaction and there is an error, for example
 caused by trying to insert a tupla with a "not null" value without valor, I
 get error:

     NOTICE: current transaction is aborted, queries ignored until end of
    transaction block.

 I don't like this behaviour, is there any form of avoiding abortion of
 transaction on error?...

 Thanks.

                                                             David

Re: transaction aborted with error

From
jdassen@cistron.nl (J.H.M. Dassen (Ray))
Date:
DaVinci <bombadil@wanadoo.es> wrote:
> When I am in middle of transaction and there is an error, for example
> caused by trying to insert a tupla with a "not null" value without valor,
> I get error:
>
>     NOTICE: current transaction is aborted, queries ignored until end of
>    transaction block.
>
> I don't like this behaviour, is there any form of avoiding abortion of
> transaction on error?...

Not really. One of the points of having transactions is that a transaction
either succeeds (as a whole), or has no effect (rollback). Triggers can
provide a workaround though.

I ran into this problem with a table which contained log-like information
which should be inserted only once, but wasn't (due to a misconfiguration in
the system generating the logs). I solved it by having a trigger (BEFORE
INSERT OR UPDATE) which RAISEd a NOTICE (so it's clear the workaround
occurs) and returns NULL, causing the insert to be ignored.

HTH,
Ray
--
Where do you want to go today?

Confutatis maledictis, flammis acribus addictis.

Re: transaction aborted with error

From
Anand Raman
Date:
I dont think so ..
Transactions need to be atomic.. Either succeed or fail.. I thik what
postgressql does is quite OK only a little irritating if u are issuing
command thru the psql terminal..

Anand
On Thu, Mar 22, 2001 at 10:15:54AM +0100, DaVinci wrote:
> Hello. I have a problem with Postgresql 7.1 beta (Debian packages).
>
> When I am in middle of transaction and there is an error, for example
> caused by trying to insert a tupla with a "not null" value without valor, I
> get error:
>
>     NOTICE: current transaction is aborted, queries ignored until end of
>    transaction block.
>
> I don't like this behaviour, is there any form of avoiding abortion of
> transaction on error?...
>
> Thanks.
>
>                                                             David
>
>---------------------------(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