head	1.20;
access;
symbols
	Version_2_1:1.11
	C_Demo_1:1.6;
locks; strict;
comment	@ * @;


1.20
date	92.07.04.04.03.48;	author mao;	state Exp;
branches;
next	1.19;

1.19
date	92.03.31.23.14.25;	author mer;	state Exp;
branches;
next	1.18;

1.18
date	91.11.18.17.29.14;	author mer;	state Exp;
branches;
next	1.17;

1.17
date	91.08.08.15.35.55;	author hong;	state Exp;
branches;
next	1.16;

1.16
date	91.07.17.23.47.28;	author hong;	state Exp;
branches;
next	1.15;

1.15
date	91.05.08.15.11.58;	author hong;	state Exp;
branches;
next	1.14;

1.14
date	91.04.24.12.15.15;	author hong;	state Exp;
branches;
next	1.13;

1.13
date	91.03.27.15.54.18;	author choi;	state Exp;
branches;
next	1.12;

1.12
date	91.03.27.14.44.55;	author choi;	state Exp;
branches;
next	1.11;

1.11
date	90.09.25.16.37.53;	author kemnitz;	state Exp;
branches;
next	1.10;

1.10
date	90.06.13.01.57.58;	author hong;	state Exp;
branches;
next	1.9;

1.9
date	90.01.24.15.50.26;	author hong;	state Exp;
branches;
next	1.8;

1.8
date	90.01.24.12.54.11;	author hong;	state Exp;
branches;
next	1.7;

1.7
date	89.10.17.13.45.32;	author cimarron;	state Exp;
branches;
next	1.6;

1.6
date	89.09.05.17.18.47;	author mao;	state C_Demo_1;
branches;
next	1.5;

1.5
date	89.08.24.19.11.19;	author mao;	state Exp;
branches;
next	1.4;

1.4
date	89.08.16.21.54.15;	author mao;	state Exp;
branches;
next	1.3;

1.3
date	89.07.28.12.09.40;	author goh;	state Exp;
branches;
next	1.2;

1.2
date	89.07.18.00.21.07;	author yatabe;	state Exp;
branches;
next	1.1;

1.1
date	89.07.11.03.15.11;	author yatabe;	state Exp;
branches;
next	;


desc
@C version postgres plan pretty printer.
@


1.20
log
@fixes for arrays, array refs, and nested dots
@
text
@/*
 *      FILE
 *     	pppp
 *
 *      DESCRIPTION
 *     	POSTGRES plan pretty printer
 *
 */

#include "tmp/postgres.h"

RcsId("$Header: /private/mao/postgres/src/planner/sys/RCS/pppp.c,v 1.19 1992/03/31 23:14:25 mer Exp mao $");

#define	INDENT(c)	printf("%*s", (2 * (c)), "")

/*     
 *      EXPORTS
 *     		print_parse
 *     		print_plan
 *
 *  provide ("pppp");
 */

#include "nodes/nodes.h"
#include "nodes/pg_lisp.h"
#include "nodes/plannodes.h"
#include "nodes/plannodes.a.h"
#include "nodes/primnodes.h"
#include "nodes/primnodes.a.h"
#include "nodes/execnodes.h"
#include "nodes/relation.h"
#include "nodes/relation.a.h"
#include "tags.h"

#include "planner/internal.h"
#include "planner/clauses.h"
#include "planner/keys.h"
#include "planner/prepqual.h"

void print_parse ARGS((LispValue parse ));
void print_root ARGS((LispValue root ));
void print_plan ARGS((Plan plan , int levelnum ));
char *subplan_type ARGS((int type ));
void print_subplan ARGS((LispValue subplan , int levels ));
void print_rtentries ARGS((LispValue rt , int levels ));
void print_tlist ARGS((LispValue tlist , int levels ));
void print_tlistentry ARGS((LispValue tlistentry , int level ));
void print_allqual ARGS((LispValue quals , int levels ));
void print_qual ARGS((LispValue qual , int levels ));
void print_var ARGS((LispValue var ));
void print_clause ARGS((LispValue clause , int levels ));
void print_const ARGS((LispValue node ));
void print_param ARGS((LispValue param ));
void pplan ARGS((Plan plan ));
void set_query_range_table ARGS((List parsetree ));
void p_plan ARGS((Plan plan ));
void p_plans ARGS((List plans ));
char *path_type ARGS((Path path ));
void ppath ARGS((Path path ));
void p_path ARGS((Path path ));
void p_paths ARGS((List paths ));
void p_rel ARGS((Rel rel ));
void p_rels ARGS((List rels ));

/*  #ifdef opus43
 *  declare (special (_newline_))
 *  #endif
 */

/* #ifdef (opus43 && pg_production)
 * declare (localf (print_root, print_subplan, print_rtentries,
 *		 print_tlist, print_tlistentry, print_allqual,
 *		 print_qual, print_var, print_clause, print_clauses,
 *		 print_const, print_param,indent)
 *      )
 * #endif
 */
void
print_parse (parse)
	LispValue parse;
{
	_query_range_table_ = root_rangetable (parse_root (parse));
	print_root (parse_root (parse));
	printf ("TargetList:\n");
	print_tlist (parse_targetlist (parse),0);
	printf ("Qualification:\n");
	print_qual (cnfify (parse_qualification (parse), false),0);
}

/*  .. print_parse
 */
void
print_root (root)
	LispValue root;
{
	printf ("NumLevels: %d\nCommandType: %d\nResultRelation: ",
		root_numlevels(root), root_command_type(root));
	lispDisplay(root_result_relation (root));
	printf("\nRangetable:\n");
	print_rtentries (root_rangetable (root), 0);
	printf ("Priority: %d\nRuleInfo: ", CInteger(root_priority(root)));
	lispDisplay(root_ruleinfo(root));
	printf("\n");
}

/*  .. print_plan, print_subplan
 */
void
print_plan(plan, levelnum)
	Plan plan;
	int levelnum;
{
	int i;
	LispValue saved_rt;
	extern LispValue copy_seq_tree();
	extern LispValue fix_rangetable();

	if (IsA(plan,Append)) {
		INDENT(levelnum);
		printf("Append %d\n\nInheritance Relid : %ld\n", levelnum,
			get_unionrelid((Append)plan));

		saved_rt = copy_seq_tree (_query_range_table_);

		for (i = 0; i < (length(get_unionplans((Append)plan))); i++){
			INDENT(levelnum);
			printf("Appended Plan %d\n", i);
			_query_range_table_ =
			    fix_rangetable(_query_range_table_,
				    get_unionrelid ((Append)plan),
				    nth(i, get_unionrtentries((Append)plan)));
			print_plan((Plan)nth(i, get_unionplans((Append)plan)),
				   levelnum + 1);
		};

		/* XXX need to free the munged tree */
		_query_range_table_ = saved_rt;

		INDENT(levelnum);
		printf("Inheritance Range Table :\n");
		print_rtentries ((LispValue)get_unionrtentries((Append)plan), levelnum);

	} else if (IsA(plan,Existential)) {
		INDENT(levelnum);
		printf("Existential %d\n", levelnum);

		if (get_lefttree((Plan)plan)) {
			INDENT(levelnum);
			printf("\nExistential Plan %d\n", levelnum);
			print_plan ((Plan)get_lefttree (plan), 
				    levelnum + 1);
		};

		if (get_righttree((Plan)plan)) {
			INDENT(levelnum);
			printf("\nQuery Plan %d\n", levelnum);
			print_plan ((Plan)get_righttree (plan),
				    levelnum + 1);
		};

	} else if (IsA(plan,Existential)) {
		INDENT(levelnum);
		printf("Result %d\n\n", levelnum);

		INDENT(levelnum);
		printf("TargetList :\n");
		print_tlist(get_qptargetlist((Plan)plan), levelnum + 1);

		INDENT(levelnum);
		printf("RelLevelQual :\n");
		print_qual(get_resrellevelqual((Result)plan), levelnum+1);

		INDENT(levelnum);
		printf("ConstantQual :\n");
		print_qual(get_resconstantqual((Result)plan), levelnum+1);

		if (get_lefttree(plan)) {
			INDENT(levelnum);
			printf("\nSubplan %d\n\n", levelnum);
			print_subplan((LispValue)get_lefttree(plan),
				      levelnum + 1);
		};

		if (get_righttree(plan)) {
			print_plan((Plan)get_righttree(plan), (levelnum + 1));
		};
	} else {

		/*
		 *  Better hope we get this right.
		 */

		printf("Subplan %d\n\n", levelnum);
		print_subplan((LispValue)plan, levelnum + 1);
	}
}

char*
subplan_type(type)
int type;
{
	switch (type) {
	case T_NestLoop:  return("NestLoop");
	case T_MergeJoin: return("MergeJoin");
	case T_HashJoin:  return("HashJoin");
	case T_SeqScan:	return("SeqScan");
	case T_IndexScan:	return("IndexScan");
	case T_Sort:	return("Sort");
	case T_Hash:	return("Hash");
	case T_Material:return("Material");
	case T_Temp:	return("Temp");
	case T_Append:	return("Append");
	case T_Result:	return("Result");
	case T_Existential: return("Existential");
	case T_ScanTemps: return("ScanTemps");
	default: return("???");
	}
}

/*  .. print_plan, print_subplan
 */
void
print_subplan (subplan, levels)
	LispValue subplan;
	int levels;
{
	INDENT(levels);
	printf("Type : %s\n", subplan_type(((Node)subplan)->type));
	INDENT (levels);
	printf("Cost : %f\n", get_cost((Plan)subplan));
	INDENT (levels);
	printf("Size : %d\n", get_plan_size((Plan)subplan));
	INDENT (levels);
	printf("Width : %d\n", get_plan_width((Plan)subplan));
	if (IsA(subplan,Scan)) {
		INDENT (levels);
		printf("Relid: ");

		/* XXX help, jeff, what's integerp become? */
		/*
		 * if (integerp (get_scanrelid (subplan)) &&
		 *     (_TEMP_RELATION_ID_ != get_scanrelid (subplan)))
		 */
		if (_TEMP_RELATION_ID_ != get_scanrelid((Scan)subplan)) {
			printf( "%s",
				CString(getrelname(get_scanrelid((Scan)subplan),
						   _query_range_table_)));
		} else {
			printf("%ld", get_scanrelid ((Scan)subplan));
		};
		printf("\n");
	};
	if (IsA(subplan,Temp)) {
		INDENT (levels);
		printf("TempID: %d\n", get_tempid((Temp)subplan));
		INDENT (levels);
		printf("KeyCount: %d\n", get_keycount((Temp)subplan));
		INDENT (levels);
		printf ("TempList:\n");
		print_tlist(get_qptargetlist((Plan)subplan), (levels + 1)); 

	} else if (IsA(subplan,Hash)) {
		INDENT(levels);
		printf("HashKey: ");
		print_var((LispValue)get_hashkey((Hash)subplan));
	} else  {
		INDENT(levels);
		printf("TargetList :\n");
		print_tlist((LispValue)get_qptargetlist((Plan)subplan), (levels + 1));

		INDENT (levels);
		printf("Qual:\n");
		print_qual((LispValue)get_qpqual((Plan)subplan), (levels + 1));
	}

	if (IsA(subplan,MergeJoin)) {
		INDENT (levels);
		printf("MergeSortOp:%ld\n",get_mergesortop((MergeJoin)subplan));

		INDENT (levels);
		printf("MergeClauses :\n");
		print_qual(get_mergeclauses((MergeJoin)subplan), (levels + 1));
	}
	if (IsA(subplan,HashJoin)) {
		INDENT (levels);
		printf("hashClauses :\n");
		print_qual(get_hashclauses((HashJoin)subplan), (levels + 1));
	}
	if (IsA(subplan,IndexScan)) {
		/*
		 *  XXX need to add a function to print list at
		 *  the current nesting level.  until then...
		 *
		 * INDENT(levels);
		 * printf("IndexID: XXX", get_indxid (subplan), "\n");
		 */

		INDENT(levels);
		printf("IndexQual:\n");
		print_allqual(get_indxqual ((IndexScan)subplan), (levels + 1));

		printf ("\n");
	};
	if (IsA(subplan,Join)) {
		printf("\n");
		INDENT(levels);
		printf("Outer Path:\n");
		print_subplan((LispValue)get_lefttree((Plan)subplan),
			      (levels + 1));
		printf("\n");
		INDENT(levels);
		printf("Inner Path:\n");
		print_subplan((LispValue)get_righttree((Plan)subplan), (levels + 1));

	} else if (get_lefttree((Plan)subplan)) {
		printf ("\n");
		if (IsA(get_lefttree((Plan)subplan),Result)) {
			print_plan((Plan)get_lefttree((Plan)subplan), levels + 1);
		} else {
			print_subplan((LispValue)get_lefttree((Plan)subplan), levels + 1);
		}
	}
}

/*  .. print_plan, print_root
 */
void
print_rtentries (rt, levels)
	LispValue rt;
	int levels;
{
	LispValue i;
	LispValue rtentry;

	/* XXX how do we re-write foreach loops? */
	foreach (i, rt) {
		rtentry = CAR(i);

		INDENT (levels + 1);
		lispDisplay(rtentry);

#ifdef NOTYET
		/* XXX integerp becomes what? */
		if (integerp (rt_rulelocks (rtentry))) {
			printf ("\n");
			INDENT (levels + 1);
			print_rule_lock_intermediate(rt_rulelocks(rtentry));
		} else {
			/*
			 *  XXX what the hell does this do???
			 *
			 *  printf (rt_rulelocks (rtentry));
			 */
		}
#endif /* NOTYET */
		printf ("\n");
	}
}

/*  .. print_parse, print_plan, print_subplan */
void
print_tlist (tlist, levels)
     LispValue tlist;
     int levels;
{
	LispValue entry;
	LispValue i;

	foreach (i, tlist) {
		entry = CAR(i);
		print_tlistentry(entry, (levels + 1));
	}
}

/*  .. print_tlist 
*/
void
print_tlistentry(tlistentry, level)
	LispValue tlistentry;
	int level;
{
	LispValue resdom;
	LispValue expr;

	resdom = (LispValue) tl_resdom(tlistentry);
	expr = (LispValue) get_expr(tlistentry);

	INDENT(level);
	printf ("(%d ", get_resno((Resdom)resdom));

	if (get_reskey((Resdom)resdom) != 0) {
		/*
		 *  XXX should print the tuple form, but we just print the
		 *  address for now.
		 */
		printf("(%d 0x%lx)",
		    get_reskey((Resdom)resdom),get_reskeyop((Resdom)resdom));
	};
	/*
	 * if (get_resname(resdom) != (char *) NULL) {
	 * 	printf ("%s", get_resname(resdom));
	 * };
	 */
	print_clause (expr, level);
	printf (")\n");
}

/*  .. print_subplan 
*/

void
print_allqual(quals, levels)
	LispValue quals;
	int levels;
{
	LispValue qual;
	LispValue i;

	/* XXX how do we do foreach() loops?  */
	foreach (i, quals) {
		qual = CAR(i);
		print_qual(qual,levels + 1);
		printf ("\n");
	};
}

/*  .. print_allqual, print_parse, print_plan, print_subplan
 */

void
print_qual(qual, levels)
	LispValue qual;
	int levels;
{
	LispValue clause;
	LispValue i;

	INDENT (levels);
	foreach (i, qual) {
		clause = CAR(i);
		print_clause(clause, levels);
		printf ("\n");
	};
}

/*  .. print_clause
 */
void
print_var(var)
	LispValue var;
{
	Index varno;
	AttributeNumber attnum;
	printf ("(");
	if(_query_range_table_ && (_TEMP_RELATION_ID_ != get_varno((Var)var)))
	{
		varno = get_varno((Var)var);
		attnum = get_varattno ((Var)var);
		if (varno == INNER || varno == OUTER) {
		   List varid = get_varid((Var)var);
		   varno = CInteger(CAR(varid));
		   attnum = CInteger(CADR(varid));
		  }
		printf("%s %s",
			CString(getrelname(varno, _query_range_table_)),
		        get_attname(CInteger(getrelid(varno,
				 _query_range_table_)), attnum));

	} else {
		printf ("%d %d", get_varno((Var)var), get_varattno((Var)var));
	}
	printf (")");
}

/*  .. print_clause, print_clauses, print_qual, print_tlistentry
 */
void
print_clause(clause, levels)
	LispValue clause;
	int levels;
{
	if (clause) {
		INDENT (levels);
		if (IsA(clause,Var)) {
			print_var (clause);

		} else if (IsA(clause,Const)) {
			print_const (clause);

		} else if (IsA(clause,Param)) {
			print_param (clause);

		/*
		 * XXX don't know about these node types.
		 *
		 * } else if (or_clause (clause)) {
		 * 	printf ("(OR ");
		 * 	print_clauses (get_orclauseargs (clause));
		 * 	printf (") ");
		 *
		 * } else if (not_clause (clause)) {
		 * 	printf ("(NOT ");
		 * 	print_clause (get_notclausearg (clause), 0);
		 * 	printf (") ");
		 *
		 * } else if (is_funcclause (clause)) {
		 * 	printf ("(", get_funcid (get_function (clause)), " ");
		 * 	print_clauses (get_funcargs (clause));
		 * 	printf (") ");
		 */

		 } else {
		 	printf("(%d ", get_opno((Oper)get_op(clause)));
		 	print_clause((LispValue)get_leftop(clause), levels);
		 	printf(" ");
			print_clause((LispValue)get_rightop(clause), levels);
			printf(") ");
		}
	}
}

/*  .. print_clause
 */
/*
 *  XXX this routine no longer needed.
 *
 *
 * LispValue
 * print_clauses (clauses)
 *      LispValue clauses ;
 * {
 *    foreach (clause, clauses) {
 *       print_clause (clause, 0);
 *       
 *    };
 * }
 */

/*  .. print_clause
 */
void
print_const(node)
	LispValue node;
{
	if (get_constisnull((Const)node)) {
		printf("*NULL*");
	/*
	 * } else if (stringp (get_constvalue (node))) {
	 * 	printf("%s",get_constvalue (node));
	 * } else {
	 * 	printf("%s", lisp_print (get_constvalue(node)));
	 * }
	 */

	} else {
		/*
		 *  XXX -- neet to figure out what type of constant this
		 *  is, and print it for real.
		 */
		printf("%ld", DatumGetUInt32(((Const)node)->constvalue));
	}
}

/*  .. print_clause
 */
void
print_param (param)
	LispValue param;
{

	printf (" $%ld", get_paramid((Param)param));

	/*
	 * if (stringp (get_paramid (param))) {
	 * 	printf(".");
	 * } else {
	 * 	printf("");
	 * }
	 */

	 if (get_paramname((Param)param) != (Name) NULL)
		printf("(\"%s\")", get_paramname((Param)param));
}

void
pplan(plan)
Plan plan;
{
    if (plan == NULL) return;
    fprintf(stderr, "(%s ", subplan_type(plan->type));
    switch (NodeType(plan)) {
    case classTag(SeqScan):
    case classTag(IndexScan):
	if (_TEMP_RELATION_ID_ != get_scanrelid((Scan)plan)) {
	    fprintf(stderr,  "%s", CString(getrelname(get_scanrelid((Scan)plan),
				  _query_range_table_)));
	  }
	else {
	    pplan((Plan)get_lefttree(plan));
	  }
	break;
    case classTag(ScanTemps):
	{   LispValue x;
	    Relation tmpreldesc;
	    foreach (x, get_temprelDescs((ScanTemps)plan)) {
		tmpreldesc = (Relation)CAR(x);
		fprintf(stderr, " %s", &(tmpreldesc->rd_rel->relname));
	      }
	}
    case classTag(MergeJoin):
    case classTag(HashJoin):
    case classTag(NestLoop):
	pplan((Plan)get_lefttree(plan));
	fprintf(stderr, " ");
	pplan((Plan)get_righttree(plan));
	break;
    case classTag(Hash):
    case classTag(Sort):
    case classTag(Material):
    case classTag(Result):
	pplan((Plan)get_lefttree(plan));
	break;
    case classTag(Existential):
	pplan((Plan)get_lefttree(plan));
	fprintf(stderr, " ");
	pplan((Plan)get_righttree(plan));
	break;
    case classTag(Append):
	{  LispValue saved_rt;
	   extern LispValue copy_seq_tree();
	   extern LispValue fix_rangetable();
	   int i;

	   saved_rt = copy_seq_tree(_query_range_table_);
	   for (i=0; i<(length(get_unionplans((Append)plan))); i++) {
	       _query_range_table_ = 
		    fix_rangetable(_query_range_table_,
				   get_unionrelid((Append)plan),
				   nth(i,get_unionrtentries((Append)plan)));
	       pplan((Plan)nth(i, get_unionplans((Append)plan)));
	     }
	    _query_range_table_ = saved_rt;
	    break;
	 }
     default:
	 fprintf(stderr, "unknown plan type.\n");
	 break;
      }
     fprintf(stderr, ")");
     return;
}

void
set_query_range_table(parsetree)
List parsetree;
{
    _query_range_table_ = root_rangetable(parse_root(parsetree));
}

void
p_plan(plan)
Plan plan;
{
    fprintf(stderr, "\n");
    pplan(plan);
    fprintf(stderr, "\n");
}

void
p_plans(plans)
List plans;
{
    LispValue x;

    foreach (x, plans) {
	p_plan((Plan)CAR(x));
      }
}

char *
path_type(path)
Path path;
{
	switch (NodeType(path)) {
	case classTag(HashPath): return "HashJoin";
	case classTag(MergePath): return "MergeJoin";
	case classTag(JoinPath): return "NestLoop";
	case classTag(IndexPath): return "IndexScan";
	case classTag(Path): return "SeqScan";
	default: return "???";
	}
}

void
ppath(path)
Path path;
{
    if (path == NULL) return;
    fprintf(stderr, "(%s ", path_type(path));
    switch (NodeType(path)) {
    case classTag(HashPath):
	ppath((Path)get_outerjoinpath((JoinPath)path));
	fprintf(stderr, " (Hash ");
	ppath((Path)get_innerjoinpath((JoinPath)path));
	fprintf(stderr, ")");
	break;
    case classTag(MergePath):
	if (get_outersortkeys((MergePath)path)) {
	    fprintf(stderr, "(SeqScan (Sort ");
	    ppath((Path)get_outerjoinpath((JoinPath)path));
	    fprintf(stderr, "))");
	  }
	else
	    ppath((Path)get_outerjoinpath((JoinPath)path));
	fprintf(stderr, " ");
	if (get_innersortkeys((MergePath)path)) {
	    fprintf(stderr, "(SeqScan (Sort ");
	    ppath((Path)get_innerjoinpath((JoinPath)path));
	    fprintf(stderr, "))");
	  }
	else
	    ppath((Path)get_innerjoinpath((JoinPath)path));
	break;
    case classTag(JoinPath):
	ppath((Path)get_outerjoinpath((JoinPath)path));
	fprintf(stderr, " ");
	ppath((Path)get_innerjoinpath((JoinPath)path));
	break;
    case classTag(IndexPath):
    case classTag(Path):
	fprintf(stderr, "%s", 
	  CString(getrelname(CInteger(CAR(get_relids(get_parent(path)))),
			     _query_range_table_)));
	break;
    default:
	fprintf(stderr, "unknown plan type.\n");
	break;
      }
    fprintf(stderr, ")");
    return;
}

void
p_path(path)
Path path;
{
    ppath(path);
    fprintf(stderr, "\n");
}

void
p_paths(paths)
List paths;
{
    LispValue x;

    foreach (x, paths) {
	p_path((Path)CAR(x));
      }
}

void
p_rel(rel)
Rel rel;
{
    fprintf(stderr, "relids: ");
    lispDisplay(get_relids(rel));
    fprintf(stderr, "\npathlist:\n");
    p_paths(get_pathlist(rel));
    fprintf(stderr, "unorderedpath:\n");
    p_path((Path)get_unorderedpath(rel));
    fprintf(stderr, "cheapestpath:\n");
    p_path((Path)get_cheapestpath(rel));
}

void
p_rels(rels)
List rels;
{
    LispValue x;

    foreach (x, rels) {
	p_rel((Rel)CAR(x));
      }
}
@


1.19
log
@change accessor functions into macros
@
text
@d12 1
a12 1
RcsId("$Header: /users/mer/pg/src/planner/sys/RCS/pppp.c,v 1.18 1991/11/18 17:29:14 mer Exp mer $");
a471 16

	/* XXX foreach */
	/*
	 *  foreach (dot, get_vardotfields (var)) {
	 * 	printf (" ", dot);
	 * };
	 */

	/* XXX - is this what we want? */
/* 	if (get_vararraylist(var) != NULL) {
		List elem;
	 	foreach (elem, get_vararraylist (var)) { 
	 		printf ("(%d)", elem->arraylow); 
	 	};
	};
*/
@


1.18
log
@prototype changes (the last?)
@
text
@d12 1
a12 1
RcsId("$Header: /users/mer/postgres/src/planner/sys/RCS/pppp.c,v 1.17 1991/08/08 15:35:55 hong Exp mer $");
d150 1
a150 1
			print_plan (get_lefttree (plan), 
d157 1
a157 1
			print_plan (get_righttree (plan),
d185 1
a185 1
			print_plan(get_righttree(plan), (levelnum + 1));
d615 1
a615 1
	    pplan(get_lefttree(plan));
d629 1
a629 1
	pplan(get_lefttree(plan));
d631 1
a631 1
	pplan(get_righttree(plan));
d637 1
a637 1
	pplan(get_lefttree(plan));
d640 1
a640 1
	pplan(get_lefttree(plan));
d642 1
a642 1
	pplan(get_righttree(plan));
d720 1
a720 1
	ppath(get_innerjoinpath((JoinPath)path));
d726 1
a726 1
	    ppath(get_outerjoinpath((JoinPath)path));
d730 1
a730 1
	    ppath(get_outerjoinpath((JoinPath)path));
d734 1
a734 1
	    ppath(get_innerjoinpath((JoinPath)path));
d738 1
a738 1
	    ppath(get_innerjoinpath((JoinPath)path));
d741 1
a741 1
	ppath(get_outerjoinpath((JoinPath)path));
d743 1
a743 1
	ppath(get_innerjoinpath((JoinPath)path));
d787 1
a787 1
    p_path(get_unorderedpath(rel));
d789 1
a789 1
    p_path(get_cheapestpath(rel));
@


1.17
log
@added a function to switch range tables
@
text
@d12 1
a12 1
RcsId("$Header: RCS/pppp.c,v 1.16 91/07/17 23:47:28 hong Exp Locker: hong $");
d38 1
d40 24
a63 11
extern	void	print_root();
extern	void	print_clauses();
extern	void	print_const();
extern	void	print_subplan();
extern	void	print_rtentries();
extern	void	print_tlist();
extern	void	print_tlistentry();
extern	void	print_allqual();
extern	void	print_qual();
extern	void	print_clause();
extern	void	print_param();
d87 1
a87 1
	print_qual (cnfify (parse_qualification (parse)),0);
d98 1
a98 1
	lispDisplay(root_result_relation (root), 0);
d102 1
a102 1
	lispDisplay(root_ruleinfo(root), 0);
d121 1
a121 1
			get_unionrelid(plan));
d125 1
a125 1
		for (i = 0; i < (length(get_unionplans(plan))); i++){
d129 5
a133 4
				fix_rangetable(_query_range_table_,
						get_unionrelid (plan),
						nth(i, get_unionrtentries(plan)));
			print_plan(nth (i, get_unionplans(plan)), levelnum + 1);
d141 1
a141 1
		print_rtentries (get_unionrtentries (plan), levelnum);
d147 1
a147 1
		if (get_lefttree(plan)) {
d150 2
a151 1
			print_plan (get_lefttree (plan), levelnum + 1);
d154 1
a154 1
		if (get_righttree(plan)) {
d157 2
a158 1
			print_plan (get_righttree (plan), levelnum + 1);
d167 1
a167 1
		print_tlist(get_qptargetlist(plan), levelnum + 1);
d171 1
a171 1
		print_qual(get_resrellevelqual(plan), levelnum + 1);
d175 1
a175 1
		print_qual(get_resconstantqual(plan), levelnum + 1);
d180 2
a181 1
			print_subplan(get_lefttree(plan), levelnum + 1);
d194 1
a194 1
		print_subplan(plan, levelnum + 1);
a226 2
	void print_var();

d230 1
a230 1
	printf("Cost : %f\n", get_cost(subplan));
d232 1
a232 1
	printf("Size : %d\n", get_plan_size(subplan));
d234 1
a234 1
	printf("Width : %d\n", get_plan_width(subplan));
d244 4
a247 3
		if (_TEMP_RELATION_ID_ != get_scanrelid(subplan)) {
			printf( "%s", CString(getrelname(get_scanrelid(subplan),
						 _query_range_table_)));
d249 1
a249 1
			printf("%ld", get_scanrelid (subplan));
d255 1
a255 1
		printf("TempID: %d\n", get_tempid(subplan));
d257 1
a257 1
		printf("KeyCount: %d\n", get_keycount(subplan));
d260 1
a260 1
		print_tlist(get_qptargetlist(subplan), (levels + 1)); 
d265 1
a265 1
		print_var(get_hashkey(subplan));
d269 1
a269 1
		print_tlist(get_qptargetlist(subplan), (levels + 1));
d273 1
a273 1
		print_qual(get_qpqual(subplan), (levels + 1));
d278 1
a278 1
		printf("MergeSortOp: %ld\n", get_mergesortop(subplan));
d282 1
a282 1
		print_qual(get_mergeclauses(subplan), (levels + 1));
d287 1
a287 1
		print_qual(get_hashclauses(subplan), (levels + 1));
d300 1
a300 1
		print_allqual(get_indxqual (subplan), (levels + 1));
d308 2
a309 1
		print_subplan(get_lefttree(subplan), (levels + 1));
d313 1
a313 1
		print_subplan(get_righttree(subplan), (levels + 1));
d315 1
a315 1
	} else if (get_lefttree(subplan)) {
d317 2
a318 2
		if (IsA(get_lefttree(subplan),Result)) {
			print_plan(get_lefttree(subplan), levels + 1);
d320 1
a320 1
			print_subplan(get_lefttree(subplan), levels + 1);
d340 1
a340 1
		lispDisplay(rtentry,0);
d389 1
a389 1
	printf ("(%d ", get_resno(resdom));
d391 1
a391 1
	if (get_reskey(resdom) != 0) {
d396 2
a397 2
		printf ("(%d 0x%lx)",
			get_reskey(resdom), get_reskeyop(resdom));
d455 1
a455 1
	if(_query_range_table_ && (_TEMP_RELATION_ID_ != get_varno(var)))
d457 2
a458 2
		varno = get_varno(var);
		attnum = get_varattno (var);
d460 1
a460 1
		   List varid = get_varid(var);
d470 1
a470 1
		printf ("%d %d", get_varno(var), get_varattno(var));
d529 2
a530 2
		 	printf("(%d ", get_opno(get_op(clause)));
		 	print_clause(get_leftop(clause), levels);
d532 1
a532 1
			print_clause(get_rightop(clause), levels);
d561 1
a561 1
	if (get_constisnull(node)) {
d587 1
a587 1
	printf (" $%ld", get_paramid(param));
d597 2
a598 2
	 if (get_paramname(param) != (Name) NULL)
		printf("(\"%s\")", get_paramname(param));
d610 2
a611 2
	if (_TEMP_RELATION_ID_ != get_scanrelid(plan)) {
	    fprintf(stderr,  "%s", CString(getrelname(get_scanrelid(plan),
d621 1
a621 1
	    foreach (x, get_temprelDescs(plan)) {
d651 6
a656 5
	   for (i=0; i<(length(get_unionplans(plan))); i++) {
	       _query_range_table_ = fix_rangetable(_query_range_table_,
					 get_unionrelid(plan),
					 nth(i,get_unionrtentries(plan)));
	       pplan(nth(i, get_unionplans(plan)));
d692 1
a692 1
	p_plan(CAR(x));
d718 1
a718 1
	ppath(get_outerjoinpath(path));
d720 1
a720 1
	ppath(get_innerjoinpath(path));
d724 1
a724 1
	if (get_outersortkeys(path)) {
d726 1
a726 1
	    ppath(get_outerjoinpath(path));
d730 1
a730 1
	    ppath(get_outerjoinpath(path));
d732 1
a732 1
	if (get_innersortkeys(path)) {
d734 1
a734 1
	    ppath(get_innerjoinpath(path));
d738 1
a738 1
	    ppath(get_innerjoinpath(path));
d741 1
a741 1
	ppath(get_outerjoinpath(path));
d743 1
a743 1
	ppath(get_innerjoinpath(path));
d774 1
a774 1
	p_path(CAR(x));
d799 1
a799 1
	p_rel(CAR(x));
@


1.16
log
@have p_plan() print ScanTemps nodes properly
@
text
@d12 1
a12 1
RcsId("$Header: RCS/pppp.c,v 1.15 91/05/08 15:11:58 hong Exp $");
d96 1
a96 1
	LispValue plan;
d648 7
@


1.15
log
@added more pretty printing functions
@
text
@d12 1
a12 1
RcsId("$Header: RCS/pppp.c,v 1.14 91/04/24 12:15:15 hong Exp Locker: hong $");
d197 1
d600 8
@


1.14
log
@added a new plan pretty print function, print the show forms of plans
@
text
@d12 1
a12 1
RcsId("$Header: RCS/pppp.c,v 1.13 91/03/27 15:54:18 choi Exp Locker: hong $");
d31 2
d648 118
@


1.13
log
@turned off print vararraylist for now so it would compile
@
text
@d12 1
a12 1
RcsId("$Header: RCS/pppp.c,v 1.12 91/03/27 14:44:55 choi Exp Locker: choi $");
d190 1
d580 67
@


1.12
log
@set,get_vararrayindex --> set,get_vararraylist
@
text
@d12 1
a12 1
RcsId("$Header: RCS/pppp.c,v 1.11 90/09/25 16:37:53 kemnitz Exp Locker: choi $");
d458 3
a460 2
	if (get_vararraylist(var) != NULL) {
	/* 	printf ("(%d)", get_vararraylist(var)); */
d462 1
a462 2
			/* XXX - is this what we want? */
	 		printf ("(%d)", elem->low); 
d465 1
a465 1

@


1.11
log
@Updating from revision 1.10 to revision 1.11
@
text
@d12 1
a12 1
RcsId("$Header: RCS/pppp.c,v 1.11 90/08/14 12:13:54 cimarron Exp $");
d458 6
a463 2
	if (get_vararrayindex(var) != 0) {
		printf ("(%d)", get_vararrayindex(var));
@


1.10
log
@some changes for hashjoin
@
text
@d10 1
d12 1
a12 2
#include "c.h"
#include "postgres.h"
a13 2
RcsId("$Header: RCS/pppp.c,v 1.9 90/01/24 15:50:26 hong Exp $");

d24 9
a32 6
#include "nodes.h"
#include "plannodes.h"
#include "plannodes.a.h"
#include "primnodes.h"
#include "primnodes.a.h"
#include "execnodes.h"
a35 2
#include "pg_lisp.h"
#include "tags.h"
@


1.9
log
@some minor format changes.
@
text
@d14 1
a14 1
RcsId("$Header: RCS/pppp.c,v 1.8 90/01/24 12:54:11 hong Exp $");
d206 2
d212 4
d242 1
a242 1
	} else {
d244 4
d263 6
a268 1
	};
@


1.8
log
@the fixed pretty printer
@
text
@d14 1
a14 1
RcsId("$Header: RCS/pppp.c,v 1.7 89/10/17 13:45:32 cimarron Exp Locker: hong $");
d270 1
@


1.7
log
@changes to support MergeJoins in the executor.
@
text
@a9 1
#ifdef NOT_FOR_DEMO
d14 1
a14 1
RcsId("$Header: RCS/pppp.c,v 1.6 89/09/05 17:18:47 mao C_Demo_1 $");
d28 1
d30 1
d32 3
a34 1
#include "planner/internal.h";
d36 1
d81 4
a84 4
	printf ("NumLevels: %s\nCommandType: %s\nResultRelation: %s\n Rangetable:\n",
		root_numlevels(root), root_command_type(root),
		root_result_relation (root),
	      "RangeTable:\n");
d86 3
a88 2
	printf ("Priority: %s\n RuleInfo: %s\n", root_priority(root),
		root_ruleinfo(root));
d116 1
a116 1
						nth(i, get_rtentries(plan)));
d125 1
a125 1
		print_rtentries (get_rtentries (plan), levelnum);
d179 20
d207 1
a207 1
	printf("Type : %d\n", ((Node)subplan)->type);
d209 1
a209 1
	printf("Cost : %g\n", get_state(subplan));
d220 2
a221 2
			printf( "%s", getrelname(get_scanrelid(subplan),
						 _query_range_table_));
d273 1
a273 1

d303 1
a303 5
		printf("(%s %ld :time %ld :flags 0x%lx :rulelocks",
			rt_relname(rtentry),
		        rt_relid(rtentry),
		        rt_time(rtentry),
		        rt_flags(rtentry));
d319 1
a319 1
		printf (")\n");
d401 1
d403 1
a403 1
		qual = CAR(i);
d415 2
d420 7
d428 3
a430 4
			getrelname(get_varno(var),_query_range_table_),
			get_attname(getrelid(get_varno(var),
				    _query_range_table_),
				    get_varattno (var)));
a544 1
	extern char *get_paramname();
d556 1
a556 1
	 if (get_paramname(param) != (char *) NULL)
a559 1
#endif /* NOT_FOR_DEMO */
@


1.6
log
@Working version of C-only demo
@
text
@d15 1
a15 1
RcsId("$Header: RCS/pppp.c,v 1.5 89/08/24 19:11:19 mao Exp $");
d221 1
a221 1
	if (IsA(subplan,MergeSort)) {
@


1.5
log
@not for demo
@
text
@d15 1
a15 1
RcsId("$Header: pppp.c,v 1.4 89/08/16 21:54:15 mao Exp $");
@


1.4
log
@print_plan works for x=1; need to fix code elsewhere to get it working
for other queries.
@
text
@d10 2
d15 1
a15 1
RcsId("$Header: pppp.c,v 1.3 89/07/28 12:09:40 mao Locked $");
d530 2
@


1.3
log
@*** empty log message ***
@
text
@d1 1
a1 2

/*     
d4 1
a4 1
 *     
d7 1
a7 1
 *     
a8 2
static char *rcsid =
"$Header: pppp.c,v 1.2 89/07/18 00:21:07 yatabe Locked $";
d10 7
d25 6
a30 1
#include "internal.h";
d32 12
d46 2
a47 1
 */ #endif
d57 1
a57 1
LispValue
d59 1
a59 1
LispValue parse ;
d71 1
a71 1
LispValue
d73 1
a73 1
LispValue root ;
d86 4
a89 3
LispValue
print_plan (plan, levelnum)
LispValue plan, levelnum;
d91 10
a100 6
int i;
LispValue saved_rt;
	if(append_p (plan)) {
		printf("Append %d\n\nInheritance Relation : %s\n", levelnum,
		       get_inhrelid(plan));
		/* XXX - let form, maybe incorrect */
d102 12
a113 8
		for (i = 0; i < (length (get_plans (plan)); i++){
		  printf("Appended Plan %d\n", i);
		  _query_range_table_ = fix_rangetable (_query_range_table_,
							get_inhrelid (plan),
							nth (i, get_rtentries (plan))),
		  print_plan (nth (i, get_plans (plan)),
		    0);
		    };
a114 3
		
		printf("Inheritance Rangetable :\n");
		print_rtentries (get_rtentries (plan), 0);
d116 6
a121 1
	} else if (existential_p (plan)) {
d123 3
a125 1
		if /*when */ ( get_lefttree (plan)) {
d127 1
a127 1
			print_plan (get_lefttree (plan), 0);
d129 3
a131 1
		if /*when */ ( get_righttree (plan)) {
d133 1
a133 1
			print_plan (get_righttree (plan), 0);
d136 2
a137 1
	} else if (result_p (plan)) {
d139 2
d142 3
a144 1
		print_tlist (get_qptargetlist (plan), 0);
d146 3
a148 1
		print_qual (get_resrellevelqual (plan), 0);
d150 4
a153 2
		print_qual (get_resconstantqual (plan), 0);
		if /*when */ ( get_lefttree (plan)) {
d155 1
a155 1
			print_subplan (get_lefttree (plan), 0);
d157 3
a159 2
		if /*when */ ( get_righttree (plan)) {
			print_plan (get_righttree (plan), (levelnum + 1));
d161 1
d163 4
a166 1
	} else if (1 /* XXX - true */) {
d168 2
a169 4
		print_subplan (plan, 0);

	} else if ( true ) ;  /* what is this all about jeff? this should be an error cond*/
	end-cond ;
d174 1
a174 1
LispValue
d176 2
a177 1
LispValue subplan, levels ;
d179 7
a185 11
	indent (levels);
	printf("        PathType : %s\n",type_of(subplan));
	indent (levels);
	printf("        Cost : %s\n", get_state(subplan));
	if /*when */ ( scan_p (subplan)) {
		indent (levels);
		printf("        Relid : ");
		if (integerp (get_scanrelid (subplan)) &&
		    (_TEMP_RELATION_ID_ != get_scanrelid (subplan)))
		  {
		  printf( "%s", getrelname( get_scanrelid(subplan),_query_range_table_));
d187 8
d196 1
a196 1
		  printf("%d", get_scanrelid (subplan));
d200 8
a207 8
	if (temp_p (subplan)) {
		indent (levels);
		printf("        TempID : %d\n", get_tempid (subplan));
		indent (levels);
		printf("        KeyCount : ", get_keycount (subplan), "\n");
		indent (levels);
		printf ("        TempList :\n");
		print_tlist (get_qptargetlist (subplan), (levels + 1)); 
d209 4
a212 7
	} else if (1 /* XXX - true */) {
		indent (levels);
		printf ("        TargetList :\n");
		print_tlist (get_qptargetlist (subplan), (levels + 1));
		indent (levels);
		printf ("        Qual :\n");
		print_qual (get_qpqual (subplan), (levels + 1));
d214 12
a225 8
	} else if ( true ) ;  
	end-cond ;
	if /*when */ ( mergesort_p (subplan)) {
		indent (levels);
		printf ("        MergeSortOp : ", get_mergesortop (subplan), "\n");
		indent (levels);
		printf ("        MergeClauses :\n");
		print_qual (get_mergehashclauses (subplan), (levels + 1));
d227 13
a239 6
	if /*when */ ( indexscan_p (subplan)) {
		indent (levels);
		printf ("        IndexID : ", get_indxid (subplan), "\n");
		indent (levels);
		printf ("        IndexQual :\n");
		print_allqual (get_indxqual (subplan), (levels + 1));
d242 4
a245 7
	if (join_p (subplan)) {
		indent (levels);
		printf ("        OuterPath :\n");
		print_subplan (get_lefttree (subplan), (levels + 1));
		indent (levels);
		printf ("        InnerPath :\n");
		print_subplan (get_righttree (subplan), (levels + 1));
d247 5
a251 1
	} else if (get_lefttree (subplan)) {
d253 6
a258 11
		if (result_p (get_lefttree (subplan))) {
			print_plan (get_lefttree (subplan), 1);

		} else if (1 /* XXX - true */) {
			print_subplan (get_lefttree (subplan), levels + 1);

		} else if ( true ) ;  
		end-cond ;

	} else if ( true ) ;  
	end-cond ;
d263 1
a263 1
LispValue
d265 2
a266 1
LispValue rt, levels ;
d268 2
a269 12
	foreach (rtentry, rt) {
		indent (levels + 1);
		printf ("(", rt_relname (rtentry),
		      " ", rt_relid (rtentry),
		      " :time ", rt_time (rtentry),
		      " :flags ", rt_flags (rtentry),
		      " :rulelocks ");
		if (integerp (rt_rulelocks (rtentry))) {
			printf ("\n", " ");
			indent (levels + 1);
			print_rule_lock_intermediate (rt_rulelocks (rtentry));
			indent (levels + 1);
d271 3
a273 2
		} else if (1 /* XXX - true */) {
			printf (rt_rulelocks (rtentry));
d275 21
a295 2
		} else if ( true ) ;  
		end-cond ;
d297 2
d300 2
a301 6
	      };
      }

	/*  .. print_parse, print_plan, print_subplan
 */
LispValue
d303 2
a304 1
     LispValue tlist,levels ;
d306 7
a312 4
  foreach (entry, tlist) {
    indent (levels + 1);
    print_tlistentry (entry);
  }
d317 4
a320 3
LispValue
print_tlistentry (tlistentrytlistentry)
     LispValue tlistentry ;
d322 2
a323 1
   LispValue resdom, exp;
d325 2
a326 3
   resdom = tl_resdom (tlistentry);
   expr = get_expr (tlistentry);
   printf ("(", get_resno (resdom)," ");
d328 2
a329 8
   if /*when */ (get_reskey (resdom)) {                    /* not equal to 0 */
      printf ("(", get_reskey (resdom), " ", get_reskeyop (resdom), ") ");
   };
   if /*when */ ( get_resname (resdom)) {
      printf (get_resname (resdom), " ");
   };
   print_clause (expr, 0);
   printf (")\n");
d331 15
d350 5
a354 3
LispValue
print_allqual (quals, levels)
     LispValue quals, levels ;
d356 9
a364 5
   foreach (qual, quals) {
      print_qual (qual,levels);
      printf ("\n");
      
   };
d366 1
a366 1
   
d369 5
a373 3
LispValue
print_qual (qual, levels)
     LispValue qual,levels ;
d375 2
a376 5
   foreach (clause, qual)
      {
      printf ("        ");
      print_clause (clause, levels);
      printf ("\n");
d378 5
a382 1
   };
d384 1
a384 1
   
d387 3
a389 3
LispValue
print_var (var)
     LispValue var ;
d391 8
a398 8
   printf ("(");
   if(_query_range_table_ &&
      integerp (get_varno (var)) &&
      (_TEMP_RELATION_ID_ != get_varno (var)))
      {
      printf (getrelname (get_varno (var),_query_range_table_), " ",
	    get_attname (getrelid (get_varno (var),_query_range_table_),
			 get_varattno (var)));
d400 3
a402 2
   } else if (1 /* XXX - true */) {
      printf (get_varno (var), " ", get_varattno (var));
d404 12
a415 10
   } else if ( true ) ;  
   end-cond ;
   
   foreach (dot, get_vardotfields (var)) {
      printf (" ", dot);
   };
   if /*when */ ( get_vararrayindex (var)) {
      printf ("(", get_vararrayindex (var), ")");
   };
   printf (")");
d420 4
a423 3
LispValue
print_clause (clause, levels)
     LispValue clause, levels ;
d425 38
a462 36
   if /*when */ (clause) {
      indent (levels);
      if(var_p (clause)) {
	 print_var (clause);
	 
      } else if (const_p (clause)) {
	 print_const (clause);
	 
      } else if (param_p (clause)) {
	 print_param (clause);
	 
      } else if (or_clause (clause)) {
	 printf ("(OR ");
	 print_clauses (get_orclauseargs (clause));
	 printf (") ");
	 
      } else if (not_clause (clause)) {
	 printf ("(NOT ");
	 print_clause (get_notclausearg (clause), 0);
	 printf (") ");
	 
      } else if (is_funcclause (clause)) {
	 printf ("(", get_funcid (get_function (clause)), " ");
	 print_clauses (get_funcargs (clause));
	 printf (") ");
	 
      } else if (1 /* XXX - true */) {
	 printf ("(", get_opno (get_op (clause)), " ");
	 print_clause (get_leftop (clause), 0);
	 printf (" ");
	 print_clause (get_rightop (clause), 0);
	 printf (") ");
	 
      } else if ( true ) ;  
      end-cond ;
   };
d467 14
a480 9
LispValue
print_clauses (clauses)
     LispValue clauses ;
{
   foreach (clause, clauses) {
      print_clause (clause, 0);
      
   };
}
d484 3
a486 3
LispValue
print_const (const)
     LispValue const ;
d488 9
a496 3
/* Don't know what this is supposed to do
 * I think this should be
 */
d498 7
a504 10
  if (is_null (const))
    {
      printf("*NULL*");
    } else if (stringp (get_constvalue (const)))
      {
	printf(%s,get_constvalue (const));
      } else
	{
	  printf(%s, lisp_print (get_constvalue (const)));     /* need to convert lisp -> string here */
	};
d509 1
a509 1
LispValue
d511 1
a511 1
LispValue param ;
d513 1
a513 9
	printf (" $");
	if (stringp (get_paramid (param)))
	  {
	    printf(".");
	  } else {
	    printf("");
	  };
	get_paramid (param);
      }
d515 13
a527 11
/*  .. print_clause, print_rtentries, print_subplan, print_tlist
 */
LispValue
indent (levels)
LispValue levels ;
{
	foreach (i, levels)
	  {
	    printf ("        ");
	  };
      }
@


1.2
log
@*** empty log message ***
@
text
@d11 1
a11 1
"$Header: pppp.c,v 1.1 89/07/11 03:15:11 yatabe Locked $";
d54 1
a54 1
		root_levels(root), root_command_type(root),
d253 1
a253 1
   expr = tl_expr (tlistentry);
@


1.1
log
@Initial revision
@
text
@d11 1
a11 1
"$Header: pppp.l,v 1.1 89/01/20 02:19:16 yatabe Exp $";
d41 1
a41 1
	mesg ("TargetList:\n");
d43 1
a43 1
	mesg ("Qualification:\n");
d53 3
a55 3
	mesg ("NumLevels: ", root_levels (root), "\n",
	      "CommandType: ", root_command_type (root), "\n",
	      "ResultRelation: ", root_result_relation (root), "\n",
d58 2
a59 2
	mesg ("Priority: ", root_priority (root), "\n",
	      "RuleInfo: ", root_ruleinfo (root), "\n");
d71 2
a72 2
		mesg ("Append", levelnum, "\n\n",
		      "Inheritance Relation : ", get_inhrelid (plan), "\n");
d76 1
a76 1
		  mesg ("Appended Plan", i, "\n");
d85 1
a85 1
		mesg ("Inheritance Rangetable :\n");
d89 1
a89 1
		mesg ("Existential", levelnum, "\n");
d91 1
a91 1
			mesg ("\nExistential Plan", levelnum, "\n");
d95 1
a95 1
			mesg ("\nQuery Plan", levelnum, "\n");
d100 2
a101 2
		mesg ("Result", levelnum, "\n\n");
		mesg ("TargetList :\n");
d103 1
a103 1
		mesg ("RelLevelQual :\n");
d105 1
a105 1
		mesg ("ConstantQual :\n");
d108 1
a108 1
			mesg ("\nSubplan", levelnum, "\n\n");
d116 1
a116 1
		mesg ("Subplan", levelnum, "\n\n");
d130 1
a130 1
	mesg ("        PathType : ",type_of (subplan), "\n");
d132 1
a132 1
	mesg ("        Cost : ", get_state (subplan), "\n");
d135 1
a135 1
		mesg ("        Relid : ");
d139 1
a139 1
		  mesg (getrelname (get_scanrelid (subplan),_query_range_table_));
d142 1
a142 1
		  mesg (get_scanrelid (subplan));
d144 1
a144 1
		mesg("\n");
d148 1
a148 1
		mesg ("        TempID : ", get_tempid (subplan), "\n");
d150 1
a150 1
		mesg ("        KeyCount : ", get_keycount (subplan), "\n");
d152 1
a152 1
		mesg ("        TempList :\n");
d157 1
a157 1
		mesg ("        TargetList :\n");
d160 1
a160 1
		mesg ("        Qual :\n");
d167 1
a167 1
		mesg ("        MergeSortOp : ", get_mergesortop (subplan), "\n");
d169 1
a169 1
		mesg ("        MergeClauses :\n");
d174 1
a174 1
		mesg ("        IndexID : ", get_indxid (subplan), "\n");
d176 1
a176 1
		mesg ("        IndexQual :\n");
d178 1
a178 1
		mesg ("\n");
d182 1
a182 1
		mesg ("        OuterPath :\n");
d185 1
a185 1
		mesg ("        InnerPath :\n");
d189 1
a189 1
		mesg ("\n");
d211 1
a211 1
		mesg ("(", rt_relname (rtentry),
d217 1
a217 1
			mesg ("\n", " ");
d223 1
a223 1
			mesg (rt_rulelocks (rtentry));
d227 1
a227 1
		mesg (")\n");
d254 1
a254 1
   mesg ("(", get_resno (resdom)," ");
d257 1
a257 1
      mesg ("(", get_reskey (resdom), " ", get_reskeyop (resdom), ") ");
d260 1
a260 1
      mesg (get_resname (resdom), " ");
d263 1
a263 1
   mesg (")\n");
d275 1
a275 1
      mesg ("\n");
d288 1
a288 1
      mesg ("        ");
d290 1
a290 1
      mesg ("\n");
d301 1
a301 1
   mesg ("(");
d306 1
a306 1
      mesg (getrelname (get_varno (var),_query_range_table_), " ",
d311 1
a311 1
      mesg (get_varno (var), " ", get_varattno (var));
d317 1
a317 1
      mesg (" ", dot);
d320 1
a320 1
      mesg ("(", get_vararrayindex (var), ")");
d322 1
a322 1
   mesg (")");
d343 1
a343 1
	 mesg ("(OR ");
d345 1
a345 1
	 mesg (") ");
d348 1
a348 1
	 mesg ("(NOT ");
d350 1
a350 1
	 mesg (") ");
d353 1
a353 1
	 mesg ("(", get_funcid (get_function (clause)), " ");
d355 1
a355 1
	 mesg (") ");
d358 1
a358 1
	 mesg ("(", get_opno (get_op (clause)), " ");
d360 1
a360 1
	 mesg (" ");
d362 1
a362 1
	 mesg (") ");
d409 1
a409 1
	mesg (" $");
d412 1
a412 1
	    mesg(".");
d414 1
a414 1
	    mesg("");
d427 1
a427 1
	    mesg ("        ");
@
