Support for subselects.

This commit is contained in:
Vadim B. Mikheev 1998-02-13 03:21:30 +00:00
parent 33c2da9725
commit 13637df458
1 changed files with 47 additions and 5 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.16 1997/12/29 05:13:22 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.17 1998/02/13 03:21:30 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -176,8 +176,10 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
break; break;
} }
#if 0
for (i = 0; i < indent; i++) for (i = 0; i < indent; i++)
appendStringInfo(str, " "); appendStringInfo(str, " ");
#endif
appendStringInfo(str, pname); appendStringInfo(str, pname);
switch (nodeTag(plan)) switch (nodeTag(plan))
@ -202,14 +204,34 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
appendStringInfo(str, buf); appendStringInfo(str, buf);
} }
appendStringInfo(str, "\n"); appendStringInfo(str, "\n");
/* initPlan-s */
if (plan->initPlan)
{
List *saved_rtable = es->rtable;
List *lst;
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " InitPlan\n");
foreach (lst, plan->initPlan)
{
es->rtable = ((SubPlan*) lfirst(lst))->rtable;
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " -> ");
explain_outNode(str, ((SubPlan*) lfirst(lst))->plan, indent + 4, es);
}
es->rtable = saved_rtable;
}
/* lefttree */ /* lefttree */
if (outerPlan(plan)) if (outerPlan(plan))
{ {
for (i = 0; i < indent; i++) for (i = 0; i < indent; i++)
appendStringInfo(str, " "); appendStringInfo(str, " ");
appendStringInfo(str, " -> "); appendStringInfo(str, " -> ");
explain_outNode(str, outerPlan(plan), indent + 1, es); explain_outNode(str, outerPlan(plan), indent + 3, es);
} }
/* righttree */ /* righttree */
@ -217,8 +239,28 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
{ {
for (i = 0; i < indent; i++) for (i = 0; i < indent; i++)
appendStringInfo(str, " "); appendStringInfo(str, " ");
appendStringInfo(str, " -> "); appendStringInfo(str, " -> ");
explain_outNode(str, innerPlan(plan), indent + 1, es); explain_outNode(str, innerPlan(plan), indent + 3, es);
}
/* subPlan-s */
if (plan->subPlan)
{
List *saved_rtable = es->rtable;
List *lst;
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " SubPlan\n");
foreach (lst, plan->subPlan)
{
es->rtable = ((SubPlan*) lfirst(lst))->rtable;
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " -> ");
explain_outNode(str, ((SubPlan*) lfirst(lst))->plan, indent + 4, es);
}
es->rtable = saved_rtable;
} }
return; return;
} }