aboutsummaryrefslogtreecommitdiff
path: root/src/include/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-07-18 19:15:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-07-18 19:15:42 +0000
commit011eae60effb07af476255be754ee491ce37164d (patch)
tree0658181eaf1b631fd1c09c2bbec19c8220f937b4 /src/include/executor
parentfb18055998f1f0256f827fe5de77b5d3369a9f21 (diff)
downloadpostgresql-011eae60effb07af476255be754ee491ce37164d.tar.gz
postgresql-011eae60effb07af476255be754ee491ce37164d.zip
Fix error cleanup failure caused by 8.4 changes in plpgsql to try to avoid
memory leakage in error recovery. We were calling FreeExprContext, and therefore invoking ExprContextCallback callbacks, in both normal and error exits from subtransactions. However this isn't very safe, as shown in recent trouble report from Frank van Vugt, in which releasing a tupledesc refcount failed. It's also unnecessary, since the resources that callbacks might wish to release should be cleaned up by other error recovery mechanisms (ie the resource owners). We only really want FreeExprContext to release memory attached to the exprcontext in the error-exit case. So, add a bool parameter to FreeExprContext to tell it not to call the callbacks. A more general solution would be to pass the isCommit bool parameter on to the callbacks, so they could do only safe things during error exit. But that would make the patch significantly more invasive and possibly break third-party code that registers ExprContextCallback callbacks. We might want to do that later in HEAD, but for now I'll just do what seems reasonable to back-patch.
Diffstat (limited to 'src/include/executor')
-rw-r--r--src/include/executor/executor.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index d4dc3672c52..ba625e8ed8c 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.155 2009/06/11 14:49:11 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.156 2009/07/18 19:15:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -255,7 +255,7 @@ extern EState *CreateExecutorState(void);
extern void FreeExecutorState(EState *estate);
extern ExprContext *CreateExprContext(EState *estate);
extern ExprContext *CreateStandaloneExprContext(void);
-extern void FreeExprContext(ExprContext *econtext);
+extern void FreeExprContext(ExprContext *econtext, bool isCommit);
extern void ReScanExprContext(ExprContext *econtext);
#define ResetExprContext(econtext) \