Re: concurrency in stored procedures

Поиск
Список
Период
Сортировка
От Ottavio Campana
Тема Re: concurrency in stored procedures
Дата
Msg-id 46042857.5030508@campana.vi.it
обсуждение исходный текст
Ответ на concurrency in stored procedures  (Ottavio Campana <ottavio@campana.vi.it>)
Ответы Re: concurrency in stored procedures  ("Merlin Moncure" <mmoncure@gmail.com>)
Список 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.


Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Ottavio Campana
Дата:
Сообщение: concurrency in stored procedures
Следующее
От: "Milen A. Radev"
Дата:
Сообщение: Re: What is the difference between rule and triggers