Re: concurrency in stored procedures

From: Ottavio Campana <ottavio(at)campana(dot)vi(dot)it>
To: Ottavio Campana <ottavio(at)campana(dot)vi(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: concurrency in stored procedures
Date: 2007-03-23 19:19:51
Message-ID: 46042857.5030508@campana.vi.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ottavio Campana wrote:
> What would you to in order to be sure that one function or a part of it
> is atomically executed?

would it be correct something like? or how would you write this?

create or replace function my_function () returs integer as
$$
declare
...
status boolean;
...
begin
...
loop
begin
set transaction isolation level serializable;
...
do_something();
...
status := true;
exception serialization_failure
status := false;
end;

if status then exit;
end loop;
...
return 0;
end
$$ language plpgsql

--
Non c'e' piu' forza nella normalita', c'e' solo monotonia.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Milen A. Radev 2007-03-23 19:43:05 Re: What is the difference between rule and triggers
Previous Message Karthikeyan Sundaram 2007-03-23 19:03:32 What is the difference between rule and triggers