On Tue, Nov 09, 2004 at 04:34:16AM +0100, Florian G. Pflug wrote:

> My import sometimes crashed, becausse the meta-information tables are 
> changed while importing (e.h, I pass a id to a function, the function 
> does some calculations, than tries to select the row with the given id, 
> but fails, because the row was deleted in the meantime). I understand 
> that the standard approach to this problem is to set the transaction 
> isolation level to "serializeable", thus avoiding non-repeatable reads.

Sounds like you could use savepoints to be able to retry without
starting from scratch:

- function gets the Id
- savepoint foo
- do something with Id
- try to get row == Id
  - if it doesn't exist, rollback to foo, go to top
- release foo
- go to top

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Uno combate cuando es necesario... ¡no cuando está de humor!
El humor es para el ganado, o para hacer el amor, o para tocar el
baliset.  No para combatir."  (Gurney Halleck)


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to