From 0cbc5b1ed49ed744e856687b1d5e36d312327a34 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 26 Dec 2006 21:37:20 +0000 Subject: Fix failure due to accessing an already-freed tuple descriptor in a plan involving HashAggregate over SubqueryScan (this is the known case, there may well be more). The bug is only latent in releases before 8.2 since they didn't try to access tupletable slots' descriptors during ExecDropTupleTable. The least bogus fix seems to be to make subqueries share the parent query's memory context, so that tupdescs they create will have the same lifespan as those of the parent query. There are comments in the code envisioning going even further by not having a separate child EState at all, but that will require rethinking executor access to range tables, which I don't want to tackle right now. Per bug report from Jean-Pierre Pelletier. --- src/include/executor/executor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/include/executor') diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index beb103c88e3..c5d2c1f5cef 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.131 2006/12/04 02:06:55 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.132 2006/12/26 21:37:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -225,6 +225,7 @@ extern void end_tup_output(TupOutputState *tstate); * prototypes from functions in execUtils.c */ extern EState *CreateExecutorState(void); +extern EState *CreateSubExecutorState(EState *parent_estate); extern void FreeExecutorState(EState *estate); extern ExprContext *CreateExprContext(EState *estate); extern ExprContext *CreateStandaloneExprContext(void); -- cgit v1.2.3