1 /*-------------------------------------------------------------------------
4 * Output functions for Postgres tree nodes.
6 * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
11 * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.244 2004/12/11 23:26:33 tgl Exp $
14 * Every node type that can appear in stored rules' parsetrees *must*
15 * have an output function defined here (as well as an input function
16 * in readfuncs.c). For use in debugging, we also provide output
17 * functions for nodes that appear in raw parsetrees, path, and plan trees.
18 * These nodes however need not have input functions.
20 *-------------------------------------------------------------------------
26 #include "lib/stringinfo.h"
27 #include "nodes/parsenodes.h"
28 #include "nodes/plannodes.h"
29 #include "nodes/relation.h"
30 #include "utils/datum.h"
34 * Macros to simplify output of different kinds of fields. Use these
35 * wherever possible to reduce the chance for silly typos. Note that these
36 * hard-wire conventions about the names of the local variables in an Out
40 /* Write the label for the node type */
41 #define WRITE_NODE_TYPE(nodelabel) \
42 appendStringInfoString(str, nodelabel)
44 /* Write an integer field (anything written as ":fldname %d") */
45 #define WRITE_INT_FIELD(fldname) \
46 appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
48 /* Write an unsigned integer field (anything written as ":fldname %u") */
49 #define WRITE_UINT_FIELD(fldname) \
50 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
52 /* Write an OID field (don't hard-wire assumption that OID is same as uint) */
53 #define WRITE_OID_FIELD(fldname) \
54 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
56 /* Write a long-integer field */
57 #define WRITE_LONG_FIELD(fldname) \
58 appendStringInfo(str, " :" CppAsString(fldname) " %ld", node->fldname)
60 /* Write a char field (ie, one ascii character) */
61 #define WRITE_CHAR_FIELD(fldname) \
62 appendStringInfo(str, " :" CppAsString(fldname) " %c", node->fldname)
64 /* Write an enumerated-type field as an integer code */
65 #define WRITE_ENUM_FIELD(fldname, enumtype) \
66 appendStringInfo(str, " :" CppAsString(fldname) " %d", \
69 /* Write a float field --- caller must give format to define precision */
70 #define WRITE_FLOAT_FIELD(fldname,format) \
71 appendStringInfo(str, " :" CppAsString(fldname) " " format, node->fldname)
73 /* Write a boolean field */
74 #define WRITE_BOOL_FIELD(fldname) \
75 appendStringInfo(str, " :" CppAsString(fldname) " %s", \
76 booltostr(node->fldname))
78 /* Write a character-string (possibly NULL) field */
79 #define WRITE_STRING_FIELD(fldname) \
80 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
81 _outToken(str, node->fldname))
83 /* Write a Node field */
84 #define WRITE_NODE_FIELD(fldname) \
85 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
86 _outNode(str, node->fldname))
88 /* Write a bitmapset field */
89 #define WRITE_BITMAPSET_FIELD(fldname) \
90 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
91 _outBitmapset(str, node->fldname))
94 #define booltostr(x) ((x) ? "true" : "false")
96 static void _outNode(StringInfo str, void *obj);
101 * Convert an ordinary string (eg, an identifier) into a form that
102 * will be decoded back to a plain token by read.c's functions.
104 * If a null or empty string is given, it is encoded as "<>".
107 _outToken(StringInfo str, char *s)
109 if (s == NULL || *s == '\0')
111 appendStringInfo(str, "<>");
116 * Look for characters or patterns that are treated specially by
117 * read.c (either in pg_strtok() or in nodeRead()), and therefore need
118 * a protective backslash.
120 /* These characters only need to be quoted at the start of the string */
123 isdigit((unsigned char) *s) ||
124 ((*s == '+' || *s == '-') &&
125 (isdigit((unsigned char) s[1]) || s[1] == '.')))
126 appendStringInfoChar(str, '\\');
129 /* These chars must be backslashed anywhere in the string */
130 if (*s == ' ' || *s == '\n' || *s == '\t' ||
131 *s == '(' || *s == ')' || *s == '{' || *s == '}' ||
133 appendStringInfoChar(str, '\\');
134 appendStringInfoChar(str, *s++);
139 _outList(StringInfo str, List *node)
143 appendStringInfoChar(str, '(');
145 if (IsA(node, IntList))
146 appendStringInfoChar(str, 'i');
147 else if (IsA(node, OidList))
148 appendStringInfoChar(str, 'o');
153 * For the sake of backward compatibility, we emit a slightly
154 * different whitespace format for lists of nodes vs. other types
155 * of lists. XXX: is this necessary?
159 _outNode(str, lfirst(lc));
161 appendStringInfoChar(str, ' ');
163 else if (IsA(node, IntList))
164 appendStringInfo(str, " %d", lfirst_int(lc));
165 else if (IsA(node, OidList))
166 appendStringInfo(str, " %u", lfirst_oid(lc));
168 elog(ERROR, "unrecognized list node type: %d",
172 appendStringInfoChar(str, ')');
177 * converts a bitmap set of integers
179 * Note: the output format is "(b int int ...)", similar to an integer List.
180 * Currently bitmapsets do not appear in any node type that is stored in
181 * rules, so there is no support in readfuncs.c for reading this format.
184 _outBitmapset(StringInfo str, Bitmapset *bms)
189 appendStringInfoChar(str, '(');
190 appendStringInfoChar(str, 'b');
191 tmpset = bms_copy(bms);
192 while ((x = bms_first_member(tmpset)) >= 0)
193 appendStringInfo(str, " %d", x);
195 appendStringInfoChar(str, ')');
199 * Print the value of a Datum given its type.
202 _outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
208 length = datumGetSize(value, typbyval, typlen);
212 s = (char *) (&value);
213 appendStringInfo(str, "%u [ ", (unsigned int) length);
214 for (i = 0; i < (Size) sizeof(Datum); i++)
215 appendStringInfo(str, "%d ", (int) (s[i]));
216 appendStringInfo(str, "]");
220 s = (char *) DatumGetPointer(value);
221 if (!PointerIsValid(s))
222 appendStringInfo(str, "0 [ ]");
225 appendStringInfo(str, "%u [ ", (unsigned int) length);
226 for (i = 0; i < length; i++)
227 appendStringInfo(str, "%d ", (int) (s[i]));
228 appendStringInfo(str, "]");
235 * Stuff from plannodes.h
239 * print the basic stuff of all nodes that inherit from Plan
242 _outPlanInfo(StringInfo str, Plan *node)
244 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
245 WRITE_FLOAT_FIELD(total_cost, "%.2f");
246 WRITE_FLOAT_FIELD(plan_rows, "%.0f");
247 WRITE_INT_FIELD(plan_width);
248 WRITE_NODE_FIELD(targetlist);
249 WRITE_NODE_FIELD(qual);
250 WRITE_NODE_FIELD(lefttree);
251 WRITE_NODE_FIELD(righttree);
252 WRITE_NODE_FIELD(initPlan);
253 WRITE_BITMAPSET_FIELD(extParam);
254 WRITE_BITMAPSET_FIELD(allParam);
255 WRITE_INT_FIELD(nParamExec);
259 * print the basic stuff of all nodes that inherit from Scan
262 _outScanInfo(StringInfo str, Scan *node)
264 _outPlanInfo(str, (Plan *) node);
266 WRITE_UINT_FIELD(scanrelid);
270 * print the basic stuff of all nodes that inherit from Join
273 _outJoinPlanInfo(StringInfo str, Join *node)
275 _outPlanInfo(str, (Plan *) node);
277 WRITE_ENUM_FIELD(jointype, JoinType);
278 WRITE_NODE_FIELD(joinqual);
283 _outPlan(StringInfo str, Plan *node)
285 WRITE_NODE_TYPE("PLAN");
287 _outPlanInfo(str, (Plan *) node);
291 _outResult(StringInfo str, Result *node)
293 WRITE_NODE_TYPE("RESULT");
295 _outPlanInfo(str, (Plan *) node);
297 WRITE_NODE_FIELD(resconstantqual);
301 _outAppend(StringInfo str, Append *node)
303 WRITE_NODE_TYPE("APPEND");
305 _outPlanInfo(str, (Plan *) node);
307 WRITE_NODE_FIELD(appendplans);
308 WRITE_BOOL_FIELD(isTarget);
312 _outScan(StringInfo str, Scan *node)
314 WRITE_NODE_TYPE("SCAN");
316 _outScanInfo(str, (Scan *) node);
320 _outSeqScan(StringInfo str, SeqScan *node)
322 WRITE_NODE_TYPE("SEQSCAN");
324 _outScanInfo(str, (Scan *) node);
328 _outIndexScan(StringInfo str, IndexScan *node)
330 WRITE_NODE_TYPE("INDEXSCAN");
332 _outScanInfo(str, (Scan *) node);
334 WRITE_NODE_FIELD(indxid);
335 WRITE_NODE_FIELD(indxqual);
336 WRITE_NODE_FIELD(indxqualorig);
337 WRITE_NODE_FIELD(indxstrategy);
338 WRITE_NODE_FIELD(indxsubtype);
339 WRITE_NODE_FIELD(indxlossy);
340 WRITE_ENUM_FIELD(indxorderdir, ScanDirection);
344 _outTidScan(StringInfo str, TidScan *node)
346 WRITE_NODE_TYPE("TIDSCAN");
348 _outScanInfo(str, (Scan *) node);
350 WRITE_NODE_FIELD(tideval);
354 _outSubqueryScan(StringInfo str, SubqueryScan *node)
356 WRITE_NODE_TYPE("SUBQUERYSCAN");
358 _outScanInfo(str, (Scan *) node);
360 WRITE_NODE_FIELD(subplan);
364 _outFunctionScan(StringInfo str, FunctionScan *node)
366 WRITE_NODE_TYPE("FUNCTIONSCAN");
368 _outScanInfo(str, (Scan *) node);
372 _outJoin(StringInfo str, Join *node)
374 WRITE_NODE_TYPE("JOIN");
376 _outJoinPlanInfo(str, (Join *) node);
380 _outNestLoop(StringInfo str, NestLoop *node)
382 WRITE_NODE_TYPE("NESTLOOP");
384 _outJoinPlanInfo(str, (Join *) node);
388 _outMergeJoin(StringInfo str, MergeJoin *node)
390 WRITE_NODE_TYPE("MERGEJOIN");
392 _outJoinPlanInfo(str, (Join *) node);
394 WRITE_NODE_FIELD(mergeclauses);
398 _outHashJoin(StringInfo str, HashJoin *node)
400 WRITE_NODE_TYPE("HASHJOIN");
402 _outJoinPlanInfo(str, (Join *) node);
404 WRITE_NODE_FIELD(hashclauses);
408 _outAgg(StringInfo str, Agg *node)
410 WRITE_NODE_TYPE("AGG");
412 _outPlanInfo(str, (Plan *) node);
414 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
415 WRITE_INT_FIELD(numCols);
416 WRITE_LONG_FIELD(numGroups);
420 _outGroup(StringInfo str, Group *node)
424 WRITE_NODE_TYPE("GROUP");
426 _outPlanInfo(str, (Plan *) node);
428 WRITE_INT_FIELD(numCols);
430 appendStringInfo(str, " :grpColIdx");
431 for (i = 0; i < node->numCols; i++)
432 appendStringInfo(str, " %d", node->grpColIdx[i]);
436 _outMaterial(StringInfo str, Material *node)
438 WRITE_NODE_TYPE("MATERIAL");
440 _outPlanInfo(str, (Plan *) node);
444 _outSort(StringInfo str, Sort *node)
448 WRITE_NODE_TYPE("SORT");
450 _outPlanInfo(str, (Plan *) node);
452 WRITE_INT_FIELD(numCols);
454 appendStringInfo(str, " :sortColIdx");
455 for (i = 0; i < node->numCols; i++)
456 appendStringInfo(str, " %d", node->sortColIdx[i]);
458 appendStringInfo(str, " :sortOperators");
459 for (i = 0; i < node->numCols; i++)
460 appendStringInfo(str, " %u", node->sortOperators[i]);
464 _outUnique(StringInfo str, Unique *node)
468 WRITE_NODE_TYPE("UNIQUE");
470 _outPlanInfo(str, (Plan *) node);
472 WRITE_INT_FIELD(numCols);
474 appendStringInfo(str, " :uniqColIdx");
475 for (i = 0; i < node->numCols; i++)
476 appendStringInfo(str, " %d", node->uniqColIdx[i]);
480 _outSetOp(StringInfo str, SetOp *node)
484 WRITE_NODE_TYPE("SETOP");
486 _outPlanInfo(str, (Plan *) node);
488 WRITE_ENUM_FIELD(cmd, SetOpCmd);
489 WRITE_INT_FIELD(numCols);
491 appendStringInfo(str, " :dupColIdx");
492 for (i = 0; i < node->numCols; i++)
493 appendStringInfo(str, " %d", node->dupColIdx[i]);
495 WRITE_INT_FIELD(flagColIdx);
499 _outLimit(StringInfo str, Limit *node)
501 WRITE_NODE_TYPE("LIMIT");
503 _outPlanInfo(str, (Plan *) node);
505 WRITE_NODE_FIELD(limitOffset);
506 WRITE_NODE_FIELD(limitCount);
510 _outHash(StringInfo str, Hash *node)
512 WRITE_NODE_TYPE("HASH");
514 _outPlanInfo(str, (Plan *) node);
517 /*****************************************************************************
519 * Stuff from primnodes.h.
521 *****************************************************************************/
524 _outResdom(StringInfo str, Resdom *node)
526 WRITE_NODE_TYPE("RESDOM");
528 WRITE_INT_FIELD(resno);
529 WRITE_OID_FIELD(restype);
530 WRITE_INT_FIELD(restypmod);
531 WRITE_STRING_FIELD(resname);
532 WRITE_UINT_FIELD(ressortgroupref);
533 WRITE_OID_FIELD(resorigtbl);
534 WRITE_INT_FIELD(resorigcol);
535 WRITE_BOOL_FIELD(resjunk);
539 _outAlias(StringInfo str, Alias *node)
541 WRITE_NODE_TYPE("ALIAS");
543 WRITE_STRING_FIELD(aliasname);
544 WRITE_NODE_FIELD(colnames);
548 _outRangeVar(StringInfo str, RangeVar *node)
550 WRITE_NODE_TYPE("RANGEVAR");
553 * we deliberately ignore catalogname here, since it is presently not
554 * semantically meaningful
556 WRITE_STRING_FIELD(schemaname);
557 WRITE_STRING_FIELD(relname);
558 WRITE_ENUM_FIELD(inhOpt, InhOption);
559 WRITE_BOOL_FIELD(istemp);
560 WRITE_NODE_FIELD(alias);
564 _outVar(StringInfo str, Var *node)
566 WRITE_NODE_TYPE("VAR");
568 WRITE_UINT_FIELD(varno);
569 WRITE_INT_FIELD(varattno);
570 WRITE_OID_FIELD(vartype);
571 WRITE_INT_FIELD(vartypmod);
572 WRITE_UINT_FIELD(varlevelsup);
573 WRITE_UINT_FIELD(varnoold);
574 WRITE_INT_FIELD(varoattno);
578 _outConst(StringInfo str, Const *node)
580 WRITE_NODE_TYPE("CONST");
582 WRITE_OID_FIELD(consttype);
583 WRITE_INT_FIELD(constlen);
584 WRITE_BOOL_FIELD(constbyval);
585 WRITE_BOOL_FIELD(constisnull);
587 appendStringInfo(str, " :constvalue ");
588 if (node->constisnull)
589 appendStringInfo(str, "<>");
591 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
595 _outParam(StringInfo str, Param *node)
597 WRITE_NODE_TYPE("PARAM");
599 WRITE_INT_FIELD(paramkind);
600 WRITE_INT_FIELD(paramid);
601 WRITE_STRING_FIELD(paramname);
602 WRITE_OID_FIELD(paramtype);
606 _outAggref(StringInfo str, Aggref *node)
608 WRITE_NODE_TYPE("AGGREF");
610 WRITE_OID_FIELD(aggfnoid);
611 WRITE_OID_FIELD(aggtype);
612 WRITE_NODE_FIELD(target);
613 WRITE_UINT_FIELD(agglevelsup);
614 WRITE_BOOL_FIELD(aggstar);
615 WRITE_BOOL_FIELD(aggdistinct);
619 _outArrayRef(StringInfo str, ArrayRef *node)
621 WRITE_NODE_TYPE("ARRAYREF");
623 WRITE_OID_FIELD(refrestype);
624 WRITE_OID_FIELD(refarraytype);
625 WRITE_OID_FIELD(refelemtype);
626 WRITE_NODE_FIELD(refupperindexpr);
627 WRITE_NODE_FIELD(reflowerindexpr);
628 WRITE_NODE_FIELD(refexpr);
629 WRITE_NODE_FIELD(refassgnexpr);
633 _outFuncExpr(StringInfo str, FuncExpr *node)
635 WRITE_NODE_TYPE("FUNCEXPR");
637 WRITE_OID_FIELD(funcid);
638 WRITE_OID_FIELD(funcresulttype);
639 WRITE_BOOL_FIELD(funcretset);
640 WRITE_ENUM_FIELD(funcformat, CoercionForm);
641 WRITE_NODE_FIELD(args);
645 _outOpExpr(StringInfo str, OpExpr *node)
647 WRITE_NODE_TYPE("OPEXPR");
649 WRITE_OID_FIELD(opno);
650 WRITE_OID_FIELD(opfuncid);
651 WRITE_OID_FIELD(opresulttype);
652 WRITE_BOOL_FIELD(opretset);
653 WRITE_NODE_FIELD(args);
657 _outDistinctExpr(StringInfo str, DistinctExpr *node)
659 WRITE_NODE_TYPE("DISTINCTEXPR");
661 WRITE_OID_FIELD(opno);
662 WRITE_OID_FIELD(opfuncid);
663 WRITE_OID_FIELD(opresulttype);
664 WRITE_BOOL_FIELD(opretset);
665 WRITE_NODE_FIELD(args);
669 _outScalarArrayOpExpr(StringInfo str, ScalarArrayOpExpr *node)
671 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
673 WRITE_OID_FIELD(opno);
674 WRITE_OID_FIELD(opfuncid);
675 WRITE_BOOL_FIELD(useOr);
676 WRITE_NODE_FIELD(args);
680 _outBoolExpr(StringInfo str, BoolExpr *node)
684 WRITE_NODE_TYPE("BOOLEXPR");
686 /* do-it-yourself enum representation */
687 switch (node->boolop)
699 appendStringInfo(str, " :boolop ");
700 _outToken(str, opstr);
702 WRITE_NODE_FIELD(args);
706 _outSubLink(StringInfo str, SubLink *node)
708 WRITE_NODE_TYPE("SUBLINK");
710 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
711 WRITE_BOOL_FIELD(useOr);
712 WRITE_NODE_FIELD(lefthand);
713 WRITE_NODE_FIELD(operName);
714 WRITE_NODE_FIELD(operOids);
715 WRITE_NODE_FIELD(subselect);
719 _outSubPlan(StringInfo str, SubPlan *node)
721 WRITE_NODE_TYPE("SUBPLAN");
723 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
724 WRITE_BOOL_FIELD(useOr);
725 WRITE_NODE_FIELD(exprs);
726 WRITE_NODE_FIELD(paramIds);
727 WRITE_NODE_FIELD(plan);
728 WRITE_INT_FIELD(plan_id);
729 WRITE_NODE_FIELD(rtable);
730 WRITE_BOOL_FIELD(useHashTable);
731 WRITE_BOOL_FIELD(unknownEqFalse);
732 WRITE_NODE_FIELD(setParam);
733 WRITE_NODE_FIELD(parParam);
734 WRITE_NODE_FIELD(args);
738 _outFieldSelect(StringInfo str, FieldSelect *node)
740 WRITE_NODE_TYPE("FIELDSELECT");
742 WRITE_NODE_FIELD(arg);
743 WRITE_INT_FIELD(fieldnum);
744 WRITE_OID_FIELD(resulttype);
745 WRITE_INT_FIELD(resulttypmod);
749 _outFieldStore(StringInfo str, FieldStore *node)
751 WRITE_NODE_TYPE("FIELDSTORE");
753 WRITE_NODE_FIELD(arg);
754 WRITE_NODE_FIELD(newvals);
755 WRITE_NODE_FIELD(fieldnums);
756 WRITE_OID_FIELD(resulttype);
760 _outRelabelType(StringInfo str, RelabelType *node)
762 WRITE_NODE_TYPE("RELABELTYPE");
764 WRITE_NODE_FIELD(arg);
765 WRITE_OID_FIELD(resulttype);
766 WRITE_INT_FIELD(resulttypmod);
767 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
771 _outConvertRowtypeExpr(StringInfo str, ConvertRowtypeExpr *node)
773 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
775 WRITE_NODE_FIELD(arg);
776 WRITE_OID_FIELD(resulttype);
777 WRITE_ENUM_FIELD(convertformat, CoercionForm);
781 _outCaseExpr(StringInfo str, CaseExpr *node)
783 WRITE_NODE_TYPE("CASE");
785 WRITE_OID_FIELD(casetype);
786 WRITE_NODE_FIELD(arg);
787 WRITE_NODE_FIELD(args);
788 WRITE_NODE_FIELD(defresult);
792 _outCaseWhen(StringInfo str, CaseWhen *node)
794 WRITE_NODE_TYPE("WHEN");
796 WRITE_NODE_FIELD(expr);
797 WRITE_NODE_FIELD(result);
801 _outCaseTestExpr(StringInfo str, CaseTestExpr *node)
803 WRITE_NODE_TYPE("CASETESTEXPR");
805 WRITE_OID_FIELD(typeId);
806 WRITE_INT_FIELD(typeMod);
810 _outArrayExpr(StringInfo str, ArrayExpr *node)
812 WRITE_NODE_TYPE("ARRAY");
814 WRITE_OID_FIELD(array_typeid);
815 WRITE_OID_FIELD(element_typeid);
816 WRITE_NODE_FIELD(elements);
817 WRITE_BOOL_FIELD(multidims);
821 _outRowExpr(StringInfo str, RowExpr *node)
823 WRITE_NODE_TYPE("ROW");
825 WRITE_NODE_FIELD(args);
826 WRITE_OID_FIELD(row_typeid);
827 WRITE_ENUM_FIELD(row_format, CoercionForm);
831 _outCoalesceExpr(StringInfo str, CoalesceExpr *node)
833 WRITE_NODE_TYPE("COALESCE");
835 WRITE_OID_FIELD(coalescetype);
836 WRITE_NODE_FIELD(args);
840 _outNullIfExpr(StringInfo str, NullIfExpr *node)
842 WRITE_NODE_TYPE("NULLIFEXPR");
844 WRITE_OID_FIELD(opno);
845 WRITE_OID_FIELD(opfuncid);
846 WRITE_OID_FIELD(opresulttype);
847 WRITE_BOOL_FIELD(opretset);
848 WRITE_NODE_FIELD(args);
852 _outNullTest(StringInfo str, NullTest *node)
854 WRITE_NODE_TYPE("NULLTEST");
856 WRITE_NODE_FIELD(arg);
857 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
861 _outBooleanTest(StringInfo str, BooleanTest *node)
863 WRITE_NODE_TYPE("BOOLEANTEST");
865 WRITE_NODE_FIELD(arg);
866 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
870 _outCoerceToDomain(StringInfo str, CoerceToDomain *node)
872 WRITE_NODE_TYPE("COERCETODOMAIN");
874 WRITE_NODE_FIELD(arg);
875 WRITE_OID_FIELD(resulttype);
876 WRITE_INT_FIELD(resulttypmod);
877 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
881 _outCoerceToDomainValue(StringInfo str, CoerceToDomainValue *node)
883 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
885 WRITE_OID_FIELD(typeId);
886 WRITE_INT_FIELD(typeMod);
890 _outSetToDefault(StringInfo str, SetToDefault *node)
892 WRITE_NODE_TYPE("SETTODEFAULT");
894 WRITE_OID_FIELD(typeId);
895 WRITE_INT_FIELD(typeMod);
899 _outTargetEntry(StringInfo str, TargetEntry *node)
901 WRITE_NODE_TYPE("TARGETENTRY");
903 WRITE_NODE_FIELD(resdom);
904 WRITE_NODE_FIELD(expr);
908 _outRangeTblRef(StringInfo str, RangeTblRef *node)
910 WRITE_NODE_TYPE("RANGETBLREF");
912 WRITE_INT_FIELD(rtindex);
916 _outJoinExpr(StringInfo str, JoinExpr *node)
918 WRITE_NODE_TYPE("JOINEXPR");
920 WRITE_ENUM_FIELD(jointype, JoinType);
921 WRITE_BOOL_FIELD(isNatural);
922 WRITE_NODE_FIELD(larg);
923 WRITE_NODE_FIELD(rarg);
924 WRITE_NODE_FIELD(using);
925 WRITE_NODE_FIELD(quals);
926 WRITE_NODE_FIELD(alias);
927 WRITE_INT_FIELD(rtindex);
931 _outFromExpr(StringInfo str, FromExpr *node)
933 WRITE_NODE_TYPE("FROMEXPR");
935 WRITE_NODE_FIELD(fromlist);
936 WRITE_NODE_FIELD(quals);
939 /*****************************************************************************
941 * Stuff from relation.h.
943 *****************************************************************************/
946 * print the basic stuff of all nodes that inherit from Path
948 * Note we do NOT print the parent, else we'd be in infinite recursion
951 _outPathInfo(StringInfo str, Path *node)
953 WRITE_ENUM_FIELD(pathtype, NodeTag);
954 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
955 WRITE_FLOAT_FIELD(total_cost, "%.2f");
956 WRITE_NODE_FIELD(pathkeys);
960 * print the basic stuff of all nodes that inherit from JoinPath
963 _outJoinPathInfo(StringInfo str, JoinPath *node)
965 _outPathInfo(str, (Path *) node);
967 WRITE_ENUM_FIELD(jointype, JoinType);
968 WRITE_NODE_FIELD(outerjoinpath);
969 WRITE_NODE_FIELD(innerjoinpath);
970 WRITE_NODE_FIELD(joinrestrictinfo);
974 _outPath(StringInfo str, Path *node)
976 WRITE_NODE_TYPE("PATH");
978 _outPathInfo(str, (Path *) node);
982 * IndexPath is a subclass of Path.
985 _outIndexPath(StringInfo str, IndexPath *node)
987 WRITE_NODE_TYPE("INDEXPATH");
989 _outPathInfo(str, (Path *) node);
991 WRITE_NODE_FIELD(indexinfo);
992 WRITE_NODE_FIELD(indexclauses);
993 WRITE_NODE_FIELD(indexquals);
994 WRITE_BOOL_FIELD(isjoininner);
995 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
996 WRITE_FLOAT_FIELD(rows, "%.0f");
1000 _outTidPath(StringInfo str, TidPath *node)
1002 WRITE_NODE_TYPE("TIDPATH");
1004 _outPathInfo(str, (Path *) node);
1006 WRITE_NODE_FIELD(tideval);
1010 _outAppendPath(StringInfo str, AppendPath *node)
1012 WRITE_NODE_TYPE("APPENDPATH");
1014 _outPathInfo(str, (Path *) node);
1016 WRITE_NODE_FIELD(subpaths);
1020 _outResultPath(StringInfo str, ResultPath *node)
1022 WRITE_NODE_TYPE("RESULTPATH");
1024 _outPathInfo(str, (Path *) node);
1026 WRITE_NODE_FIELD(subpath);
1027 WRITE_NODE_FIELD(constantqual);
1031 _outMaterialPath(StringInfo str, MaterialPath *node)
1033 WRITE_NODE_TYPE("MATERIALPATH");
1035 _outPathInfo(str, (Path *) node);
1037 WRITE_NODE_FIELD(subpath);
1041 _outUniquePath(StringInfo str, UniquePath *node)
1043 WRITE_NODE_TYPE("UNIQUEPATH");
1045 _outPathInfo(str, (Path *) node);
1047 WRITE_NODE_FIELD(subpath);
1048 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1049 WRITE_FLOAT_FIELD(rows, "%.0f");
1053 _outNestPath(StringInfo str, NestPath *node)
1055 WRITE_NODE_TYPE("NESTPATH");
1057 _outJoinPathInfo(str, (JoinPath *) node);
1061 _outMergePath(StringInfo str, MergePath *node)
1063 WRITE_NODE_TYPE("MERGEPATH");
1065 _outJoinPathInfo(str, (JoinPath *) node);
1067 WRITE_NODE_FIELD(path_mergeclauses);
1068 WRITE_NODE_FIELD(outersortkeys);
1069 WRITE_NODE_FIELD(innersortkeys);
1073 _outHashPath(StringInfo str, HashPath *node)
1075 WRITE_NODE_TYPE("HASHPATH");
1077 _outJoinPathInfo(str, (JoinPath *) node);
1079 WRITE_NODE_FIELD(path_hashclauses);
1083 _outPathKeyItem(StringInfo str, PathKeyItem *node)
1085 WRITE_NODE_TYPE("PATHKEYITEM");
1087 WRITE_NODE_FIELD(key);
1088 WRITE_OID_FIELD(sortop);
1092 _outRestrictInfo(StringInfo str, RestrictInfo *node)
1094 WRITE_NODE_TYPE("RESTRICTINFO");
1096 /* NB: this isn't a complete set of fields */
1097 WRITE_NODE_FIELD(clause);
1098 WRITE_BOOL_FIELD(is_pushed_down);
1099 WRITE_BOOL_FIELD(valid_everywhere);
1100 WRITE_BOOL_FIELD(can_join);
1101 WRITE_BITMAPSET_FIELD(clause_relids);
1102 WRITE_BITMAPSET_FIELD(left_relids);
1103 WRITE_BITMAPSET_FIELD(right_relids);
1104 WRITE_NODE_FIELD(orclause);
1105 WRITE_OID_FIELD(mergejoinoperator);
1106 WRITE_OID_FIELD(left_sortop);
1107 WRITE_OID_FIELD(right_sortop);
1108 WRITE_NODE_FIELD(left_pathkey);
1109 WRITE_NODE_FIELD(right_pathkey);
1110 WRITE_OID_FIELD(hashjoinoperator);
1114 _outJoinInfo(StringInfo str, JoinInfo *node)
1116 WRITE_NODE_TYPE("JOININFO");
1118 WRITE_BITMAPSET_FIELD(unjoined_relids);
1119 WRITE_NODE_FIELD(jinfo_restrictinfo);
1123 _outInClauseInfo(StringInfo str, InClauseInfo *node)
1125 WRITE_NODE_TYPE("INCLAUSEINFO");
1127 WRITE_BITMAPSET_FIELD(lefthand);
1128 WRITE_BITMAPSET_FIELD(righthand);
1129 WRITE_NODE_FIELD(sub_targetlist);
1132 /*****************************************************************************
1134 * Stuff from parsenodes.h.
1136 *****************************************************************************/
1139 _outCreateStmt(StringInfo str, CreateStmt *node)
1141 WRITE_NODE_TYPE("CREATESTMT");
1143 WRITE_NODE_FIELD(relation);
1144 WRITE_NODE_FIELD(tableElts);
1145 WRITE_NODE_FIELD(inhRelations);
1146 WRITE_NODE_FIELD(constraints);
1147 WRITE_ENUM_FIELD(hasoids, ContainsOids);
1148 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
1149 WRITE_STRING_FIELD(tablespacename);
1153 _outIndexStmt(StringInfo str, IndexStmt *node)
1155 WRITE_NODE_TYPE("INDEXSTMT");
1157 WRITE_STRING_FIELD(idxname);
1158 WRITE_NODE_FIELD(relation);
1159 WRITE_STRING_FIELD(accessMethod);
1160 WRITE_STRING_FIELD(tableSpace);
1161 WRITE_NODE_FIELD(indexParams);
1162 WRITE_NODE_FIELD(whereClause);
1163 WRITE_NODE_FIELD(rangetable);
1164 WRITE_BOOL_FIELD(unique);
1165 WRITE_BOOL_FIELD(primary);
1166 WRITE_BOOL_FIELD(isconstraint);
1170 _outNotifyStmt(StringInfo str, NotifyStmt *node)
1172 WRITE_NODE_TYPE("NOTIFY");
1174 WRITE_NODE_FIELD(relation);
1178 _outDeclareCursorStmt(StringInfo str, DeclareCursorStmt *node)
1180 WRITE_NODE_TYPE("DECLARECURSOR");
1182 WRITE_STRING_FIELD(portalname);
1183 WRITE_INT_FIELD(options);
1184 WRITE_NODE_FIELD(query);
1188 _outSelectStmt(StringInfo str, SelectStmt *node)
1190 WRITE_NODE_TYPE("SELECT");
1192 WRITE_NODE_FIELD(whereClause);
1193 WRITE_NODE_FIELD(distinctClause);
1194 WRITE_NODE_FIELD(into);
1195 WRITE_NODE_FIELD(intoColNames);
1196 WRITE_ENUM_FIELD(intoHasOids, ContainsOids);
1197 WRITE_NODE_FIELD(targetList);
1198 WRITE_NODE_FIELD(fromClause);
1199 WRITE_NODE_FIELD(whereClause);
1200 WRITE_NODE_FIELD(groupClause);
1201 WRITE_NODE_FIELD(havingClause);
1202 WRITE_NODE_FIELD(sortClause);
1203 WRITE_NODE_FIELD(limitOffset);
1204 WRITE_NODE_FIELD(limitCount);
1205 WRITE_NODE_FIELD(forUpdate);
1206 WRITE_ENUM_FIELD(op, SetOperation);
1207 WRITE_BOOL_FIELD(all);
1208 WRITE_NODE_FIELD(larg);
1209 WRITE_NODE_FIELD(rarg);
1213 _outFuncCall(StringInfo str, FuncCall *node)
1215 WRITE_NODE_TYPE("FUNCCALL");
1217 WRITE_NODE_FIELD(funcname);
1218 WRITE_NODE_FIELD(args);
1219 WRITE_BOOL_FIELD(agg_star);
1220 WRITE_BOOL_FIELD(agg_distinct);
1224 _outDefElem(StringInfo str, DefElem *node)
1226 WRITE_NODE_TYPE("DEFELEM");
1228 WRITE_STRING_FIELD(defname);
1229 WRITE_NODE_FIELD(arg);
1233 _outColumnDef(StringInfo str, ColumnDef *node)
1235 WRITE_NODE_TYPE("COLUMNDEF");
1237 WRITE_STRING_FIELD(colname);
1238 WRITE_NODE_FIELD(typename);
1239 WRITE_INT_FIELD(inhcount);
1240 WRITE_BOOL_FIELD(is_local);
1241 WRITE_BOOL_FIELD(is_not_null);
1242 WRITE_NODE_FIELD(raw_default);
1243 WRITE_STRING_FIELD(cooked_default);
1244 WRITE_NODE_FIELD(constraints);
1245 WRITE_NODE_FIELD(support);
1249 _outTypeName(StringInfo str, TypeName *node)
1251 WRITE_NODE_TYPE("TYPENAME");
1253 WRITE_NODE_FIELD(names);
1254 WRITE_OID_FIELD(typeid);
1255 WRITE_BOOL_FIELD(timezone);
1256 WRITE_BOOL_FIELD(setof);
1257 WRITE_BOOL_FIELD(pct_type);
1258 WRITE_INT_FIELD(typmod);
1259 WRITE_NODE_FIELD(arrayBounds);
1263 _outTypeCast(StringInfo str, TypeCast *node)
1265 WRITE_NODE_TYPE("TYPECAST");
1267 WRITE_NODE_FIELD(arg);
1268 WRITE_NODE_FIELD(typename);
1272 _outIndexElem(StringInfo str, IndexElem *node)
1274 WRITE_NODE_TYPE("INDEXELEM");
1276 WRITE_STRING_FIELD(name);
1277 WRITE_NODE_FIELD(expr);
1278 WRITE_NODE_FIELD(opclass);
1282 _outQuery(StringInfo str, Query *node)
1284 WRITE_NODE_TYPE("QUERY");
1286 WRITE_ENUM_FIELD(commandType, CmdType);
1287 WRITE_ENUM_FIELD(querySource, QuerySource);
1288 WRITE_BOOL_FIELD(canSetTag);
1291 * Hack to work around missing outfuncs routines for a lot of the
1292 * utility-statement node types. (The only one we actually *need* for
1293 * rules support is NotifyStmt.) Someday we ought to support 'em all,
1294 * but for the meantime do this to avoid getting lots of warnings when
1295 * running with debug_print_parse on.
1297 if (node->utilityStmt)
1299 switch (nodeTag(node->utilityStmt))
1304 case T_DeclareCursorStmt:
1305 WRITE_NODE_FIELD(utilityStmt);
1308 appendStringInfo(str, " :utilityStmt ?");
1313 appendStringInfo(str, " :utilityStmt <>");
1315 WRITE_INT_FIELD(resultRelation);
1316 WRITE_NODE_FIELD(into);
1317 WRITE_BOOL_FIELD(hasAggs);
1318 WRITE_BOOL_FIELD(hasSubLinks);
1319 WRITE_NODE_FIELD(rtable);
1320 WRITE_NODE_FIELD(jointree);
1321 WRITE_NODE_FIELD(rowMarks);
1322 WRITE_NODE_FIELD(targetList);
1323 WRITE_NODE_FIELD(groupClause);
1324 WRITE_NODE_FIELD(havingQual);
1325 WRITE_NODE_FIELD(distinctClause);
1326 WRITE_NODE_FIELD(sortClause);
1327 WRITE_NODE_FIELD(limitOffset);
1328 WRITE_NODE_FIELD(limitCount);
1329 WRITE_NODE_FIELD(setOperations);
1330 WRITE_NODE_FIELD(resultRelations);
1332 /* planner-internal fields are not written out */
1336 _outSortClause(StringInfo str, SortClause *node)
1338 WRITE_NODE_TYPE("SORTCLAUSE");
1340 WRITE_UINT_FIELD(tleSortGroupRef);
1341 WRITE_OID_FIELD(sortop);
1345 _outGroupClause(StringInfo str, GroupClause *node)
1347 WRITE_NODE_TYPE("GROUPCLAUSE");
1349 WRITE_UINT_FIELD(tleSortGroupRef);
1350 WRITE_OID_FIELD(sortop);
1354 _outSetOperationStmt(StringInfo str, SetOperationStmt *node)
1356 WRITE_NODE_TYPE("SETOPERATIONSTMT");
1358 WRITE_ENUM_FIELD(op, SetOperation);
1359 WRITE_BOOL_FIELD(all);
1360 WRITE_NODE_FIELD(larg);
1361 WRITE_NODE_FIELD(rarg);
1362 WRITE_NODE_FIELD(colTypes);
1366 _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
1368 WRITE_NODE_TYPE("RTE");
1370 /* put alias + eref first to make dump more legible */
1371 WRITE_NODE_FIELD(alias);
1372 WRITE_NODE_FIELD(eref);
1373 WRITE_ENUM_FIELD(rtekind, RTEKind);
1375 switch (node->rtekind)
1379 WRITE_OID_FIELD(relid);
1382 WRITE_NODE_FIELD(subquery);
1385 WRITE_NODE_FIELD(funcexpr);
1386 WRITE_NODE_FIELD(coldeflist);
1389 WRITE_ENUM_FIELD(jointype, JoinType);
1390 WRITE_NODE_FIELD(joinaliasvars);
1393 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
1397 WRITE_BOOL_FIELD(inh);
1398 WRITE_BOOL_FIELD(inFromCl);
1399 WRITE_UINT_FIELD(requiredPerms);
1400 WRITE_UINT_FIELD(checkAsUser);
1404 _outAExpr(StringInfo str, A_Expr *node)
1406 WRITE_NODE_TYPE("AEXPR");
1411 appendStringInfo(str, " ");
1412 WRITE_NODE_FIELD(name);
1415 appendStringInfo(str, " AND");
1418 appendStringInfo(str, " OR");
1421 appendStringInfo(str, " NOT");
1424 appendStringInfo(str, " ");
1425 WRITE_NODE_FIELD(name);
1426 appendStringInfo(str, " ANY ");
1429 appendStringInfo(str, " ");
1430 WRITE_NODE_FIELD(name);
1431 appendStringInfo(str, " ALL ");
1433 case AEXPR_DISTINCT:
1434 appendStringInfo(str, " DISTINCT ");
1435 WRITE_NODE_FIELD(name);
1438 appendStringInfo(str, " NULLIF ");
1439 WRITE_NODE_FIELD(name);
1442 appendStringInfo(str, " OF ");
1443 WRITE_NODE_FIELD(name);
1446 appendStringInfo(str, " ??");
1450 WRITE_NODE_FIELD(lexpr);
1451 WRITE_NODE_FIELD(rexpr);
1455 _outValue(StringInfo str, Value *value)
1457 switch (value->type)
1460 appendStringInfo(str, "%ld", value->val.ival);
1465 * We assume the value is a valid numeric literal and so does
1468 appendStringInfoString(str, value->val.str);
1471 appendStringInfoChar(str, '"');
1472 _outToken(str, value->val.str);
1473 appendStringInfoChar(str, '"');
1476 /* internal representation already has leading 'b' */
1477 appendStringInfoString(str, value->val.str);
1480 elog(ERROR, "unrecognized node type: %d", (int) value->type);
1486 _outColumnRef(StringInfo str, ColumnRef *node)
1488 WRITE_NODE_TYPE("COLUMNREF");
1490 WRITE_NODE_FIELD(fields);
1494 _outParamRef(StringInfo str, ParamRef *node)
1496 WRITE_NODE_TYPE("PARAMREF");
1498 WRITE_INT_FIELD(number);
1502 _outAConst(StringInfo str, A_Const *node)
1504 WRITE_NODE_TYPE("A_CONST");
1506 _outValue(str, &(node->val));
1507 WRITE_NODE_FIELD(typename);
1511 _outA_Indices(StringInfo str, A_Indices *node)
1513 WRITE_NODE_TYPE("A_INDICES");
1515 WRITE_NODE_FIELD(lidx);
1516 WRITE_NODE_FIELD(uidx);
1520 _outA_Indirection(StringInfo str, A_Indirection *node)
1522 WRITE_NODE_TYPE("A_INDIRECTION");
1524 WRITE_NODE_FIELD(arg);
1525 WRITE_NODE_FIELD(indirection);
1529 _outResTarget(StringInfo str, ResTarget *node)
1531 WRITE_NODE_TYPE("RESTARGET");
1533 WRITE_STRING_FIELD(name);
1534 WRITE_NODE_FIELD(indirection);
1535 WRITE_NODE_FIELD(val);
1539 _outConstraint(StringInfo str, Constraint *node)
1541 WRITE_NODE_TYPE("CONSTRAINT");
1543 WRITE_STRING_FIELD(name);
1545 appendStringInfo(str, " :contype ");
1546 switch (node->contype)
1548 case CONSTR_PRIMARY:
1549 appendStringInfo(str, "PRIMARY_KEY");
1550 WRITE_NODE_FIELD(keys);
1551 WRITE_STRING_FIELD(indexspace);
1555 appendStringInfo(str, "UNIQUE");
1556 WRITE_NODE_FIELD(keys);
1557 WRITE_STRING_FIELD(indexspace);
1561 appendStringInfo(str, "CHECK");
1562 WRITE_NODE_FIELD(raw_expr);
1563 WRITE_STRING_FIELD(cooked_expr);
1566 case CONSTR_DEFAULT:
1567 appendStringInfo(str, "DEFAULT");
1568 WRITE_NODE_FIELD(raw_expr);
1569 WRITE_STRING_FIELD(cooked_expr);
1572 case CONSTR_NOTNULL:
1573 appendStringInfo(str, "NOT_NULL");
1577 appendStringInfo(str, "<unrecognized_constraint>");
1583 _outFkConstraint(StringInfo str, FkConstraint *node)
1585 WRITE_NODE_TYPE("FKCONSTRAINT");
1587 WRITE_STRING_FIELD(constr_name);
1588 WRITE_NODE_FIELD(pktable);
1589 WRITE_NODE_FIELD(fk_attrs);
1590 WRITE_NODE_FIELD(pk_attrs);
1591 WRITE_CHAR_FIELD(fk_matchtype);
1592 WRITE_CHAR_FIELD(fk_upd_action);
1593 WRITE_CHAR_FIELD(fk_del_action);
1594 WRITE_BOOL_FIELD(deferrable);
1595 WRITE_BOOL_FIELD(initdeferred);
1596 WRITE_BOOL_FIELD(skip_validation);
1602 * converts a Node into ascii string and append it to 'str'
1605 _outNode(StringInfo str, void *obj)
1608 appendStringInfo(str, "<>");
1609 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
1611 else if (IsA(obj, Integer) ||
1614 IsA(obj, BitString))
1616 /* nodeRead does not want to see { } around these! */
1617 _outValue(str, obj);
1621 appendStringInfoChar(str, '{');
1622 switch (nodeTag(obj))
1628 _outResult(str, obj);
1631 _outAppend(str, obj);
1637 _outSeqScan(str, obj);
1640 _outIndexScan(str, obj);
1643 _outTidScan(str, obj);
1645 case T_SubqueryScan:
1646 _outSubqueryScan(str, obj);
1648 case T_FunctionScan:
1649 _outFunctionScan(str, obj);
1655 _outNestLoop(str, obj);
1658 _outMergeJoin(str, obj);
1661 _outHashJoin(str, obj);
1667 _outGroup(str, obj);
1670 _outMaterial(str, obj);
1676 _outUnique(str, obj);
1679 _outSetOp(str, obj);
1682 _outLimit(str, obj);
1688 _outResdom(str, obj);
1691 _outAlias(str, obj);
1694 _outRangeVar(str, obj);
1700 _outConst(str, obj);
1703 _outParam(str, obj);
1706 _outAggref(str, obj);
1709 _outArrayRef(str, obj);
1712 _outFuncExpr(str, obj);
1715 _outOpExpr(str, obj);
1717 case T_DistinctExpr:
1718 _outDistinctExpr(str, obj);
1720 case T_ScalarArrayOpExpr:
1721 _outScalarArrayOpExpr(str, obj);
1724 _outBoolExpr(str, obj);
1727 _outSubLink(str, obj);
1730 _outSubPlan(str, obj);
1733 _outFieldSelect(str, obj);
1736 _outFieldStore(str, obj);
1739 _outRelabelType(str, obj);
1741 case T_ConvertRowtypeExpr:
1742 _outConvertRowtypeExpr(str, obj);
1745 _outCaseExpr(str, obj);
1748 _outCaseWhen(str, obj);
1750 case T_CaseTestExpr:
1751 _outCaseTestExpr(str, obj);
1754 _outArrayExpr(str, obj);
1757 _outRowExpr(str, obj);
1759 case T_CoalesceExpr:
1760 _outCoalesceExpr(str, obj);
1763 _outNullIfExpr(str, obj);
1766 _outNullTest(str, obj);
1769 _outBooleanTest(str, obj);
1771 case T_CoerceToDomain:
1772 _outCoerceToDomain(str, obj);
1774 case T_CoerceToDomainValue:
1775 _outCoerceToDomainValue(str, obj);
1777 case T_SetToDefault:
1778 _outSetToDefault(str, obj);
1781 _outTargetEntry(str, obj);
1784 _outRangeTblRef(str, obj);
1787 _outJoinExpr(str, obj);
1790 _outFromExpr(str, obj);
1797 _outIndexPath(str, obj);
1800 _outTidPath(str, obj);
1803 _outAppendPath(str, obj);
1806 _outResultPath(str, obj);
1808 case T_MaterialPath:
1809 _outMaterialPath(str, obj);
1812 _outUniquePath(str, obj);
1815 _outNestPath(str, obj);
1818 _outMergePath(str, obj);
1821 _outHashPath(str, obj);
1824 _outPathKeyItem(str, obj);
1826 case T_RestrictInfo:
1827 _outRestrictInfo(str, obj);
1830 _outJoinInfo(str, obj);
1832 case T_InClauseInfo:
1833 _outInClauseInfo(str, obj);
1837 _outCreateStmt(str, obj);
1840 _outIndexStmt(str, obj);
1843 _outNotifyStmt(str, obj);
1845 case T_DeclareCursorStmt:
1846 _outDeclareCursorStmt(str, obj);
1849 _outSelectStmt(str, obj);
1852 _outColumnDef(str, obj);
1855 _outTypeName(str, obj);
1858 _outTypeCast(str, obj);
1861 _outIndexElem(str, obj);
1864 _outQuery(str, obj);
1867 _outSortClause(str, obj);
1870 _outGroupClause(str, obj);
1872 case T_SetOperationStmt:
1873 _outSetOperationStmt(str, obj);
1875 case T_RangeTblEntry:
1876 _outRangeTblEntry(str, obj);
1879 _outAExpr(str, obj);
1882 _outColumnRef(str, obj);
1885 _outParamRef(str, obj);
1888 _outAConst(str, obj);
1891 _outA_Indices(str, obj);
1893 case T_A_Indirection:
1894 _outA_Indirection(str, obj);
1897 _outResTarget(str, obj);
1900 _outConstraint(str, obj);
1902 case T_FkConstraint:
1903 _outFkConstraint(str, obj);
1906 _outFuncCall(str, obj);
1909 _outDefElem(str, obj);
1915 * This should be an ERROR, but it's too useful to be able
1916 * to dump structures that _outNode only understands part
1919 elog(WARNING, "could not dump unrecognized node type: %d",
1920 (int) nodeTag(obj));
1923 appendStringInfoChar(str, '}');
1929 * returns the ascii representation of the Node as a palloc'd string
1932 nodeToString(void *obj)
1936 /* see stringinfo.h for an explanation of this maneuver */
1937 initStringInfo(&str);
1938 _outNode(&str, obj);