• Robert Haas's avatar
    Improve access to parallel query from procedural languages. · 61c2e1a9
    Robert Haas authored
    In SQL, the ability to use parallel query was previous contingent on
    fcache->readonly_func, which is only set for non-volatile functions;
    but the volatility of a function has no bearing on whether queries
    inside it can use parallelism.  Remove that condition.
    
    SPI_execute and SPI_execute_with_args always run the plan just once,
    though not necessarily to completion.  Given the changes in commit
    691b8d59, it's sensible to pass
    CURSOR_OPT_PARALLEL_OK here, so do that.  This improves access to
    parallelism for any caller that uses these functions to execute
    queries.  Such callers include plperl, plpython, pltcl, and plpgsql,
    though it's not the case that they all use these functions
    exclusively.
    
    In plpgsql, allow parallel query for plain SELECT queries (as
    opposed to PERFORM, which already worked) and for plain expressions
    (which probably won't go through the executor at all, because they
    will likely be simple expressions, but if they do then this helps).
    
    Rafia Sabih and Robert Haas, reviewed by Dilip Kumar and Amit Kapila
    
    Discussion: http://postgr.es/m/CAOGQiiMfJ+4SQwgG=6CVHWoisiU0+7jtXSuiyXBM3y=A=eJzmg@mail.gmail.com
    61c2e1a9
spi.c 64.6 KB