diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-07-15 14:54:39 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-07-15 14:54:39 +0000 |
commit | 9e964f90fbfe40a71b5f0db5e7a8a76a01ea6573 (patch) | |
tree | ab87617bd11586f879b86ea77f5838695c1001e2 /src/backend/commands/explain.c | |
parent | 9fdbbdc8770c09b8bf1003d206628584889b6ec1 (diff) | |
download | postgresql-9e964f90fbfe40a71b5f0db5e7a8a76a01ea6573.tar.gz postgresql-9e964f90fbfe40a71b5f0db5e7a8a76a01ea6573.zip |
Fix explain for union and inheritance. Rename Append structure
members to be clearer. Fix cost computation for these.
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 82ef0a2939e..3c069faedfa 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.19 1998/04/27 16:57:09 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.20 1998/07/15 14:54:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -20,6 +20,7 @@ #include <tcop/tcopprot.h> #include <lib/stringinfo.h> #include <commands/explain.h> +#include <parser/parsetree.h> #include <parser/parse_node.h> #include <optimizer/planner.h> #include <access/xact.h> @@ -269,6 +270,40 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es) } es->rtable = saved_rtable; } + + if (nodeTag(plan) == T_Append) + { + List *saved_rtable = es->rtable; + List *lst; + int whichplan = 0; + Append *appendplan = (Append *)plan; + + foreach(lst, appendplan->appendplans) + { + Plan *subnode = (Plan *)lfirst(lst); + + if (appendplan->inheritrelid > 0) + { + ResTarget *rtentry; + + es->rtable = appendplan->inheritrtable; + rtentry = nth(whichplan, appendplan->inheritrtable); + Assert(rtentry != NULL); + rt_store(appendplan->inheritrelid, es->rtable, rtentry); + } + else + es->rtable = nth(whichplan, appendplan->unionrtables); + + for (i = 0; i < indent; i++) + appendStringInfo(str, " "); + appendStringInfo(str, " -> "); + + explain_outNode(str, subnode, indent + 4, es); + + whichplan++; + } + es->rtable = saved_rtable; + } return; } |