• Peter Eisentraut's avatar
    Move portal pinning from PL/pgSQL to SPI · b3617cdf
    Peter Eisentraut authored
    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: default avatarAndrew Dunstan <andrew.dunstan@2ndquadrant.com>
    b3617cdf
spi.c 69.2 KB