diff options
| author | Peter Eisentraut | 2018-01-10 21:01:17 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2018-01-10 21:01:17 +0000 |
| commit | b48b2f8793ef256d19274b4ef6ff587fd47ab553 (patch) | |
| tree | 293394967dd64aa3aca2d73c3826df02ca297b78 /src/pl | |
| parent | 3afd75eaac8aaccf5aeebc52548c396b84d85516 (diff) | |
Revert "Move portal pinning from PL/pgSQL to SPI"
This reverts commit b3617cdfbba1b5381e9d1c6bc0839500e8eb7273.
This broke returning unnamed cursors from PL/pgSQL functions.
Apparently, there are no test cases for this.
Diffstat (limited to 'src/pl')
| -rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index a326a04fc9..d096f242cd 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -5258,6 +5258,12 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt, var = (PLpgSQL_variable *) estate->datums[stmt->var->dno]; /* + * Make sure the portal doesn't get closed by the user statements we + * execute. + */ + PinPortal(portal); + + /* * Fetch the initial tuple(s). If prefetching is allowed then we grab a * few more rows to avoid multiple trips through executor startup * overhead. @@ -5318,6 +5324,8 @@ loop_exit: */ SPI_freetuptable(tuptab); + UnpinPortal(portal); + /* * Set the FOUND variable to indicate the result of executing the loop * (namely, whether we looped one or more times). This must be set last so |
