Commit c5a27161 authored by Marc G. Fournier's avatar Marc G. Fournier

parent 3b8854ff
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: outfuncs.c,v 1.54 1998/12/15 02:32:57 scrappy Exp $ * $Id: outfuncs.c,v 1.55 1998/12/15 04:00:46 scrappy Exp $
* *
* NOTES * NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which * Every (plan) node in POSTGRES has an associated "out" routine which
...@@ -594,13 +594,11 @@ _outFjoin(StringInfo str, Fjoin *node) ...@@ -594,13 +594,11 @@ _outFjoin(StringInfo str, Fjoin *node)
static void static void
_outExpr(StringInfo str, Expr *node) _outExpr(StringInfo str, Expr *node)
{ {
char buf[500];
char *opstr = NULL; char *opstr = NULL;
appendStringInfo(str, " EXPR "); appendStringInfo(str, " EXPR :typeOid %u ",
node->typeOid);
sprintf(buf, " :typeOid %u ", node->typeOid);
appendStringInfo(str, buf);
switch (node->opType) switch (node->opType)
{ {
case OP_EXPR: case OP_EXPR:
...@@ -622,10 +620,9 @@ _outExpr(StringInfo str, Expr *node) ...@@ -622,10 +620,9 @@ _outExpr(StringInfo str, Expr *node)
opstr = "subp"; opstr = "subp";
break; break;
} }
appendStringInfo(str, " :opType "); appendStringInfo(str, " :opType %s :oper ", opstr);
appendStringInfo(str, opstr);
appendStringInfo(str, " :oper ");
_outNode(str, node->oper); _outNode(str, node->oper);
appendStringInfo(str, " :args "); appendStringInfo(str, " :args ");
_outNode(str, node->args); _outNode(str, node->args);
} }
...@@ -636,23 +633,17 @@ _outExpr(StringInfo str, Expr *node) ...@@ -636,23 +633,17 @@ _outExpr(StringInfo str, Expr *node)
static void static void
_outVar(StringInfo str, Var *node) _outVar(StringInfo str, Var *node)
{ {
char buf[500]; appendStringInfo(str,
" VAR :varno %d :varattno %d :vartype %u %vartypmod %d ",
node->varno,
node->varattno,
node->vartype,
node->vartypmod);
appendStringInfo(str, " VAR "); appendStringInfo(str, " :varlevelsup %u :varnoold %d :varoattno %d" ,
sprintf(buf, " :varno %d ", node->varno); node->varlevelsup,
appendStringInfo(str, buf); node->varnoold,
sprintf(buf, " :varattno %d ", node->varattno); node->varoattno);
appendStringInfo(str, buf);
sprintf(buf, " :vartype %u ", node->vartype);
appendStringInfo(str, buf);
sprintf(buf, " :vartypmod %d ", node->vartypmod);
appendStringInfo(str, buf);
sprintf(buf, " :varlevelsup %u ", node->varlevelsup);
appendStringInfo(str, buf);
sprintf(buf, " :varnoold %d ", node->varnoold);
appendStringInfo(str, buf);
sprintf(buf, " :varoattno %d ", node->varoattno);
appendStringInfo(str, buf);
} }
/* /*
...@@ -661,22 +652,19 @@ _outVar(StringInfo str, Var *node) ...@@ -661,22 +652,19 @@ _outVar(StringInfo str, Var *node)
static void static void
_outConst(StringInfo str, Const *node) _outConst(StringInfo str, Const *node)
{ {
char buf[500]; appendStringInfo(str,
" CONST :consttype %u :constlen %d :constisnull %s :constvalue ",
node->consttype,
node->constlen,
node->constisnull ? "true" : "false");
appendStringInfo(str, " CONST ");
sprintf(buf, " :consttype %u ", node->consttype);
appendStringInfo(str, buf);
sprintf(buf, " :constlen %d ", node->constlen);
appendStringInfo(str, buf);
appendStringInfo(str, " :constisnull ");
appendStringInfo(str, node->constisnull ? "true" : "false");
appendStringInfo(str, " :constvalue ");
if (node->constisnull) if (node->constisnull)
appendStringInfo(str, "<>"); appendStringInfo(str, "<>");
else else
_outDatum(str, node->constvalue, node->consttype); _outDatum(str, node->constvalue, node->consttype);
appendStringInfo(str, " :constbyval ");
appendStringInfo(str, node->constbyval ? "true" : "false"); appendStringInfo(str, " :constbyval %s ",
node->constbyval ? "true" : "false");
} }
/* /*
...@@ -685,21 +673,16 @@ _outConst(StringInfo str, Const *node) ...@@ -685,21 +673,16 @@ _outConst(StringInfo str, Const *node)
static void static void
_outAggreg(StringInfo str, Aggreg *node) _outAggreg(StringInfo str, Aggreg *node)
{ {
char buf[500]; appendStringInfo(str,
" AGGREG :aggname %s :basetype %u :aggtype %u :target ",
appendStringInfo(str, " AGGREG "); node->aggname,
appendStringInfo(str, " :aggname "); node->basetype,
appendStringInfo(str, (char *) node->aggname); node->aggtype);
sprintf(buf, " :basetype %u ", node->basetype);
appendStringInfo(str, buf);
sprintf(buf, " :aggtype %u ", node->aggtype);
appendStringInfo(str, buf);
appendStringInfo(str, " :target ");
_outNode(str, node->target); _outNode(str, node->target);
sprintf(buf, " :aggno %d ", node->aggno);
appendStringInfo(str, buf); appendStringInfo(str, ":aggno %d :usenulls %s",
appendStringInfo(str, " :usenulls "); node->aggno,
appendStringInfo(str, node->usenulls ? "true" : "false"); node->usenulls ? "true" : "false");
} }
/* /*
...@@ -708,17 +691,15 @@ _outAggreg(StringInfo str, Aggreg *node) ...@@ -708,17 +691,15 @@ _outAggreg(StringInfo str, Aggreg *node)
static void static void
_outSubLink(StringInfo str, SubLink *node) _outSubLink(StringInfo str, SubLink *node)
{ {
char buf[500]; appendStringInfo(str,
" SUBLINK :subLinkType %d :useor %s :lefthand ",
appendStringInfo(str, " SUBLINK "); node->subLinkType,
sprintf(buf, " :subLinkType %d ", node->subLinkType); node->useor ? "true" : "false");
appendStringInfo(str, buf);
appendStringInfo(str, " :useor ");
appendStringInfo(str, node->useor ? "true" : "false");
appendStringInfo(str, " :lefthand ");
_outNode(str, node->lefthand); _outNode(str, node->lefthand);
appendStringInfo(str, " :oper "); appendStringInfo(str, " :oper ");
_outNode(str, node->oper); _outNode(str, node->oper);
appendStringInfo(str, " :subselect "); appendStringInfo(str, " :subselect ");
_outNode(str, node->subselect); _outNode(str, node->subselect);
} }
...@@ -729,32 +710,26 @@ _outSubLink(StringInfo str, SubLink *node) ...@@ -729,32 +710,26 @@ _outSubLink(StringInfo str, SubLink *node)
static void static void
_outArray(StringInfo str, Array *node) _outArray(StringInfo str, Array *node)
{ {
char buf[500];
int i; int i;
appendStringInfo(str, " ARRAY "); appendStringInfo(str,
sprintf(buf, " :arrayelemtype %u ", node->arrayelemtype); " ARRAY :arrayelemtype %u :arrayelemlength %d :arrayelembyval %c ",
appendStringInfo(str, buf); node->arrayelemtype,
sprintf(buf, " :arrayelemlength %d ", node->arrayelemlength); node->arrayelemlength,
appendStringInfo(str, buf); node->arrayelembyval ? 't' : 'f');
sprintf(buf, " :arrayelembyval %c ", (node->arrayelembyval) ? 't' : 'f');
appendStringInfo(str, buf); appendStringInfo(str, " :arrayndim %d ", node->arrayndim);
sprintf(buf, " :arrayndim %d ", node->arrayndim);
appendStringInfo(str, buf);
appendStringInfo(str, " :arraylow "); appendStringInfo(str, " :arraylow ");
for (i = 0; i < node->arrayndim; i++) for (i = 0; i < node->arrayndim; i++)
{ {
sprintf(buf, " %d ", node->arraylow.indx[i]); appendStringInfo(str, " %d ", node->arraylow.indx[i]);
appendStringInfo(str, buf);
} }
appendStringInfo(str, " :arrayhigh "); appendStringInfo(str, " :arrayhigh ");
for (i = 0; i < node->arrayndim; i++) for (i = 0; i < node->arrayndim; i++)
{ {
sprintf(buf, " %d ", node->arrayhigh.indx[i]); appendStringInfo(str, " %d ", node->arrayhigh.indx[i]);
appendStringInfo(str, buf);
} }
sprintf(buf, " :arraylen %d ", node->arraylen); appendStringInfo(str, " :arraylen %d ", node->arraylen);
appendStringInfo(str, buf);
} }
/* /*
...@@ -763,19 +738,14 @@ _outArray(StringInfo str, Array *node) ...@@ -763,19 +738,14 @@ _outArray(StringInfo str, Array *node)
static void static void
_outArrayRef(StringInfo str, ArrayRef *node) _outArrayRef(StringInfo str, ArrayRef *node)
{ {
char buf[500]; appendStringInfo(str,
" ARRAYREF :refelemtype %u :refattrlength $d :refelemlength %d ",
appendStringInfo(str, " ARRAYREF "); node->refelemtype,
sprintf(buf, " :refelemtype %u ", node->refelemtype); node->refattrlength,
appendStringInfo(str, buf); node->refelemlength);
sprintf(buf, " :refattrlength %d ", node->refattrlength);
appendStringInfo(str, buf);
sprintf(buf, " :refelemlength %d ", node->refelemlength);
appendStringInfo(str, buf);
sprintf(buf, " :refelembyval %c ", (node->refelembyval) ? 't' : 'f');
appendStringInfo(str, buf);
appendStringInfo(str, " :refupperindex "); appendStringInfo(str, " :refelembyval %c :refupperindex ",
node->refelembyval ? 't' : 'f');
_outNode(str, node->refupperindexpr); _outNode(str, node->refupperindexpr);
appendStringInfo(str, " :reflowerindex "); appendStringInfo(str, " :reflowerindex ");
...@@ -794,21 +764,15 @@ _outArrayRef(StringInfo str, ArrayRef *node) ...@@ -794,21 +764,15 @@ _outArrayRef(StringInfo str, ArrayRef *node)
static void static void
_outFunc(StringInfo str, Func *node) _outFunc(StringInfo str, Func *node)
{ {
char buf[500]; appendStringInfo(str,
" FUNC :funcid %u :functype %u :funcisindex %s :funcsize %d ",
appendStringInfo(str, " FUNC "); node->funcid,
sprintf(buf, " :funcid %u ", node->funcid); node->functype,
appendStringInfo(str, buf); node->funcisindex ? "true" : "false",
sprintf(buf, " :functype %u ", node->functype); node->funcsize);
appendStringInfo(str, buf);
appendStringInfo(str, " :funcisindex "); appendStringInfo(str, " :func_fcache @ 0x%x :func_tlist ",
appendStringInfo(str, (node->funcisindex ? "true" : "false")); (int) node->func_fcache);
sprintf(buf, " :funcsize %d ", node->funcsize);
appendStringInfo(str, buf);
sprintf(buf, " :func_fcache @ 0x%x ", (int) (node->func_fcache));
appendStringInfo(str, buf);
appendStringInfo(str, " :func_tlist ");
_outNode(str, node->func_tlist); _outNode(str, node->func_tlist);
appendStringInfo(str, " :func_planlist "); appendStringInfo(str, " :func_planlist ");
...@@ -821,16 +785,11 @@ _outFunc(StringInfo str, Func *node) ...@@ -821,16 +785,11 @@ _outFunc(StringInfo str, Func *node)
static void static void
_outOper(StringInfo str, Oper *node) _outOper(StringInfo str, Oper *node)
{ {
char buf[500]; appendStringInfo(str,
" OPER :opno %u :opid %u :opresulttype %u ",
appendStringInfo(str, " OPER "); node->opno,
sprintf(buf, " :opno %u ", node->opno); node->opid,
appendStringInfo(str, buf); node->opresulttype);
sprintf(buf, " :opid %u ", node->opid);
appendStringInfo(str, buf);
sprintf(buf, " :opresulttype %u ", node->opresulttype);
appendStringInfo(str, buf);
} }
/* /*
...@@ -839,17 +798,12 @@ _outOper(StringInfo str, Oper *node) ...@@ -839,17 +798,12 @@ _outOper(StringInfo str, Oper *node)
static void static void
_outParam(StringInfo str, Param *node) _outParam(StringInfo str, Param *node)
{ {
char buf[500]; appendStringInfo(str,
" PARAM :paramkind %d :paramid %d :paramname %s :paramtype %u ",
appendStringInfo(str, " PARAM "); node->paramkind,
sprintf(buf, " :paramkind %d ", node->paramkind); node->paramid,
appendStringInfo(str, buf); node->paramname,
sprintf(buf, " :paramid %d ", node->paramid); node->paramtype);
appendStringInfo(str, buf);
appendStringInfo(str, " :paramname ");
appendStringInfo(str, node->paramname);
sprintf(buf, " :paramtype %u ", node->paramtype);
appendStringInfo(str, buf);
appendStringInfo(str, " :param_tlist "); appendStringInfo(str, " :param_tlist ");
_outNode(str, node->param_tlist); _outNode(str, node->param_tlist);
...@@ -865,19 +819,13 @@ _outParam(StringInfo str, Param *node) ...@@ -865,19 +819,13 @@ _outParam(StringInfo str, Param *node)
static void static void
_outEState(StringInfo str, EState *node) _outEState(StringInfo str, EState *node)
{ {
char buf[500]; appendStringInfo(str,
" ESTATE :direction %d :range_table ",
appendStringInfo(str, " ESTATE "); node->es_direction);
sprintf(buf, " :direction %d ", node->es_direction);
appendStringInfo(str, buf);
appendStringInfo(str, " :range_table ");
_outNode(str, node->es_range_table); _outNode(str, node->es_range_table);
sprintf(buf, " :result_relation_info @ 0x%x ", appendStringInfo(str, " :result_relation_info @ 0x%x ",
(int) (node->es_result_relation_info)); (int) (node->es_result_relation_info));
appendStringInfo(str, buf);
} }
/* /*
...@@ -886,25 +834,16 @@ _outEState(StringInfo str, EState *node) ...@@ -886,25 +834,16 @@ _outEState(StringInfo str, EState *node)
static void static void
_outRelOptInfo(StringInfo str, RelOptInfo * node) _outRelOptInfo(StringInfo str, RelOptInfo * node)
{ {
char buf[500]; appendStringInfo(str, " RELOPTINFO :relids ");
appendStringInfo(str, " RELOPTINFO ");
appendStringInfo(str, " :relids ");
_outIntList(str, node->relids); _outIntList(str, node->relids);
appendStringInfo(str, " :indexed "); appendStringInfo(str,
appendStringInfo(str, node->indexed ? "true" : "false"); " :indexed %s :pages %u :tuples %u :size %u :width %u :targetlist ",
sprintf(buf, " :pages %u ", node->pages); node->indexed ? "true" : "false",
appendStringInfo(str, buf); node->pages,
sprintf(buf, " :tuples %u ", node->tuples); node->tuples,
appendStringInfo(str, buf); node->size,
sprintf(buf, " :size %u ", node->size); node->width);
appendStringInfo(str, buf);
sprintf(buf, " :width %u ", node->width);
appendStringInfo(str, buf);
appendStringInfo(str, " :targetlist ");
_outNode(str, node->targetlist); _outNode(str, node->targetlist);
appendStringInfo(str, " :pathlist "); appendStringInfo(str, " :pathlist ");
...@@ -916,26 +855,11 @@ _outRelOptInfo(StringInfo str, RelOptInfo * node) ...@@ -916,26 +855,11 @@ _outRelOptInfo(StringInfo str, RelOptInfo * node)
* This can be changed later, if necessary. * This can be changed later, if necessary.
*/ */
sprintf(buf, " :unorderedpath @ 0x%x ", (int) (node->unorderedpath)); appendStringInfo(str,
appendStringInfo(str, buf); " :unorderedpath @ 0x%x :cheapestpath @ 0x%x :pruneable %s :clauseinfo ",
sprintf(buf, " :cheapestpath @ 0x%x ", (int) (node->cheapestpath)); (int) node->unorderedpath,
appendStringInfo(str, buf); (int) node->cheapestpath,
node->pruneable ? "true" : "false");
appendStringInfo(str, " :pruneable ");
appendStringInfo(str, node->pruneable ? "true" : "false");
#if 0
appendStringInfo(str, " :classlist ");
_outNode(str, node->classlist);
appendStringInfo(str, " :indexkeys ");
_outNode(str, node->indexkeys);
appendStringInfo(str, " :ordering ");
_outNode(str, node->ordering);
#endif
appendStringInfo(str, " :clauseinfo ");
_outNode(str, node->clauseinfo); _outNode(str, node->clauseinfo);
appendStringInfo(str, " :joininfo "); appendStringInfo(str, " :joininfo ");
...@@ -943,7 +867,6 @@ _outRelOptInfo(StringInfo str, RelOptInfo * node) ...@@ -943,7 +867,6 @@ _outRelOptInfo(StringInfo str, RelOptInfo * node)
appendStringInfo(str, " :innerjoin "); appendStringInfo(str, " :innerjoin ");
_outNode(str, node->innerjoin); _outNode(str, node->innerjoin);
} }
/* /*
...@@ -952,8 +875,7 @@ _outRelOptInfo(StringInfo str, RelOptInfo * node) ...@@ -952,8 +875,7 @@ _outRelOptInfo(StringInfo str, RelOptInfo * node)
static void static void
_outTargetEntry(StringInfo str, TargetEntry *node) _outTargetEntry(StringInfo str, TargetEntry *node)
{ {
appendStringInfo(str, " TARGETENTRY "); appendStringInfo(str, " TARGETENTRY :resdom ");
appendStringInfo(str, " :resdom ");
_outNode(str, node->resdom); _outNode(str, node->resdom);
appendStringInfo(str, " :expr "); appendStringInfo(str, " :expr ");
...@@ -963,28 +885,14 @@ _outTargetEntry(StringInfo str, TargetEntry *node) ...@@ -963,28 +885,14 @@ _outTargetEntry(StringInfo str, TargetEntry *node)
static void static void
_outRangeTblEntry(StringInfo str, RangeTblEntry *node) _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
{ {
char buf[500]; appendStringInfo(str,
" RTE :relname %s :refname %s :relid %u :inh %s :inFromCl %s :skipAcl %s",
appendStringInfo(str, " RTE "); node->relname,
node->refname,
appendStringInfo(str, " :relname "); node->relid,
appendStringInfo(str, node->relname); node->inh ? "true" : "false",
node->inFromCl ? "true" : "false",
appendStringInfo(str, " :refname "); node->skipAcl ? "true" : "false");
appendStringInfo(str, node->refname);
sprintf(buf, " :relid %u ", node->relid);
appendStringInfo(str, buf);
appendStringInfo(str, " :inh ");
appendStringInfo(str, node->inh ? "true" : "false");
appendStringInfo(str, " :inFromCl ");
appendStringInfo(str, node->inFromCl ? "true" : "false");
appendStringInfo(str, " :skipAcl ");
appendStringInfo(str, node->skipAcl ? "true" : "false");
} }
/* /*
...@@ -993,19 +901,10 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) ...@@ -993,19 +901,10 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
static void static void
_outPath(StringInfo str, Path *node) _outPath(StringInfo str, Path *node)
{ {
char buf[500]; appendStringInfo(str, " PATH :pathtype %d :cost %f :keys ",
node->pathtype,
appendStringInfo(str, " PATH "); node->path_cost);
sprintf(buf, " :pathtype %d ", node->pathtype);
appendStringInfo(str, buf);
sprintf(buf, " :cost %f ", node->path_cost);
appendStringInfo(str, buf);
appendStringInfo(str, " :keys ");
_outNode(str, node->keys); _outNode(str, node->keys);
} }
/* /*
...@@ -1014,26 +913,10 @@ _outPath(StringInfo str, Path *node) ...@@ -1014,26 +913,10 @@ _outPath(StringInfo str, Path *node)
static void static void
_outIndexPath(StringInfo str, IndexPath *node) _outIndexPath(StringInfo str, IndexPath *node)
{ {
char buf[500]; appendStringInfo(str,
" INDEXPATH :pathtype %d :cost %f :keys ",
appendStringInfo(str, " INDEXPATH "); node->path.pathtype,
node->path.path_cost);
sprintf(buf, " :pathtype %d ", node->path.pathtype);
appendStringInfo(str, buf);
/*
* sprintf(buf, " :parent "); appendStringInfo(str,buf); _outNode(str,
* node->parent);
*/
sprintf(buf, " :cost %f ", node->path.path_cost);
appendStringInfo(str, buf);
#if 0
appendStringInfo(str, " :p_ordering ");
_outNode(str, node->path.p_ordering);
#endif
appendStringInfo(str, " :keys ");
_outNode(str, node->path.keys); _outNode(str, node->path.keys);
appendStringInfo(str, " :indexid "); appendStringInfo(str, " :indexid ");
...@@ -1041,7 +924,6 @@ _outIndexPath(StringInfo str, IndexPath *node) ...@@ -1041,7 +924,6 @@ _outIndexPath(StringInfo str, IndexPath *node)
appendStringInfo(str, " :indexqual "); appendStringInfo(str, " :indexqual ");
_outNode(str, node->indexqual); _outNode(str, node->indexqual);
} }
/* /*
...@@ -1050,26 +932,10 @@ _outIndexPath(StringInfo str, IndexPath *node) ...@@ -1050,26 +932,10 @@ _outIndexPath(StringInfo str, IndexPath *node)
static void static void
_outJoinPath(StringInfo str, JoinPath *node) _outJoinPath(StringInfo str, JoinPath *node)
{ {
char buf[500]; appendStringInfo(str,
" JOINPATH :pathtype %d :cost %f :keys ",
appendStringInfo(str, " JOINPATH "); node->path.pathtype,
node->path.path_cost);
sprintf(buf, " :pathtype %d ", node->path.pathtype);
appendStringInfo(str, buf);
/*
* sprintf(buf, " :parent "); appendStringInfo(str,buf); _outNode(str,
* node->parent);
*/
sprintf(buf, " :cost %f ", node->path.path_cost);
appendStringInfo(str, buf);
#if 0
appendStringInfo(str, " :p_ordering ");
_outNode(str, node->path.p_ordering);
#endif
appendStringInfo(str, " :keys ");
_outNode(str, node->path.keys); _outNode(str, node->path.keys);
appendStringInfo(str, " :pathclauseinfo "); appendStringInfo(str, " :pathclauseinfo ");
...@@ -1080,17 +946,12 @@ _outJoinPath(StringInfo str, JoinPath *node) ...@@ -1080,17 +946,12 @@ _outJoinPath(StringInfo str, JoinPath *node)
* For now, i'll just print the addresses. * For now, i'll just print the addresses.
*/ */
sprintf(buf, " :outerjoinpath @ 0x%x ", (int) (node->outerjoinpath)); appendStringInfo(str,
appendStringInfo(str, buf); " :outerjoinpath @ 0x%x :innerjoinpath @ 0x%x :outjoincost %f :joinid ",
sprintf(buf, " :innerjoinpath @ 0x%x ", (int) (node->innerjoinpath)); (int) node->outerjoinpath,
appendStringInfo(str, buf); (int) node->innerjoinpath,
node->path.outerjoincost);
sprintf(buf, " :outerjoincost %f ", node->path.outerjoincost);
appendStringInfo(str, buf);
appendStringInfo(str, " :joinid ");
_outIntList(str, node->path.joinid); _outIntList(str, node->path.joinid);
} }
/* /*
...@@ -1099,17 +960,10 @@ _outJoinPath(StringInfo str, JoinPath *node) ...@@ -1099,17 +960,10 @@ _outJoinPath(StringInfo str, JoinPath *node)
static void static void
_outMergePath(StringInfo str, MergePath *node) _outMergePath(StringInfo str, MergePath *node)
{ {
char buf[500]; appendStringInfo(str,
" MERGEPATH :pathtype %d :cost %f :keys ",
appendStringInfo(str, " MERGEPATH "); node->jpath.path.pathtype,
node->jpath.path.path_cost);
sprintf(buf, " :pathtype %d ", node->jpath.path.pathtype);
appendStringInfo(str, buf);
sprintf(buf, " :cost %f ", node->jpath.path.path_cost);
appendStringInfo(str, buf);
appendStringInfo(str, " :keys ");
_outNode(str, node->jpath.path.keys); _outNode(str, node->jpath.path.keys);
appendStringInfo(str, " :pathclauseinfo "); appendStringInfo(str, " :pathclauseinfo ");
...@@ -1120,15 +974,11 @@ _outMergePath(StringInfo str, MergePath *node) ...@@ -1120,15 +974,11 @@ _outMergePath(StringInfo str, MergePath *node)
* For now, i'll just print the addresses. * For now, i'll just print the addresses.
*/ */
sprintf(buf, " :outerjoinpath @ 0x%x ", (int) (node->jpath.outerjoinpath)); appendStringInfo(str,
appendStringInfo(str, buf); " :outerjoinpath @ 0x%x :innerjoinpath @ 0x%x :outerjoincost %f :joinid ",
sprintf(buf, " :innerjoinpath @ 0x%x ", (int) (node->jpath.innerjoinpath)); (int) node->jpath.outerjoinpath,
appendStringInfo(str, buf); (int) node->jpath.innerjoinpath,
(int) node->jpath.path.outerjoincost);
sprintf(buf, " :outerjoincost %f ", node->jpath.path.outerjoincost);
appendStringInfo(str, buf);
appendStringInfo(str, " :joinid ");
_outIntList(str, node->jpath.path.joinid); _outIntList(str, node->jpath.path.joinid);
appendStringInfo(str, " :path_mergeclauses "); appendStringInfo(str, " :path_mergeclauses ");
...@@ -1139,7 +989,6 @@ _outMergePath(StringInfo str, MergePath *node) ...@@ -1139,7 +989,6 @@ _outMergePath(StringInfo str, MergePath *node)
appendStringInfo(str, " :innersortkeys "); appendStringInfo(str, " :innersortkeys ");
_outNode(str, node->innersortkeys); _outNode(str, node->innersortkeys);
} }
/* /*
...@@ -1148,17 +997,10 @@ _outMergePath(StringInfo str, MergePath *node) ...@@ -1148,17 +997,10 @@ _outMergePath(StringInfo str, MergePath *node)
static void static void
_outHashPath(StringInfo str, HashPath *node) _outHashPath(StringInfo str, HashPath *node)
{ {
char buf[500]; appendStringInfo(str,
" HASHPATH :pathtype %d :cost %f :keys ",
appendStringInfo(str, " HASHPATH "); node->jpath.path.pathtype,
node->jpath.path.path_cost);
sprintf(buf, " :pathtype %d ", node->jpath.path.pathtype);
appendStringInfo(str, buf);
sprintf(buf, " :cost %f ", node->jpath.path.path_cost);
appendStringInfo(str, buf);
appendStringInfo(str, " :keys ");
_outNode(str, node->jpath.path.keys); _outNode(str, node->jpath.path.keys);
appendStringInfo(str, " :pathclauseinfo "); appendStringInfo(str, " :pathclauseinfo ");
...@@ -1169,15 +1011,11 @@ _outHashPath(StringInfo str, HashPath *node) ...@@ -1169,15 +1011,11 @@ _outHashPath(StringInfo str, HashPath *node)
* For now, i'll just print the addresses. * For now, i'll just print the addresses.
*/ */
sprintf(buf, " :outerjoinpath @ 0x%x ", (int) (node->jpath.outerjoinpath)); appendStringInfo(str,
appendStringInfo(str, buf); " :outerjoinpath @ 0x%x :innerjoinpath @ 0x%x :outerjoincost %f :joinid ",
sprintf(buf, " :innerjoinpath @ 0x%x ", (int) (node->jpath.innerjoinpath)); (int) node->jpath.outerjoinpath,
appendStringInfo(str, buf); (int) node->jpath.innerjoinpath,
node->jpath.path.outerjoincost);
sprintf(buf, " :outerjoincost %f ", node->jpath.path.outerjoincost);
appendStringInfo(str, buf);
appendStringInfo(str, " :joinid ");
_outIntList(str, node->jpath.path.joinid); _outIntList(str, node->jpath.path.joinid);
appendStringInfo(str, " :path_hashclauses "); appendStringInfo(str, " :path_hashclauses ");
...@@ -1188,7 +1026,6 @@ _outHashPath(StringInfo str, HashPath *node) ...@@ -1188,7 +1026,6 @@ _outHashPath(StringInfo str, HashPath *node)
appendStringInfo(str, " :innerhashkeys "); appendStringInfo(str, " :innerhashkeys ");
_outNode(str, node->innerhashkeys); _outNode(str, node->innerhashkeys);
} }
/* /*
...@@ -1197,14 +1034,10 @@ _outHashPath(StringInfo str, HashPath *node) ...@@ -1197,14 +1034,10 @@ _outHashPath(StringInfo str, HashPath *node)
static void static void
_outOrderKey(StringInfo str, OrderKey *node) _outOrderKey(StringInfo str, OrderKey *node)
{ {
char buf[500]; appendStringInfo(str,
" ORDERKEY :attribute_number %d :array_index %d ",
appendStringInfo(str, " ORDERKEY "); node->attribute_number,
sprintf(buf, " :attribute_number %d ", node->attribute_number); node->array_index);
appendStringInfo(str, buf);
sprintf(buf, " :array_index %d ", node->array_index);
appendStringInfo(str, buf);
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment