Skip to content

Commit 8759b79

Browse files
committed
Add a couple of missing FreeQueryDesc calls. Noticed while testing a
framework to keep track of snapshots in use.
1 parent 4e22844 commit 8759b79

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/backend/commands/portalcmds.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.69 2008/01/01 19:45:49 momjian Exp $
17+
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.70 2008/03/20 20:05:56 alvherre Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -262,6 +262,7 @@ PortalCleanup(Portal portal)
262262
CurrentResourceOwner = portal->resowner;
263263
/* we do not need AfterTriggerEndQuery() here */
264264
ExecutorEnd(queryDesc);
265+
FreeQueryDesc(queryDesc);
265266
}
266267
PG_CATCH();
267268
{
@@ -362,6 +363,7 @@ PersistHoldablePortal(Portal portal)
362363
portal->queryDesc = NULL; /* prevent double shutdown */
363364
/* we do not need AfterTriggerEndQuery() here */
364365
ExecutorEnd(queryDesc);
366+
FreeQueryDesc(queryDesc);
365367

366368
/*
367369
* Set the position in the result set: ideally, this could be

src/backend/executor/spi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.188 2008/02/12 04:09:44 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.189 2008/03/20 20:05:56 alvherre Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1541,7 +1541,6 @@ _SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
15411541
{
15421542
Node *stmt = (Node *) lfirst(lc2);
15431543
bool canSetTag;
1544-
QueryDesc *qdesc;
15451544
DestReceiver *dest;
15461545

15471546
_SPI_current->processed = 0;
@@ -1617,6 +1616,8 @@ _SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
16171616
if (IsA(stmt, PlannedStmt) &&
16181617
((PlannedStmt *) stmt)->utilityStmt == NULL)
16191618
{
1619+
QueryDesc *qdesc;
1620+
16201621
qdesc = CreateQueryDesc((PlannedStmt *) stmt,
16211622
ActiveSnapshot,
16221623
crosscheck_snapshot,
@@ -1790,6 +1791,7 @@ _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, long tcount)
17901791
AfterTriggerEndQuery(queryDesc->estate);
17911792

17921793
ExecutorEnd(queryDesc);
1794+
/* FreeQueryDesc is done by the caller */
17931795

17941796
#ifdef SPI_EXECUTOR_STATS
17951797
if (ShowExecutorStats)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy