Skip to content

Commit 13637df

Browse files
committed
Support for subselects.
1 parent 33c2da9 commit 13637df

File tree

1 file changed

+47
-5
lines changed

1 file changed

+47
-5
lines changed

src/backend/commands/explain.c

Lines changed: 47 additions & 5 deletions
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.16 1997/12/29 05:13:22 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.17 1998/02/13 03:21:30 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -176,8 +176,10 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
176176
break;
177177
}
178178

179+
#if 0
179180
for (i = 0; i < indent; i++)
180181
appendStringInfo(str, " ");
182+
#endif
181183

182184
appendStringInfo(str, pname);
183185
switch (nodeTag(plan))
@@ -202,23 +204,63 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
202204
appendStringInfo(str, buf);
203205
}
204206
appendStringInfo(str, "\n");
207+
208+
/* initPlan-s */
209+
if (plan->initPlan)
210+
{
211+
List *saved_rtable = es->rtable;
212+
List *lst;
213+
214+
for (i = 0; i < indent; i++)
215+
appendStringInfo(str, " ");
216+
appendStringInfo(str, " InitPlan\n");
217+
foreach (lst, plan->initPlan)
218+
{
219+
es->rtable = ((SubPlan*) lfirst(lst))->rtable;
220+
for (i = 0; i < indent; i++)
221+
appendStringInfo(str, " ");
222+
appendStringInfo(str, " -> ");
223+
explain_outNode(str, ((SubPlan*) lfirst(lst))->plan, indent + 4, es);
224+
}
225+
es->rtable = saved_rtable;
226+
}
205227

206228
/* lefttree */
207229
if (outerPlan(plan))
208230
{
209231
for (i = 0; i < indent; i++)
210232
appendStringInfo(str, " ");
211-
appendStringInfo(str, " -> ");
212-
explain_outNode(str, outerPlan(plan), indent + 1, es);
233+
appendStringInfo(str, " -> ");
234+
explain_outNode(str, outerPlan(plan), indent + 3, es);
213235
}
214236

215237
/* righttree */
216238
if (innerPlan(plan))
217239
{
218240
for (i = 0; i < indent; i++)
219241
appendStringInfo(str, " ");
220-
appendStringInfo(str, " -> ");
221-
explain_outNode(str, innerPlan(plan), indent + 1, es);
242+
appendStringInfo(str, " -> ");
243+
explain_outNode(str, innerPlan(plan), indent + 3, es);
244+
}
245+
246+
/* subPlan-s */
247+
if (plan->subPlan)
248+
{
249+
List *saved_rtable = es->rtable;
250+
List *lst;
251+
252+
for (i = 0; i < indent; i++)
253+
appendStringInfo(str, " ");
254+
appendStringInfo(str, " SubPlan\n");
255+
foreach (lst, plan->subPlan)
256+
{
257+
es->rtable = ((SubPlan*) lfirst(lst))->rtable;
258+
for (i = 0; i < indent; i++)
259+
appendStringInfo(str, " ");
260+
appendStringInfo(str, " -> ");
261+
explain_outNode(str, ((SubPlan*) lfirst(lst))->plan, indent + 4, es);
262+
}
263+
es->rtable = saved_rtable;
222264
}
223265
return;
224266
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy