Обсуждение: Functions and transactions

Поиск
Список
Период
Сортировка

Functions and transactions

От
Giorgio Valoti
Дата:
    Hi all, the documentation says that functions are always executed
within the transaction established by the outer query. However, I was
quite surprised (in a positive way, that is) seeing that if a
function call causes some error, the whole function is "rolled back".
Is this the expected behavior?

Thank you
--
Giorgio Valoti





Re: Functions and transactions

От
Martijn van Oosterhout
Дата:
On Tue, Apr 08, 2008 at 03:44:47PM +0200, Giorgio Valoti wrote:
>     Hi all, the documentation says that functions are always executed
> within the transaction established by the outer query. However, I was
> quite surprised (in a positive way, that is) seeing that if a
> function call causes some error, the whole function is "rolled back".
> Is this the expected behavior?

Yes. Just like errors in queries cause the transaction to be rolled
back. Mind you, inside functions you can trap errors, but the default
is to rollback everything in the current transaction.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

Вложения