Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb48b2f8

Browse files
committed
Revert "Move portal pinning from PL/pgSQL to SPI"
This reverts commitb3617cd.This broke returning unnamed cursors from PL/pgSQL functions.Apparently, there are no test cases for this.
1 parent3afd75e commitb48b2f8

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

‎src/backend/executor/spi.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,12 +1175,6 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
11751175
{
11761176
/* Use a random nonconflicting name */
11771177
portal=CreateNewPortal();
1178-
1179-
/*
1180-
* Make sure the portal doesn't get closed by the user statements we
1181-
* execute.
1182-
*/
1183-
PinPortal(portal);
11841178
}
11851179
else
11861180
{
@@ -1419,9 +1413,6 @@ SPI_cursor_close(Portal portal)
14191413
if (!PortalIsValid(portal))
14201414
elog(ERROR,"invalid portal in SPI cursor operation");
14211415

1422-
if (portal->portalPinned)
1423-
UnpinPortal(portal);
1424-
14251416
PortalDrop(portal, false);
14261417
}
14271418

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5257,6 +5257,12 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
52575257
/* Fetch loop variable's datum entry */
52585258
var= (PLpgSQL_variable*)estate->datums[stmt->var->dno];
52595259

5260+
/*
5261+
* Make sure the portal doesn't get closed by the user statements we
5262+
* execute.
5263+
*/
5264+
PinPortal(portal);
5265+
52605266
/*
52615267
* Fetch the initial tuple(s). If prefetching is allowed then we grab a
52625268
* few more rows to avoid multiple trips through executor startup
@@ -5318,6 +5324,8 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
53185324
*/
53195325
SPI_freetuptable(tuptab);
53205326

5327+
UnpinPortal(portal);
5328+
53215329
/*
53225330
* Set the FOUND variable to indicate the result of executing the loop
53235331
* (namely, whether we looped one or more times). This must be set last so

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp