|
6 | 6 | * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
7 | 7 | * Portions Copyright (c) 1994, Regents of the University of California
|
8 | 8 | *
|
9 |
| - * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.76 2003/11/29 19:51:48 pgsql Exp $ |
| 9 | + * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.77 2003/12/18 20:21:37 tgl Exp $ |
10 | 10 | *
|
11 | 11 | *-------------------------------------------------------------------------
|
12 | 12 | */
|
|
39 | 39 | #include "executor/nodeUnique.h"
|
40 | 40 |
|
41 | 41 |
|
42 |
| -/* ---------------------------------------------------------------- |
43 |
| - * ExecReScan |
| 42 | +/* |
| 43 | + * ExecReScan |
| 44 | + * Reset a plan node so that its output can be re-scanned. |
| 45 | + * |
| 46 | + * Note that if the plan node has parameters that have changed value, |
| 47 | + * the output might be different from last time. |
44 | 48 | *
|
45 |
| - * takes the new expression context as an argument, so that |
46 |
| - * index scans needn't have their scan keys updated separately |
47 |
| - * - marcel 09/20/94 |
48 |
| - * ---------------------------------------------------------------- |
| 49 | + * The second parameter is currently only used to pass a NestLoop plan's |
| 50 | + * econtext down to its inner child plan, in case that is an indexscan that |
| 51 | + * needs access to variables of the current outer tuple. (The handling of |
| 52 | + * this parameter is currently pretty inconsistent: some callers pass NULL |
| 53 | + * and some pass down their parent's value; so don't rely on it in other |
| 54 | + * situations. It'd probably be better to remove the whole thing and use |
| 55 | + * the generalized parameter mechanism instead.) |
49 | 56 | */
|
50 | 57 | void
|
51 | 58 | ExecReScan(PlanState *node, ExprContext *exprCtxt)
|
@@ -85,6 +92,11 @@ ExecReScan(PlanState *node, ExprContext *exprCtxt)
|
85 | 92 | UpdateChangedParamSet(node->righttree, node->chgParam);
|
86 | 93 | }
|
87 | 94 |
|
| 95 | + /* Shut down any SRFs in the plan node's targetlist */ |
| 96 | + if (node->ps_ExprContext) |
| 97 | + ReScanExprContext(node->ps_ExprContext); |
| 98 | + |
| 99 | + /* And do node-type-specific processing */ |
88 | 100 | switch (nodeTag(node))
|
89 | 101 | {
|
90 | 102 | case T_ResultState:
|
|
0 commit comments