Re: Problem with stored procedure and nested transactions

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Problem with stored procedure and nested transactions
Дата
Msg-id 9b2b5575-7e28-832e-3559-7bfce974c525@2ndquadrant.com
обсуждение исходный текст
Ответ на Problem with stored procedure and nested transactions  (<p.pierotti@mmbb.it>)
Список pgsql-general
On 30/10/2018 15:03, p.pierotti@mmbb.it wrote:
> I thought that the “BEGIN/END” block was used to create new transactions
> and that each of them could be managed individually.

In PL/pgSQL, BEGIN/END just create syntactic blocks, they don't manage
transactions.

COMMIT and ROLLBACK manage top-level transactions, but those cannot be
nested (since they are top-level).

In order to create a nested transaction structure, you need to use
subtransactions.  In PL/pgSQL, you can use BEGIN/END blocks with an
exception clause to create subtransactions.

I'm not sure what your code is actually trying to do, but you might need
to reorganize it a bit.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: backend crash on DELETE, reproducible locally
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Re: backend crash on DELETE, reproducible locally