|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.40 2001/03/22 06:16:12 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.41 2001/05/08 19:47:02 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -362,14 +362,25 @@ ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent)
|
362 | 362 |
|
363 | 363 | for (i = 0; i < nplans; i++)
|
364 | 364 | {
|
365 |
| - Plan *rescanNode; |
| 365 | + Plan *subnode; |
366 | 366 |
|
367 |
| - appendstate->as_whichplan = i; |
368 |
| - rescanNode = (Plan *) nth(i, node->appendplans); |
369 |
| - if (rescanNode->chgParam == NULL) |
| 367 | + subnode = (Plan *) nth(i, node->appendplans); |
| 368 | + /* |
| 369 | + * ExecReScan doesn't know about my subplans, so I have to do |
| 370 | + * changed-parameter signaling myself. |
| 371 | + */ |
| 372 | + if (node->plan.chgParam != NULL) |
| 373 | + SetChangedParamList(subnode, node->plan.chgParam); |
| 374 | + /* |
| 375 | + * if chgParam of subnode is not null then plan will be re-scanned by |
| 376 | + * first ExecProcNode. |
| 377 | + */ |
| 378 | + if (subnode->chgParam == NULL) |
370 | 379 | {
|
| 380 | + /* make sure estate is correct for this subnode (needed??) */ |
| 381 | + appendstate->as_whichplan = i; |
371 | 382 | exec_append_initialize_next(node);
|
372 |
| - ExecReScan((Plan *) rescanNode, exprCtxt, (Plan *) node); |
| 383 | + ExecReScan(subnode, exprCtxt, (Plan *) node); |
373 | 384 | }
|
374 | 385 | }
|
375 | 386 | appendstate->as_whichplan = 0;
|
|
0 commit comments