DaVinci <[EMAIL PROTECTED]> 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.


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to