aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-08-18 21:52:32 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-08-18 21:52:32 +0000
commit205fc921d727dbe547c6306ee0368f4b2a54d3aa (patch)
treed246a741707a10298c0aadb3ed088d3de7209333 /src/backend
parent2eba69addcd716bb159fce6766182c2f667e5b1c (diff)
downloadpostgresql-205fc921d727dbe547c6306ee0368f4b2a54d3aa.tar.gz
postgresql-205fc921d727dbe547c6306ee0368f4b2a54d3aa.zip
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.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/executor/nodeModifyTable.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index adfe97cefde..969938130ec 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.7 2010/02/26 02:00:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.7.4.1 2010/08/18 21:52:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -682,6 +682,14 @@ ExecModifyTable(ModifyTableState *node)
*/
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);
if (TupIsNull(planSlot))