From: Ivan P. <iva...@se...> - 2007-01-30 18:59:04
|
In the application's log file I found FB error Statement failed, SQLCODE = -901 cannot update erased record I think that it can occur in the following situation: Updating (or deleting) a record consists of two stages - old record version is read into buffer - new record version is created/stored If it is done in READ COMMITED transaction, and some other transaction deletes that record and manages to commit it between those two stages, then "cannot update erased record" is raised. It is easy to get this error with WAIT transaction, i.e. - transaction B deletes record - transaction A (wait, read committed) tries to update it, but has to wait - transaction B commits - transaction A wakes up and tries to finish its work, but it finds out that the record was deleted in the meanwhile, and so it raises the error. ---- Now, why am I writing all this ? * Somehow, it seems to me that this error is more artifact of the way the command is internally processed than real error. * It can be raised in the situation one would not expect it - normally the DELETE/UPDATE command either succeeds because it deletes/updates required record(s), or it succeeds because there is nothing to delete/update (e.g. delete from tab where 1=2;) But in described situation the DELETE can complain that record was already deleted - looks strange. * Could this error by avoided at all ? If the record was deleted, it means there is nothing to delete/update, so from users point of view the error has no sense. The only problem I see is with Before triggers that were already fired, can't they be just silently undone ? Ivan |