Content-Length: 283678 | pFad | http://github.com/postgrespro/postgres/commit/3573c8346d4c1683c7052e44323abe14fb337e70

1E Reset the per-output-tuple exprcontext each time through the main loo… · postgrespro/postgres@3573c83 · GitHub
Skip to content

Commit 3573c83

Browse files
committed
Reset the per-output-tuple exprcontext each time through the main loop in
ExecModifyTable(). This avoids memory leakage when trigger functions leave junk behind in that context (as they more or less must). Problem and solution identified by Dean Rasheed. I'm a bit concerned about the longevity of this solution --- once a plan can have multiple ModifyTable nodes, we are very possibly going to have to do something different. But it should hold up for 9.0.
1 parent 2d8314b commit 3573c83

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/executor/nodeModifyTable.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.8 2010/07/12 17:01:05 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.9 2010/08/18 21:52:24 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -682,6 +682,14 @@ ExecModifyTable(ModifyTableState *node)
682682
*/
683683
for (;;)
684684
{
685+
/*
686+
* Reset the per-output-tuple exprcontext. This is needed because
687+
* triggers expect to use that context as workspace. It's a bit ugly
688+
* to do this below the top level of the plan, however. We might need
689+
* to rethink this later.
690+
*/
691+
ResetPerTupleExprContext(estate);
692+
685693
planSlot = ExecProcNode(subplanstate);
686694

687695
if (TupIsNull(planSlot))

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/3573c8346d4c1683c7052e44323abe14fb337e70

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy