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

Commit9e964f9

Browse files
committed
Fix explain for union and inheritance. Rename Append structure
members to be clearer. Fix cost computation for these.
1 parent9fdbbdc commit9e964f9

File tree

10 files changed

+185
-128
lines changed

10 files changed

+185
-128
lines changed

‎src/backend/commands/explain.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.19 1998/04/27 16:57:09 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.20 1998/07/15 14:54:29 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -20,6 +20,7 @@
2020
#include<tcop/tcopprot.h>
2121
#include<lib/stringinfo.h>
2222
#include<commands/explain.h>
23+
#include<parser/parsetree.h>
2324
#include<parser/parse_node.h>
2425
#include<optimizer/planner.h>
2526
#include<access/xact.h>
@@ -269,6 +270,40 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
269270
}
270271
es->rtable=saved_rtable;
271272
}
273+
274+
if (nodeTag(plan)==T_Append)
275+
{
276+
List*saved_rtable=es->rtable;
277+
List*lst;
278+
intwhichplan=0;
279+
Append*appendplan= (Append*)plan;
280+
281+
foreach(lst,appendplan->appendplans)
282+
{
283+
Plan*subnode= (Plan*)lfirst(lst);
284+
285+
if (appendplan->inheritrelid>0)
286+
{
287+
ResTarget*rtentry;
288+
289+
es->rtable=appendplan->inheritrtable;
290+
rtentry=nth(whichplan,appendplan->inheritrtable);
291+
Assert(rtentry!=NULL);
292+
rt_store(appendplan->inheritrelid,es->rtable,rtentry);
293+
}
294+
else
295+
es->rtable=nth(whichplan,appendplan->unionrtables);
296+
297+
for (i=0;i<indent;i++)
298+
appendStringInfo(str," ");
299+
appendStringInfo(str," -> ");
300+
301+
explain_outNode(str,subnode,indent+4,es);
302+
303+
whichplan++;
304+
}
305+
es->rtable=saved_rtable;
306+
}
272307
return;
273308
}
274309

‎src/backend/executor/execTuples.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.18 1998/04/24 14:41:46 momjian Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.19 1998/07/15 14:54:29 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -712,16 +712,16 @@ NodeGetResultTupleSlot(Plan *node)
712712
caseT_Append:
713713
{
714714
Append*n= (Append*)node;
715-
AppendState*unionstate;
716-
List*unionplans;
715+
AppendState*appendstate;
716+
List*appendplans;
717717
intwhichplan;
718718
Plan*subplan;
719719

720-
unionstate=n->unionstate;
721-
unionplans=n->unionplans;
722-
whichplan=unionstate->as_whichplan;
720+
appendstate=n->appendstate;
721+
appendplans=n->appendplans;
722+
whichplan=appendstate->as_whichplan;
723723

724-
subplan= (Plan*)nth(whichplan,unionplans);
724+
subplan= (Plan*)nth(whichplan,appendplans);
725725
slot=NodeGetResultTupleSlot(subplan);
726726
break;
727727
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp