pgsql: Move portal pinning from PL/pgSQL to SPI

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Move portal pinning from PL/pgSQL to SPI
Date: 2018-01-10 15:23:21
Message-ID: E1eZIDp-0002KY-I8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)dunstan(at)2ndquadrant(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2018-01-10 16:24:28 pgsql: Add missing "return" statement to accumulate_append_subpath.
Previous Message Peter Eisentraut 2018-01-10 14:28:52 pgsql: Give more accurate error message for dropping pinned portal