Functions and transactions
Functions and transactions
От:
Giorgio Valoti <giorgio_v@mac.com>
Дата:
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
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 http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines.