pgsql: Move portal pinning from PL/pgSQL to SPI - Mailing list pgsql-committers

From Peter Eisentraut
Subject pgsql: Move portal pinning from PL/pgSQL to SPI
Date
Msg-id E1eZIDp-0002KY-I8@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Move portal pinning from PL/pgSQL to SPI

PL/pgSQL "pins" internally generated (unnamed) portals so that user code
cannot close them by guessing their names.  This logic is also useful in
other languages and really for any code.  So move that logic into SPI.
An unnamed portal obtained through SPI_cursor_open() and related
functions is now automatically pinned, and SPI_cursor_close()
automatically unpins a portal that is pinned.

In the core distribution, this affects PL/Perl and PL/Python, preventing
users from manually closing cursors created by spi_query and
plpy.cursor, respectively.  (PL/Tcl does not currently offer any cursor
functionality.)

Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b3617cdfbba1b5381e9d1c6bc0839500e8eb7273

Modified Files
--------------
src/backend/executor/spi.c   | 9 +++++++++
src/pl/plpgsql/src/pl_exec.c | 8 --------
2 files changed, 9 insertions(+), 8 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Give more accurate error message for dropping pinned portal
Next
From: Robert Haas
Date:
Subject: pgsql: Add missing "return" statement to accumulate_append_subpath.