Re: transaction aborted with error
От | jdassen@cistron.nl (J.H.M. Dassen (Ray)) |
---|---|
Тема | Re: transaction aborted with error |
Дата | |
Msg-id | slrn9bjvrk.v22.jdassen@odin.cistron-office.nl обсуждение исходный текст |
Ответ на | transaction aborted with error (DaVinci <bombadil@wanadoo.es>) |
Список | pgsql-general |
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.
В списке pgsql-general по дате отправления: