From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow committing inside cursor loop
Date: Wed, 28 Mar 2018 23:15:28 +0000
Message-ID: <E1f1KHw-0007SU-AA@gemulon.postgresql.org> (raw)
Allow committing inside cursor loop
Previously, committing or aborting inside a cursor loop was prohibited
because that would close and remove the cursor. To allow that,
automatically convert such cursors to holdable cursors so they survive
commits or rollbacks. Portals now have a new state "auto-held", which
means they have been converted automatically from pinned. An auto-held
portal is kept on transaction commit or rollback, but is still removed
when returning to the main loop on error.
This supports all languages that have cursor loop constructs: PL/pgSQL,
PL/Python, PL/Perl.
Reviewed-by: Ildus Kurbangaliev <i.kurbangaliev@postgrespro.ru>
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/056a5a3f63f1a29d9266165ee6e25c6a51ddd63c
Modified Files
--------------
doc/src/sgml/plperl.sgml | 5 -
doc/src/sgml/plpgsql.sgml | 37 +++++-
doc/src/sgml/plpython.sgml | 4 +-
src/backend/tcop/postgres.c | 2 +
src/backend/utils/mmgr/portalmem.c | 138 ++++++++++++++++-----
src/include/utils/portal.h | 5 +-
src/pl/plperl/expected/plperl_transaction.out | 71 ++++++++++-
src/pl/plperl/plperl.c | 10 +-
src/pl/plperl/sql/plperl_transaction.sql | 43 +++++++
.../plpgsql/src/expected/plpgsql_transaction.out | 108 +++++++++++++++-
src/pl/plpgsql/src/pl_exec.c | 18 +--
src/pl/plpgsql/src/sql/plpgsql_transaction.sql | 67 ++++++++++
src/pl/plpython/expected/plpython_transaction.out | 67 +++++++++-
src/pl/plpython/plpy_plpymodule.c | 10 +-
src/pl/plpython/sql/plpython_transaction.sql | 36 ++++++
15 files changed, 534 insertions(+), 87 deletions(-)
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-committers@postgresql.org
Cc: peter_e@gmx.net
Subject: Re: pgsql: Allow committing inside cursor loop
In-Reply-To: <E1f1KHw-0007SU-AA@gemulon.postgresql.org>
References: <E1f1KHw-0007SU-AA@gemulon.postgresql.org>
* 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