Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit931e309

Browse files
committed
Append and SubqueryScan nodes were not passing changed-parameter signals down
to their children, leading to misbehavior if they had any children that paidattention to chgParam (most plan node types don't). Append's bug has beenthere a long time, but nobody had noticed because it used to be difficultto create a query where an Append would be used below the top level of aplan; so there were never any parameters getting passed down. SubqueryScanis new in 7.1 ... and I'd modeled its behavior on Append :-(
1 parent8c2fca1 commit931e309

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

‎src/backend/executor/nodeAppend.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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.40.2.1 2001/05/08 19:48:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -362,14 +362,25 @@ ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent)
362362

363363
for (i=0;i<nplans;i++)
364364
{
365-
Plan*rescanNode;
365+
Plan*subnode;
366366

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)
370379
{
380+
/* make sure estate is correct for this subnode (needed??) */
381+
appendstate->as_whichplan=i;
371382
exec_append_initialize_next(node);
372-
ExecReScan((Plan*)rescanNode,exprCtxt, (Plan*)node);
383+
ExecReScan(subnode,exprCtxt, (Plan*)node);
373384
}
374385
}
375386
appendstate->as_whichplan=0;

‎src/backend/executor/nodeSubqueryscan.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.6 2001/03/22 06:16:13 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.6.2.1 2001/05/08 19:48:02 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -267,7 +267,18 @@ ExecSubqueryReScan(SubqueryScan *node, ExprContext *exprCtxt, Plan *parent)
267267
return;
268268
}
269269

270-
ExecReScan(node->subplan,NULL,node->subplan);
270+
/*
271+
* ExecReScan doesn't know about my subplan, so I have to do
272+
* changed-parameter signaling myself.
273+
*/
274+
if (node->scan.plan.chgParam!=NULL)
275+
SetChangedParamList(node->subplan,node->scan.plan.chgParam);
276+
/*
277+
* if chgParam of subnode is not null then plan will be re-scanned by
278+
* first ExecProcNode.
279+
*/
280+
if (node->subplan->chgParam==NULL)
281+
ExecReScan(node->subplan,NULL,node->subplan);
271282

272283
subquerystate->csstate.css_ScanTupleSlot=NULL;
273284
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp