Re: Transactions within a function body

From: "Dennis Brakhane" <brakhane(at)googlemail(dot)com>
To: "Reg Me Please" <regmeplease(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Transactions within a function body
Date: 2008-10-01 21:20:47
Message-ID: 226a19190810011420j4dfe4a74oded00094895395be@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Oct 1, 2008 at 5:54 PM, Reg Me Please <regmeplease(at)gmail(dot)com> wrote:
> Hi all.
>
> Is there a way to have (sub)transactions within a function body?
> I'd like to execute some code (a transaction!) inside a function and later
> decide whether that transaction is to be committed or not.

You could issue a "SAVEPOINT name". If at the end you don't want your
changes to apply, you can issue a "ROLLBACK to name"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-10-01 21:38:57 Re: inserting only new rows from csv file
Previous Message Seb 2008-10-01 21:16:44 inserting only new rows from csv file

Browse pgsql-hackers by date

  From Date Subject
Next Message pgsql 2008-10-01 21:51:33 Re: Block-level CRC checks
Previous Message Tom Lane 2008-10-01 20:16:13 Re: Block-level CRC checks