1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

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>
This commit is contained in:
Peter Eisentraut
2018-03-28 18:57:10 -04:00
parent a2894cce54
commit 056a5a3f63
15 changed files with 534 additions and 87 deletions

View File

@ -1416,9 +1416,7 @@ CALL transaction_test1();
</para>
<para>
Transactions cannot be ended when a cursor created by
<literal>plpy.cursor</literal> is open or when an explicit subtransaction
is active.
Transactions cannot be ended when an explicit subtransaction is active.
</para>
</sect1>