Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP

From: Ravi Krishna <s_ravikrishna(at)aol(dot)com>
To: xof(at)thebuild(dot)com
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Date: 2022-10-18 21:29:11
Message-ID: VOMN1IM86IU4.HNL8WUVWUAMM3@ravi-surface
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> You can commit in a loop, but not in BEGIN / END block that has an exception handler:> that creates a subtransaction for the duration of the BEGIN / END.
The reason I have to deal with error exception is that I want to ignore failure on a table and move on to next table. 
I thought I can trick it by moving the part of the code which executes dynamic sql and has exception handler in it,to a separate procedure.  This way I can keep the main procedure without exception handler.  It failed too withthe same error.  So that means this restriction is not at lexical level, but at execution level.This is so disappointing.  It seems there is no way I can copy each table and commit it individually and also capture error.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2022-10-18 21:31:56 Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Previous Message Bryn Llewellyn 2022-10-18 21:15:20 Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP