Re: Commit every N rows in PL/pgsql

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Len Walter <len(dot)walter(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Commit every N rows in PL/pgsql
Date: 2010-05-26 07:36:17
Message-ID: AANLkTimzql49rEHkx3xf_GXs1ple_tRG1enAeXjIt5U0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 26, 2010 at 1:27 AM, Len Walter <len(dot)walter(at)gmail(dot)com> wrote:
>
> PL/pgsql doesn't allow that because it doesn't support nested transactions.
> Is there an equivalent Postgres way of doing this?

what about this?

create function f() returns void as $$
declare
r record;
begin
for r in select col_a from t loop
update t set col_c = col_a + col_b where col_a = r.a;
end loop;
return;
end;
$$ language plpgsql;

--
Jaime Casanova www.2ndQuadrant.com
Soporte y capacitación de PostgreSQL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Or Kroyzer 2010-05-26 08:24:07 recovery after interrupt in the middle of a previous recovery
Previous Message Durumdara 2010-05-26 06:59:00 Bytea/Text blob deletion is very slow...