Re: Transactions in functions ( was Re: transactions, serial ids, and JDBC)

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Steve Lane <slane(at)fmpro(dot)com>
Cc: PostgreSQL general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Transactions in functions ( was Re: transactions, serial ids, and JDBC)
Date: 2002-08-10 03:00:27
Message-ID: 20020810130027.A19769@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Brown-Bayliss 2002-08-10 03:03:36 Re: oid's and primary keys on insert
Previous Message Joe Conway 2002-08-10 02:02:07 Re: AS keyword