summaryrefslogtreecommitdiff
path: root/src/backend/nodes/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes/print.c')
-rw-r--r--src/backend/nodes/print.c171
1 files changed, 1 insertions, 170 deletions
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index 06d28b56b2..c6edfbed8a 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.84 2007/02/10 14:58:54 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.85 2007/02/22 22:00:23 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -25,7 +25,6 @@
#include "parser/parsetree.h"
#include "utils/lsyscache.h"
-static char *plannode_type(Plan *p);
/*
* print
@@ -488,171 +487,3 @@ print_slot(TupleTableSlot *slot)
debugtup(slot, NULL);
}
-
-static char *
-plannode_type(Plan *p)
-{
- switch (nodeTag(p))
- {
- case T_Plan:
- return "PLAN";
- case T_Result:
- return "RESULT";
- case T_Append:
- return "APPEND";
- case T_BitmapAnd:
- return "BITMAPAND";
- case T_BitmapOr:
- return "BITMAPOR";
- case T_Scan:
- return "SCAN";
- case T_SeqScan:
- return "SEQSCAN";
- case T_IndexScan:
- return "INDEXSCAN";
- case T_BitmapIndexScan:
- return "BITMAPINDEXSCAN";
- case T_BitmapHeapScan:
- return "BITMAPHEAPSCAN";
- case T_TidScan:
- return "TIDSCAN";
- case T_SubqueryScan:
- return "SUBQUERYSCAN";
- case T_FunctionScan:
- return "FUNCTIONSCAN";
- case T_ValuesScan:
- return "VALUESSCAN";
- case T_Join:
- return "JOIN";
- case T_NestLoop:
- return "NESTLOOP";
- case T_MergeJoin:
- return "MERGEJOIN";
- case T_HashJoin:
- return "HASHJOIN";
- case T_Material:
- return "MATERIAL";
- case T_Sort:
- return "SORT";
- case T_Agg:
- return "AGG";
- case T_Unique:
- return "UNIQUE";
- case T_SetOp:
- return "SETOP";
- case T_Limit:
- return "LIMIT";
- case T_Hash:
- return "HASH";
- case T_Group:
- return "GROUP";
- default:
- return "UNKNOWN";
- }
-}
-
-/*
- * Recursively prints a simple text description of the plan tree
- */
-void
-print_plan_recursive(Plan *p, Query *parsetree, int indentLevel, char *label)
-{
- int i;
- char extraInfo[NAMEDATALEN + 100];
-
- if (!p)
- return;
- for (i = 0; i < indentLevel; i++)
- printf(" ");
- printf("%s%s :c=%.2f..%.2f :r=%.0f :w=%d ", label, plannode_type(p),
- p->startup_cost, p->total_cost,
- p->plan_rows, p->plan_width);
- if (IsA(p, Scan) ||
- IsA(p, SeqScan) ||
- IsA(p, BitmapHeapScan))
- {
- RangeTblEntry *rte;
-
- rte = rt_fetch(((Scan *) p)->scanrelid, parsetree->rtable);
- strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
- }
- else if (IsA(p, IndexScan))
- {
- RangeTblEntry *rte;
-
- rte = rt_fetch(((IndexScan *) p)->scan.scanrelid, parsetree->rtable);
- strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
- }
- else if (IsA(p, FunctionScan))
- {
- RangeTblEntry *rte;
-
- rte = rt_fetch(((FunctionScan *) p)->scan.scanrelid, parsetree->rtable);
- strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
- }
- else if (IsA(p, ValuesScan))
- {
- RangeTblEntry *rte;
-
- rte = rt_fetch(((ValuesScan *) p)->scan.scanrelid, parsetree->rtable);
- strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
- }
- else
- extraInfo[0] = '\0';
- if (extraInfo[0] != '\0')
- printf(" ( %s )\n", extraInfo);
- else
- printf("\n");
- print_plan_recursive(p->lefttree, parsetree, indentLevel + 3, "l: ");
- print_plan_recursive(p->righttree, parsetree, indentLevel + 3, "r: ");
-
- if (IsA(p, Append))
- {
- ListCell *l;
- Append *appendplan = (Append *) p;
-
- foreach(l, appendplan->appendplans)
- {
- Plan *subnode = (Plan *) lfirst(l);
-
- print_plan_recursive(subnode, parsetree, indentLevel + 3, "a: ");
- }
- }
-
- if (IsA(p, BitmapAnd))
- {
- ListCell *l;
- BitmapAnd *bitmapandplan = (BitmapAnd *) p;
-
- foreach(l, bitmapandplan->bitmapplans)
- {
- Plan *subnode = (Plan *) lfirst(l);
-
- print_plan_recursive(subnode, parsetree, indentLevel + 3, "a: ");
- }
- }
-
- if (IsA(p, BitmapOr))
- {
- ListCell *l;
- BitmapOr *bitmaporplan = (BitmapOr *) p;
-
- foreach(l, bitmaporplan->bitmapplans)
- {
- Plan *subnode = (Plan *) lfirst(l);
-
- print_plan_recursive(subnode, parsetree, indentLevel + 3, "a: ");
- }
- }
-}
-
-/*
- * print_plan
- *
- * prints just the plan node types
- */
-void
-print_plan(Plan *p, Query *parsetree)
-{
- print_plan_recursive(p, parsetree, 0, "");
-}