Re: Nested Transactions in PL/pgSQL

From: John DeSoi <desoi(at)pgedit(dot)com>
To: "Nykolyn, Andrew" <andrew(dot)nykolyn(at)ngc(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Nested Transactions in PL/pgSQL
Date: 2007-07-05 23:46:34
Message-ID: B0D2BAB1-097D-4246-B884-5763A1BEDF96@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jul 5, 2007, at 1:34 PM, Nykolyn, Andrew wrote:

> Is it possible to nest transactions within a stored procedure? I
> have a stored procedure that calls many other stored procedures and
> what happens it that after a certain amount of time the server runs
> out of shared memory. I know I can increase the PostgreSQL shared
> memory. However, that would be a temporary fix. I know it will
> eventually run out again as more data is processed. The right way
> to do it is to do issue a save point or commit at various places
> in my long stored procedure. I want to believe that there is a way
> to issue commits within a stored procedure since PostgreSQL now
> supports nested transactions.

PL/pgSQL functions implicitly run within a transaction, so I don't
think you can issue BEGIN/COMMIT/ROLLBACK. But save points should be
OK. Any reason that won't work for your case?

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-07-06 00:05:59 Re: Nested Transactions in PL/pgSQL
Previous Message PFC 2007-07-05 22:53:16 Re: [pgsql-general] In memory tables/databases