From: Christophe Pettus <xof@thebuild.com>
To: Bryn Llewellyn <bryn@yugabyte.com>
Cc: Ravi Krishna <s_ravikrishna@aol.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Date: Tue, 18 Oct 2022 14:35:27 -0700
Message-ID: <408C4DF8-2F05-401A-B4BC-FAAAFE79CA49@thebuild.com> (raw)
In-Reply-To: <E05E818F-1CF6-40E2-A66A-8EB119AAB819@yugabyte.com>
References: <353091661.109766.1666124045054.ref@mail.yahoo.com>
<353091661.109766.1666124045054@mail.yahoo.com>
<72BEC008-DC6C-4D80-80A6-E1634CFFA656@thebuild.com>
<E05E818F-1CF6-40E2-A66A-8EB119AAB819@yugabyte.com>
> On Oct 18, 2022, at 14:15, Bryn Llewellyn <bryn@yugabyte.com> wrote:
> Could the limitation be lifted by making tractable internal implementation changes? Or is it rooted in profoundly deep features of the architecture—meaning 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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: xof@thebuild.com, bryn@yugabyte.com, s_ravikrishna@aol.com
Subject: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
In-Reply-To: <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> <E05E818F-1CF6-40E2-A66A-8EB119AAB819@yugabyte.com> <408C4DF8-2F05-401A-B4BC-FAAAFE79CA49@thebuild.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox