Re: Transactions in functions ( was Re: transactions, serial ids, and JDBC) - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Transactions in functions ( was Re: transactions, serial ids, and JDBC)
Date
Msg-id 20020810130027.A19769@svana.org
Whole thread Raw
In response to Transactions in functions ( was Re: transactions, serial ids, and JDBC)  (Steve Lane <slane@fmpro.com>)
List pgsql-general
On Fri, Aug 09, 2002 at 08:48:34PM -0500, Steve Lane wrote:
> I believe I read elsewhere that transactional logic doesn't work or doesn't
> apply in a function. And the message above seems to imply that the function
> will behave transactionally without explicit begin/commit.

I think you mean that you cannot start new transactions within a function.;
This is true as postgres does not support nested transactions. However,
functions are always within a transaction as they always appear as part of a
statement at the top level.

> So what do I need to do, or not do, in order that the function executes the
> way I intend, that all three UPDATES will succeed or fail?

Nothing. It'll work that way anyway.
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: AS keyword
Next
From: Rob Brown-Bayliss
Date:
Subject: Re: oid's and primary keys on insert