Re: transaction aborted with error

From: jdassen(at)cistron(dot)nl (J(dot)H(dot)M(dot) Dassen (Ray))
To: pgsql-general(at)postgresql(dot)org
Subject: Re: transaction aborted with error
Date: 2001-03-22 13:34:44
Message-ID: slrn9bjvrk.v22.jdassen@odin.cistron-office.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

DaVinci <bombadil(at)wanadoo(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-03-22 14:01:45 Re: Changing from rpm to Compiled version
Previous Message Tamsin 2001-03-22 13:28:48 non-existent user "28"