Re: [PL/pgSQL] Commit every N rows. Is it possible ? - Mailing list pgsql-general

From Richard Huxton
Subject Re: [PL/pgSQL] Commit every N rows. Is it possible ?
Date
Msg-id 4553420D.8020405@archonet.com
Whole thread Raw
In response to [PL/pgSQL] Commit every N rows. Is it possible ?  ("Jeremiasz Miedzinski" <jmiedzinski@gmail.com>)
Responses Re: [PL/pgSQL] Commit every N rows. Is it possible ?
List pgsql-general
Jeremiasz Miedzinski wrote:
> I'm digging into postgresql documentation but maybe I'm just not smart
> enough to understand the way which transactions are being processed into
> pgSQL. Is it possible to port above code to PL/pgSQL ?

All functions, including pl/pgsql functions take place within a
transaction. You cannot commit, but you can catch errors and roll back
to savepoints within a transaction.

If you want to have multiple transactions you will need to step outside
of the database.

It's not clear to me why your function does what it does anyway. I can't
see why you wouldn't just do this as standard queries.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Jeremiasz Miedzinski"
Date:
Subject: [PL/pgSQL] Commit every N rows. Is it possible ?
Next
From: "Jeremiasz Miedzinski"
Date:
Subject: Re: cannot connect anymore from a remote host