Re: Per-Table Transaction Isolation Level?

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Per-Table Transaction Isolation Level?
Date: 2004-11-09 04:05:52
Message-ID: 20041109040552.GA20532@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2004-11-09 04:09:37 Re: server auto-restarts and ipcs
Previous Message Tom Lane 2004-11-09 03:41:55 Re: server auto-restarts and ipcs