Skip to content
Snippets Groups Projects
Commit 3573c834 authored by Tom Lane's avatar Tom Lane
Browse files

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.
parent 2d8314bd
Branches
Tags
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.8 2010/07/12 17:01:05 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.9 2010/08/18 21:52:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -682,6 +682,14 @@ ExecModifyTable(ModifyTableState *node) ...@@ -682,6 +682,14 @@ ExecModifyTable(ModifyTableState *node)
*/ */
for (;;) for (;;)
{ {
/*
* Reset the per-output-tuple exprcontext. This is needed because
* triggers expect to use that context as workspace. It's a bit ugly
* to do this below the top level of the plan, however. We might need
* to rethink this later.
*/
ResetPerTupleExprContext(estate);
planSlot = ExecProcNode(subplanstate); planSlot = ExecProcNode(subplanstate);
if (TupIsNull(planSlot)) if (TupIsNull(planSlot))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment