From f1d8828e3ce8040e16794fb4d44255d8aef7df34 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 26 Dec 2006 19:27:04 +0000 Subject: Repair bug #2839: the various ExecReScan functions need to reset ps_TupFromTlist in plan nodes that make use of it. This was being done correctly in join nodes and Result nodes but not in any relation-scan nodes. Bug would lead to bogus results if a set-returning function appeared in the targetlist of a subquery that could be rescanned after partial execution, for example a subquery within EXISTS(). Bug has been around forever :-( ... surprising it wasn't reported before. --- src/backend/executor/nodeIndexscan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/backend/executor/nodeIndexscan.c') diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 009aba997f6..63a6073f779 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.104.2.1 2005/11/22 18:23:09 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.104.2.2 2006/12/26 19:27:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -183,6 +183,8 @@ ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt) numScanKeys = node->iss_NumScanKeys; scanrelid = ((IndexScan *) node->ss.ps.plan)->scan.scanrelid; + node->ss.ps.ps_TupFromTlist = false; + if (econtext) { /* @@ -384,6 +386,8 @@ ExecInitIndexScan(IndexScan *node, EState *estate) */ ExecAssignExprContext(estate, &indexstate->ss.ps); + indexstate->ss.ps.ps_TupFromTlist = false; + /* * initialize child expressions * -- cgit v1.2.3