Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okuFN-000776-5U for pgsql-general@arkaria.postgresql.org; Tue, 18 Oct 2022 21:35:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1okuFL-00084G-Dp for pgsql-general@arkaria.postgresql.org; Tue, 18 Oct 2022 21:35:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okuFL-0007zq-32 for pgsql-general@lists.postgresql.org; Tue, 18 Oct 2022 21:35:35 +0000 Received: from smtp75.iad3a.emailsrvr.com ([173.203.187.75]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okuFI-00071Y-Rf for pgsql-general@lists.postgresql.org; Tue, 18 Oct 2022 21:35:34 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp34.relay.iad3a.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 73E46239E7; Tue, 18 Oct 2022 17:35:30 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP From: Christophe Pettus In-Reply-To: Date: Tue, 18 Oct 2022 14:35:27 -0700 Cc: Ravi Krishna , pgsql-general list X-Mailbutler-Message-Id: 9742E75C-B2EF-48F8-8998-ED8D99CB0DAD Content-Transfer-Encoding: quoted-printable Message-Id: <408C4DF8-2F05-401A-B4BC-FAAAFE79CA49@thebuild.com> References: <353091661.109766.1666124045054.ref@mail.yahoo.com> <353091661.109766.1666124045054@mail.yahoo.com> <72BEC008-DC6C-4D80-80A6-E1634CFFA656@thebuild.com> To: Bryn Llewellyn X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Classification-ID: afc67b3a-9fb6-48cf-bbbc-991cbcf23565-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Oct 18, 2022, at 14:15, Bryn Llewellyn wrote: > Could the limitation be lifted by making tractable internal = implementation changes? Or is it rooted in profoundly deep features of = the architecture=E2=80=94meaning that it could never be lifted? That is a very good question. One of the issues (as I understand it) is = to be able to continue to use the same connection in the event of an = error. Here's the scenario: 1. SELECT * FROM my_func(); 2. my_func gets an error. The connection is now in an error state. 3. So, catching the exception doesn't do you much good, because future = operations will get an error. This problem is solved by wrapping it in a savepoint, since rolling back = to the savepoint will undo the error state of the connection. There might be a way forward, but it's hard to get the proper semantics = of an exception handler without doing something like that.=20=