aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/commands/explain.c52
1 files changed, 47 insertions, 5 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 2d90ce4858d..879fdc82d05 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -7,7 +7,7 @@
*
*
* 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;
}
+#if 0
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
+#endif
appendStringInfo(str, pname);
switch (nodeTag(plan))
@@ -202,14 +204,34 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
appendStringInfo(str, buf);
}
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 */
if (outerPlan(plan))
{
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
- appendStringInfo(str, " -> ");
- explain_outNode(str, outerPlan(plan), indent + 1, es);
+ appendStringInfo(str, " -> ");
+ explain_outNode(str, outerPlan(plan), indent + 3, es);
}
/* righttree */
@@ -217,8 +239,28 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
{
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
- appendStringInfo(str, " -> ");
- explain_outNode(str, innerPlan(plan), indent + 1, es);
+ appendStringInfo(str, " -> ");
+ 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;
}