Re: Transactions within a function

From: Doug McNaught <doug(at)wireboard(dot)com>
To: Daniel Åkerud <zilch(at)home(dot)se>
Cc: "PostgreSQL-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Transactions within a function
Date: 2001-07-06 13:32:28
Message-ID: m37kxm89oz.fsf@belphigor.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice pgsql-sql

Daniel kerud <zilch(at)home(dot)se> writes:

> Do the BEGIN and END in a function also indicate that it is done in a
> transaction? Or can you put another BEGIN TRANSACTION; END
> TRANSACTION; in there?

Please don't post in HTML.

A function is always executed within a transaction--either an explicit
one (where the user issues BEGIN TRANSACTION) or the implicit
transaction created by issuing a single SQL statememt. Since PG
doesn't allow nested transactions, you can't have a transaction inside
a function.

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time... --Dylan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alex Pilosov 2001-07-06 13:47:17 Re: Transactions within a function
Previous Message Morgan Curley 2001-07-06 13:30:02 Cross database foreign keys

Browse pgsql-novice by date

  From Date Subject
Next Message Alex Pilosov 2001-07-06 13:47:17 Re: Transactions within a function
Previous Message Morgan Curley 2001-07-06 13:30:02 Cross database foreign keys

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2001-07-06 13:39:19 RE: While Using COPY COMMAND ...
Previous Message Morgan Curley 2001-07-06 13:30:02 Cross database foreign keys