Re: Transaction within plpgsql

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Kretschmer Andreas <andreas_kretschmer(at)despammed(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Transaction within plpgsql
Date: 2005-10-03 13:47:39
Message-ID: 200510031347.j93Dldn16355@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Kretschmer Andreas wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> schrieb:
>
> > Walker, Jed S wrote:
> > > I am coding a procedure to purge data from a table. I want to commit the
> > > data I'm purging at intervals (for example, every 1000 rows). The
> > > problem I'm encountering is that when I have
> > >
> > > begin transaction;
> > > commit;
> > >
> > > statements in my plpgsql function it doesn't compile.
> > >
> > > How can you explicitly create transactions within a plpgsql function?
> >
> > No, you can not, sorry, but you might as well just do the entire thing
> > in the single transaction of the function.
>
> Hi Bruce,
>
> I think, he can use savepoints within the procedure.
> http://www.postgresql.org/docs/8.0/static/sql-savepoint.html
> But, the whole procedure is one transaction.
>
> I'm right?

Right, he can use savepoints, for sure.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message andrew 2005-10-03 14:49:20 grant select on all tables
Previous Message Andreas Kretschmer 2005-10-03 09:53:18 Re: Comparing arrays