]> granicus.if.org Git - postgresql/commit
Fix failure due to accessing an already-freed tuple descriptor in a plan
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Dec 2006 21:37:20 +0000 (21:37 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Dec 2006 21:37:20 +0000 (21:37 +0000)
commit0cbc5b1ed49ed744e856687b1d5e36d312327a34
tree6a56142c89f023731a991141114ef070c5a3f470
parent68996463d405a0e3e35f81371ffebbbaff7c1f63
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/backend/executor/execMain.c
src/backend/executor/execUtils.c
src/backend/executor/nodeSubplan.c
src/backend/executor/nodeSubqueryscan.c
src/include/executor/executor.h
src/include/nodes/execnodes.h