Fix an oversight in two different recent patches: nodes that support SRFs
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 23 Oct 2008 15:29:23 +0000 (15:29 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 23 Oct 2008 15:29:23 +0000 (15:29 +0000)
in their targetlists had better reset ps_TupFromTlist during ReScan calls.
There's no need to back-patch here since nodeAgg and nodeGroup didn't
even pretend to support SRFs in prior releases.

src/backend/executor/nodeAgg.c
src/backend/executor/nodeCtescan.c
src/backend/executor/nodeGroup.c
src/backend/executor/nodeWorktablescan.c

index 1af10dfefc3aca69e5cd5ff8cdece14c96386ffa..d0f2186130484c9a75b499276e637dd5cc9cb678 100644 (file)
@@ -61,7 +61,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.162 2008/10/16 19:25:55 neilc Exp $
+ *   $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.163 2008/10/23 15:29:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1284,6 +1284,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
    ExecAssignResultTypeFromTL(&aggstate->ss.ps);
    ExecAssignProjectionInfo(&aggstate->ss.ps, NULL);
 
+   aggstate->ss.ps.ps_TupFromTlist = false;
+
    /*
     * get the count of aggregates in targetlist and quals
     */
@@ -1647,6 +1649,8 @@ ExecReScanAgg(AggState *node, ExprContext *exprCtxt)
 
    node->agg_done = false;
 
+   node->ss.ps.ps_TupFromTlist = false;
+
    if (((Agg *) node->ss.ps.plan)->aggstrategy == AGG_HASHED)
    {
        /*
index b4ae27df38547247201e5fc4758f04b948249983..b13736b08e339ba7b5bcdc37ad1b26d49a2b6456 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.1 2008/10/04 21:56:53 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.2 2008/10/23 15:29:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -303,11 +303,10 @@ ExecEndCteScan(CteScanState *node)
 void
 ExecCteScanReScan(CteScanState *node, ExprContext *exprCtxt)
 {
-   Tuplestorestate *tuplestorestate;
-
-   tuplestorestate = node->leader->cte_table;
+   Tuplestorestate *tuplestorestate = node->leader->cte_table;
 
    ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
+   node->ss.ps.ps_TupFromTlist = false;
 
    if (node->leader == node)
    {
index 31566f1fb52765626e46f4c731bfa7cfb65dcc72..63d9c96cdf8f5f68b7ec5daec44f9508cb1de13a 100644 (file)
@@ -15,7 +15,7 @@
  *   locate group boundaries.
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/executor/nodeGroup.c,v 1.71 2008/09/08 00:22:56 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/executor/nodeGroup.c,v 1.72 2008/10/23 15:29:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -247,6 +247,8 @@ ExecInitGroup(Group *node, EState *estate, int eflags)
    ExecAssignResultTypeFromTL(&grpstate->ss.ps);
    ExecAssignProjectionInfo(&grpstate->ss.ps, NULL);
 
+   grpstate->ss.ps.ps_TupFromTlist = false;
+
    /*
     * Precompute fmgr lookup data for inner loop
     */
@@ -286,6 +288,7 @@ void
 ExecReScanGroup(GroupState *node, ExprContext *exprCtxt)
 {
    node->grp_done = FALSE;
+   node->ss.ps.ps_TupFromTlist = false;
    /* must clear first tuple */
    ExecClearTuple(node->ss.ss_ScanTupleSlot);
 
index a597240fe60402d4ac0ab826e83f51110565e2db..49b7279aba8b46d1906bbf5baa5928e1752a9c5c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.2 2008/10/13 00:41:40 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.3 2008/10/23 15:29:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -204,6 +204,8 @@ void
 ExecWorkTableScanReScan(WorkTableScanState *node, ExprContext *exprCtxt)
 {
    ExecClearTuple(node->ss.ps.ps_ResultTupleSlot);
+   node->ss.ps.ps_TupFromTlist = false;
+
    /* No need (or way) to rescan if ExecWorkTableScan not called yet */
    if (node->rustate)
        tuplestore_rescan(node->rustate->working_table);