Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP - Mailing list pgsql-general

From Bryn Llewellyn
Subject Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Date
Msg-id E05E818F-1CF6-40E2-A66A-8EB119AAB819@yugabyte.com
Whole thread Raw
In response to Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP  (Christophe Pettus <xof@thebuild.com>)
Responses Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
List pgsql-general
> xof@thebuild.com wrote:
>
>> s_ravikrishna@aol.com wrote:
>>
>> I am getting error at COMMIT -> cannot commit while a subtransaction is active...
>
> You can commit in a loop, but not in BEGIN / END block that has an exception handler: that creates a subtransaction
forthe duration of the BEGIN / END. 

This surprised me when I first started to use PG (after all those years with ORCL). There are some use cases where this
limitationis a nuisance. For example, if you want to implement the famous retry loop (with exponential backoff) for an
errorthat is provoked at commit time... well, you have to do it in client-side code. 

Could the limitation be lifted by making tractable internal implementation changes? Or is it rooted in profoundly deep
featuresof the architecture—meaning that it could never be lifted? 


pgsql-general by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Next
From: Ravi Krishna
Date:
Subject: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP