Fix possible failures when a tuplestore switches from in-memory to on-disk
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 Mar 2009 18:30:21 +0000 (18:30 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 27 Mar 2009 18:30:21 +0000 (18:30 +0000)
commit2f60517a3d3175e36114ba032cbdd9bbaf6dc86f
tree324a4b5babed5fc6e162684c06b9a0677cc5fde9
parentee1c8c4d43182f0f6e9a3cbf8111a496c04b3909
Fix possible failures when a tuplestore switches from in-memory to on-disk
mode while callers hold pointers to in-memory tuples.  I reported this for
the case of nodeWindowAgg's primary scan tuple, but inspection of the code
shows that all of the calls in nodeWindowAgg and nodeCtescan are at risk.
For the moment, fix it with a rather brute-force approach of copying
whenever one of the at-risk callers requests a tuple.  Later we might
think of some sort of reference-count approach to reduce tuple copying.
src/backend/executor/execQual.c
src/backend/executor/functions.c
src/backend/executor/nodeCtescan.c
src/backend/executor/nodeFunctionscan.c
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeWindowAgg.c
src/backend/executor/nodeWorktablescan.c
src/backend/tcop/pquery.c
src/backend/utils/sort/tuplestore.c
src/include/utils/tuplestore.h