1 /*-------------------------------------------------------------------------
4 * Output functions for Postgres tree nodes.
6 * Portions Copyright (c) 1996-2005, 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.249 2005/04/21 19:18:12 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 _outBitmapAnd(StringInfo str, BitmapAnd *node)
314 WRITE_NODE_TYPE("BITMAPAND");
316 _outPlanInfo(str, (Plan *) node);
318 WRITE_NODE_FIELD(bitmapplans);
322 _outBitmapOr(StringInfo str, BitmapOr *node)
324 WRITE_NODE_TYPE("BITMAPOR");
326 _outPlanInfo(str, (Plan *) node);
328 WRITE_NODE_FIELD(bitmapplans);
332 _outScan(StringInfo str, Scan *node)
334 WRITE_NODE_TYPE("SCAN");
336 _outScanInfo(str, (Scan *) node);
340 _outSeqScan(StringInfo str, SeqScan *node)
342 WRITE_NODE_TYPE("SEQSCAN");
344 _outScanInfo(str, (Scan *) node);
348 _outIndexScan(StringInfo str, IndexScan *node)
350 WRITE_NODE_TYPE("INDEXSCAN");
352 _outScanInfo(str, (Scan *) node);
354 WRITE_NODE_FIELD(indxid);
355 WRITE_NODE_FIELD(indxqual);
356 WRITE_NODE_FIELD(indxqualorig);
357 WRITE_NODE_FIELD(indxstrategy);
358 WRITE_NODE_FIELD(indxsubtype);
359 WRITE_NODE_FIELD(indxlossy);
360 WRITE_ENUM_FIELD(indxorderdir, ScanDirection);
364 _outBitmapIndexScan(StringInfo str, BitmapIndexScan *node)
366 WRITE_NODE_TYPE("BITMAPINDEXSCAN");
368 _outScanInfo(str, (Scan *) node);
370 WRITE_OID_FIELD(indxid);
371 WRITE_NODE_FIELD(indxqual);
372 WRITE_NODE_FIELD(indxqualorig);
373 WRITE_NODE_FIELD(indxstrategy);
374 WRITE_NODE_FIELD(indxsubtype);
378 _outBitmapHeapScan(StringInfo str, BitmapHeapScan *node)
380 WRITE_NODE_TYPE("BITMAPHEAPSCAN");
382 _outScanInfo(str, (Scan *) node);
384 WRITE_NODE_FIELD(bitmapqualorig);
388 _outTidScan(StringInfo str, TidScan *node)
390 WRITE_NODE_TYPE("TIDSCAN");
392 _outScanInfo(str, (Scan *) node);
394 WRITE_NODE_FIELD(tideval);
398 _outSubqueryScan(StringInfo str, SubqueryScan *node)
400 WRITE_NODE_TYPE("SUBQUERYSCAN");
402 _outScanInfo(str, (Scan *) node);
404 WRITE_NODE_FIELD(subplan);
408 _outFunctionScan(StringInfo str, FunctionScan *node)
410 WRITE_NODE_TYPE("FUNCTIONSCAN");
412 _outScanInfo(str, (Scan *) node);
416 _outJoin(StringInfo str, Join *node)
418 WRITE_NODE_TYPE("JOIN");
420 _outJoinPlanInfo(str, (Join *) node);
424 _outNestLoop(StringInfo str, NestLoop *node)
426 WRITE_NODE_TYPE("NESTLOOP");
428 _outJoinPlanInfo(str, (Join *) node);
432 _outMergeJoin(StringInfo str, MergeJoin *node)
434 WRITE_NODE_TYPE("MERGEJOIN");
436 _outJoinPlanInfo(str, (Join *) node);
438 WRITE_NODE_FIELD(mergeclauses);
442 _outHashJoin(StringInfo str, HashJoin *node)
444 WRITE_NODE_TYPE("HASHJOIN");
446 _outJoinPlanInfo(str, (Join *) node);
448 WRITE_NODE_FIELD(hashclauses);
452 _outAgg(StringInfo str, Agg *node)
454 WRITE_NODE_TYPE("AGG");
456 _outPlanInfo(str, (Plan *) node);
458 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
459 WRITE_INT_FIELD(numCols);
460 WRITE_LONG_FIELD(numGroups);
464 _outGroup(StringInfo str, Group *node)
468 WRITE_NODE_TYPE("GROUP");
470 _outPlanInfo(str, (Plan *) node);
472 WRITE_INT_FIELD(numCols);
474 appendStringInfo(str, " :grpColIdx");
475 for (i = 0; i < node->numCols; i++)
476 appendStringInfo(str, " %d", node->grpColIdx[i]);
480 _outMaterial(StringInfo str, Material *node)
482 WRITE_NODE_TYPE("MATERIAL");
484 _outPlanInfo(str, (Plan *) node);
488 _outSort(StringInfo str, Sort *node)
492 WRITE_NODE_TYPE("SORT");
494 _outPlanInfo(str, (Plan *) node);
496 WRITE_INT_FIELD(numCols);
498 appendStringInfo(str, " :sortColIdx");
499 for (i = 0; i < node->numCols; i++)
500 appendStringInfo(str, " %d", node->sortColIdx[i]);
502 appendStringInfo(str, " :sortOperators");
503 for (i = 0; i < node->numCols; i++)
504 appendStringInfo(str, " %u", node->sortOperators[i]);
508 _outUnique(StringInfo str, Unique *node)
512 WRITE_NODE_TYPE("UNIQUE");
514 _outPlanInfo(str, (Plan *) node);
516 WRITE_INT_FIELD(numCols);
518 appendStringInfo(str, " :uniqColIdx");
519 for (i = 0; i < node->numCols; i++)
520 appendStringInfo(str, " %d", node->uniqColIdx[i]);
524 _outSetOp(StringInfo str, SetOp *node)
528 WRITE_NODE_TYPE("SETOP");
530 _outPlanInfo(str, (Plan *) node);
532 WRITE_ENUM_FIELD(cmd, SetOpCmd);
533 WRITE_INT_FIELD(numCols);
535 appendStringInfo(str, " :dupColIdx");
536 for (i = 0; i < node->numCols; i++)
537 appendStringInfo(str, " %d", node->dupColIdx[i]);
539 WRITE_INT_FIELD(flagColIdx);
543 _outLimit(StringInfo str, Limit *node)
545 WRITE_NODE_TYPE("LIMIT");
547 _outPlanInfo(str, (Plan *) node);
549 WRITE_NODE_FIELD(limitOffset);
550 WRITE_NODE_FIELD(limitCount);
554 _outHash(StringInfo str, Hash *node)
556 WRITE_NODE_TYPE("HASH");
558 _outPlanInfo(str, (Plan *) node);
561 /*****************************************************************************
563 * Stuff from primnodes.h.
565 *****************************************************************************/
568 _outAlias(StringInfo str, Alias *node)
570 WRITE_NODE_TYPE("ALIAS");
572 WRITE_STRING_FIELD(aliasname);
573 WRITE_NODE_FIELD(colnames);
577 _outRangeVar(StringInfo str, RangeVar *node)
579 WRITE_NODE_TYPE("RANGEVAR");
582 * we deliberately ignore catalogname here, since it is presently not
583 * semantically meaningful
585 WRITE_STRING_FIELD(schemaname);
586 WRITE_STRING_FIELD(relname);
587 WRITE_ENUM_FIELD(inhOpt, InhOption);
588 WRITE_BOOL_FIELD(istemp);
589 WRITE_NODE_FIELD(alias);
593 _outVar(StringInfo str, Var *node)
595 WRITE_NODE_TYPE("VAR");
597 WRITE_UINT_FIELD(varno);
598 WRITE_INT_FIELD(varattno);
599 WRITE_OID_FIELD(vartype);
600 WRITE_INT_FIELD(vartypmod);
601 WRITE_UINT_FIELD(varlevelsup);
602 WRITE_UINT_FIELD(varnoold);
603 WRITE_INT_FIELD(varoattno);
607 _outConst(StringInfo str, Const *node)
609 WRITE_NODE_TYPE("CONST");
611 WRITE_OID_FIELD(consttype);
612 WRITE_INT_FIELD(constlen);
613 WRITE_BOOL_FIELD(constbyval);
614 WRITE_BOOL_FIELD(constisnull);
616 appendStringInfo(str, " :constvalue ");
617 if (node->constisnull)
618 appendStringInfo(str, "<>");
620 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
624 _outParam(StringInfo str, Param *node)
626 WRITE_NODE_TYPE("PARAM");
628 WRITE_INT_FIELD(paramkind);
629 WRITE_INT_FIELD(paramid);
630 WRITE_STRING_FIELD(paramname);
631 WRITE_OID_FIELD(paramtype);
635 _outAggref(StringInfo str, Aggref *node)
637 WRITE_NODE_TYPE("AGGREF");
639 WRITE_OID_FIELD(aggfnoid);
640 WRITE_OID_FIELD(aggtype);
641 WRITE_NODE_FIELD(target);
642 WRITE_UINT_FIELD(agglevelsup);
643 WRITE_BOOL_FIELD(aggstar);
644 WRITE_BOOL_FIELD(aggdistinct);
648 _outArrayRef(StringInfo str, ArrayRef *node)
650 WRITE_NODE_TYPE("ARRAYREF");
652 WRITE_OID_FIELD(refrestype);
653 WRITE_OID_FIELD(refarraytype);
654 WRITE_OID_FIELD(refelemtype);
655 WRITE_NODE_FIELD(refupperindexpr);
656 WRITE_NODE_FIELD(reflowerindexpr);
657 WRITE_NODE_FIELD(refexpr);
658 WRITE_NODE_FIELD(refassgnexpr);
662 _outFuncExpr(StringInfo str, FuncExpr *node)
664 WRITE_NODE_TYPE("FUNCEXPR");
666 WRITE_OID_FIELD(funcid);
667 WRITE_OID_FIELD(funcresulttype);
668 WRITE_BOOL_FIELD(funcretset);
669 WRITE_ENUM_FIELD(funcformat, CoercionForm);
670 WRITE_NODE_FIELD(args);
674 _outOpExpr(StringInfo str, OpExpr *node)
676 WRITE_NODE_TYPE("OPEXPR");
678 WRITE_OID_FIELD(opno);
679 WRITE_OID_FIELD(opfuncid);
680 WRITE_OID_FIELD(opresulttype);
681 WRITE_BOOL_FIELD(opretset);
682 WRITE_NODE_FIELD(args);
686 _outDistinctExpr(StringInfo str, DistinctExpr *node)
688 WRITE_NODE_TYPE("DISTINCTEXPR");
690 WRITE_OID_FIELD(opno);
691 WRITE_OID_FIELD(opfuncid);
692 WRITE_OID_FIELD(opresulttype);
693 WRITE_BOOL_FIELD(opretset);
694 WRITE_NODE_FIELD(args);
698 _outScalarArrayOpExpr(StringInfo str, ScalarArrayOpExpr *node)
700 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
702 WRITE_OID_FIELD(opno);
703 WRITE_OID_FIELD(opfuncid);
704 WRITE_BOOL_FIELD(useOr);
705 WRITE_NODE_FIELD(args);
709 _outBoolExpr(StringInfo str, BoolExpr *node)
713 WRITE_NODE_TYPE("BOOLEXPR");
715 /* do-it-yourself enum representation */
716 switch (node->boolop)
728 appendStringInfo(str, " :boolop ");
729 _outToken(str, opstr);
731 WRITE_NODE_FIELD(args);
735 _outSubLink(StringInfo str, SubLink *node)
737 WRITE_NODE_TYPE("SUBLINK");
739 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
740 WRITE_BOOL_FIELD(useOr);
741 WRITE_NODE_FIELD(lefthand);
742 WRITE_NODE_FIELD(operName);
743 WRITE_NODE_FIELD(operOids);
744 WRITE_NODE_FIELD(subselect);
748 _outSubPlan(StringInfo str, SubPlan *node)
750 WRITE_NODE_TYPE("SUBPLAN");
752 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
753 WRITE_BOOL_FIELD(useOr);
754 WRITE_NODE_FIELD(exprs);
755 WRITE_NODE_FIELD(paramIds);
756 WRITE_NODE_FIELD(plan);
757 WRITE_INT_FIELD(plan_id);
758 WRITE_NODE_FIELD(rtable);
759 WRITE_BOOL_FIELD(useHashTable);
760 WRITE_BOOL_FIELD(unknownEqFalse);
761 WRITE_NODE_FIELD(setParam);
762 WRITE_NODE_FIELD(parParam);
763 WRITE_NODE_FIELD(args);
767 _outFieldSelect(StringInfo str, FieldSelect *node)
769 WRITE_NODE_TYPE("FIELDSELECT");
771 WRITE_NODE_FIELD(arg);
772 WRITE_INT_FIELD(fieldnum);
773 WRITE_OID_FIELD(resulttype);
774 WRITE_INT_FIELD(resulttypmod);
778 _outFieldStore(StringInfo str, FieldStore *node)
780 WRITE_NODE_TYPE("FIELDSTORE");
782 WRITE_NODE_FIELD(arg);
783 WRITE_NODE_FIELD(newvals);
784 WRITE_NODE_FIELD(fieldnums);
785 WRITE_OID_FIELD(resulttype);
789 _outRelabelType(StringInfo str, RelabelType *node)
791 WRITE_NODE_TYPE("RELABELTYPE");
793 WRITE_NODE_FIELD(arg);
794 WRITE_OID_FIELD(resulttype);
795 WRITE_INT_FIELD(resulttypmod);
796 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
800 _outConvertRowtypeExpr(StringInfo str, ConvertRowtypeExpr *node)
802 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
804 WRITE_NODE_FIELD(arg);
805 WRITE_OID_FIELD(resulttype);
806 WRITE_ENUM_FIELD(convertformat, CoercionForm);
810 _outCaseExpr(StringInfo str, CaseExpr *node)
812 WRITE_NODE_TYPE("CASE");
814 WRITE_OID_FIELD(casetype);
815 WRITE_NODE_FIELD(arg);
816 WRITE_NODE_FIELD(args);
817 WRITE_NODE_FIELD(defresult);
821 _outCaseWhen(StringInfo str, CaseWhen *node)
823 WRITE_NODE_TYPE("WHEN");
825 WRITE_NODE_FIELD(expr);
826 WRITE_NODE_FIELD(result);
830 _outCaseTestExpr(StringInfo str, CaseTestExpr *node)
832 WRITE_NODE_TYPE("CASETESTEXPR");
834 WRITE_OID_FIELD(typeId);
835 WRITE_INT_FIELD(typeMod);
839 _outArrayExpr(StringInfo str, ArrayExpr *node)
841 WRITE_NODE_TYPE("ARRAY");
843 WRITE_OID_FIELD(array_typeid);
844 WRITE_OID_FIELD(element_typeid);
845 WRITE_NODE_FIELD(elements);
846 WRITE_BOOL_FIELD(multidims);
850 _outRowExpr(StringInfo str, RowExpr *node)
852 WRITE_NODE_TYPE("ROW");
854 WRITE_NODE_FIELD(args);
855 WRITE_OID_FIELD(row_typeid);
856 WRITE_ENUM_FIELD(row_format, CoercionForm);
860 _outCoalesceExpr(StringInfo str, CoalesceExpr *node)
862 WRITE_NODE_TYPE("COALESCE");
864 WRITE_OID_FIELD(coalescetype);
865 WRITE_NODE_FIELD(args);
869 _outNullIfExpr(StringInfo str, NullIfExpr *node)
871 WRITE_NODE_TYPE("NULLIFEXPR");
873 WRITE_OID_FIELD(opno);
874 WRITE_OID_FIELD(opfuncid);
875 WRITE_OID_FIELD(opresulttype);
876 WRITE_BOOL_FIELD(opretset);
877 WRITE_NODE_FIELD(args);
881 _outNullTest(StringInfo str, NullTest *node)
883 WRITE_NODE_TYPE("NULLTEST");
885 WRITE_NODE_FIELD(arg);
886 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
890 _outBooleanTest(StringInfo str, BooleanTest *node)
892 WRITE_NODE_TYPE("BOOLEANTEST");
894 WRITE_NODE_FIELD(arg);
895 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
899 _outCoerceToDomain(StringInfo str, CoerceToDomain *node)
901 WRITE_NODE_TYPE("COERCETODOMAIN");
903 WRITE_NODE_FIELD(arg);
904 WRITE_OID_FIELD(resulttype);
905 WRITE_INT_FIELD(resulttypmod);
906 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
910 _outCoerceToDomainValue(StringInfo str, CoerceToDomainValue *node)
912 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
914 WRITE_OID_FIELD(typeId);
915 WRITE_INT_FIELD(typeMod);
919 _outSetToDefault(StringInfo str, SetToDefault *node)
921 WRITE_NODE_TYPE("SETTODEFAULT");
923 WRITE_OID_FIELD(typeId);
924 WRITE_INT_FIELD(typeMod);
928 _outTargetEntry(StringInfo str, TargetEntry *node)
930 WRITE_NODE_TYPE("TARGETENTRY");
932 WRITE_NODE_FIELD(expr);
933 WRITE_INT_FIELD(resno);
934 WRITE_STRING_FIELD(resname);
935 WRITE_UINT_FIELD(ressortgroupref);
936 WRITE_OID_FIELD(resorigtbl);
937 WRITE_INT_FIELD(resorigcol);
938 WRITE_BOOL_FIELD(resjunk);
942 _outRangeTblRef(StringInfo str, RangeTblRef *node)
944 WRITE_NODE_TYPE("RANGETBLREF");
946 WRITE_INT_FIELD(rtindex);
950 _outJoinExpr(StringInfo str, JoinExpr *node)
952 WRITE_NODE_TYPE("JOINEXPR");
954 WRITE_ENUM_FIELD(jointype, JoinType);
955 WRITE_BOOL_FIELD(isNatural);
956 WRITE_NODE_FIELD(larg);
957 WRITE_NODE_FIELD(rarg);
958 WRITE_NODE_FIELD(using);
959 WRITE_NODE_FIELD(quals);
960 WRITE_NODE_FIELD(alias);
961 WRITE_INT_FIELD(rtindex);
965 _outFromExpr(StringInfo str, FromExpr *node)
967 WRITE_NODE_TYPE("FROMEXPR");
969 WRITE_NODE_FIELD(fromlist);
970 WRITE_NODE_FIELD(quals);
973 /*****************************************************************************
975 * Stuff from relation.h.
977 *****************************************************************************/
980 * print the basic stuff of all nodes that inherit from Path
982 * Note we do NOT print the parent, else we'd be in infinite recursion
985 _outPathInfo(StringInfo str, Path *node)
987 WRITE_ENUM_FIELD(pathtype, NodeTag);
988 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
989 WRITE_FLOAT_FIELD(total_cost, "%.2f");
990 WRITE_NODE_FIELD(pathkeys);
994 * print the basic stuff of all nodes that inherit from JoinPath
997 _outJoinPathInfo(StringInfo str, JoinPath *node)
999 _outPathInfo(str, (Path *) node);
1001 WRITE_ENUM_FIELD(jointype, JoinType);
1002 WRITE_NODE_FIELD(outerjoinpath);
1003 WRITE_NODE_FIELD(innerjoinpath);
1004 WRITE_NODE_FIELD(joinrestrictinfo);
1008 _outPath(StringInfo str, Path *node)
1010 WRITE_NODE_TYPE("PATH");
1012 _outPathInfo(str, (Path *) node);
1016 _outIndexPath(StringInfo str, IndexPath *node)
1018 WRITE_NODE_TYPE("INDEXPATH");
1020 _outPathInfo(str, (Path *) node);
1022 WRITE_NODE_FIELD(indexinfo);
1023 WRITE_NODE_FIELD(indexclauses);
1024 WRITE_NODE_FIELD(indexquals);
1025 WRITE_BOOL_FIELD(isjoininner);
1026 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1027 WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1028 WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1029 WRITE_FLOAT_FIELD(rows, "%.0f");
1033 _outBitmapHeapPath(StringInfo str, BitmapHeapPath *node)
1035 WRITE_NODE_TYPE("BITMAPHEAPPATH");
1037 _outPathInfo(str, (Path *) node);
1039 WRITE_NODE_FIELD(bitmapqual);
1040 WRITE_BOOL_FIELD(isjoininner);
1041 WRITE_FLOAT_FIELD(rows, "%.0f");
1045 _outBitmapAndPath(StringInfo str, BitmapAndPath *node)
1047 WRITE_NODE_TYPE("BITMAPANDPATH");
1049 _outPathInfo(str, (Path *) node);
1051 WRITE_NODE_FIELD(bitmapquals);
1052 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1056 _outBitmapOrPath(StringInfo str, BitmapOrPath *node)
1058 WRITE_NODE_TYPE("BITMAPORPATH");
1060 _outPathInfo(str, (Path *) node);
1062 WRITE_NODE_FIELD(bitmapquals);
1063 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1067 _outTidPath(StringInfo str, TidPath *node)
1069 WRITE_NODE_TYPE("TIDPATH");
1071 _outPathInfo(str, (Path *) node);
1073 WRITE_NODE_FIELD(tideval);
1077 _outAppendPath(StringInfo str, AppendPath *node)
1079 WRITE_NODE_TYPE("APPENDPATH");
1081 _outPathInfo(str, (Path *) node);
1083 WRITE_NODE_FIELD(subpaths);
1087 _outResultPath(StringInfo str, ResultPath *node)
1089 WRITE_NODE_TYPE("RESULTPATH");
1091 _outPathInfo(str, (Path *) node);
1093 WRITE_NODE_FIELD(subpath);
1094 WRITE_NODE_FIELD(constantqual);
1098 _outMaterialPath(StringInfo str, MaterialPath *node)
1100 WRITE_NODE_TYPE("MATERIALPATH");
1102 _outPathInfo(str, (Path *) node);
1104 WRITE_NODE_FIELD(subpath);
1108 _outUniquePath(StringInfo str, UniquePath *node)
1110 WRITE_NODE_TYPE("UNIQUEPATH");
1112 _outPathInfo(str, (Path *) node);
1114 WRITE_NODE_FIELD(subpath);
1115 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1116 WRITE_FLOAT_FIELD(rows, "%.0f");
1120 _outNestPath(StringInfo str, NestPath *node)
1122 WRITE_NODE_TYPE("NESTPATH");
1124 _outJoinPathInfo(str, (JoinPath *) node);
1128 _outMergePath(StringInfo str, MergePath *node)
1130 WRITE_NODE_TYPE("MERGEPATH");
1132 _outJoinPathInfo(str, (JoinPath *) node);
1134 WRITE_NODE_FIELD(path_mergeclauses);
1135 WRITE_NODE_FIELD(outersortkeys);
1136 WRITE_NODE_FIELD(innersortkeys);
1140 _outHashPath(StringInfo str, HashPath *node)
1142 WRITE_NODE_TYPE("HASHPATH");
1144 _outJoinPathInfo(str, (JoinPath *) node);
1146 WRITE_NODE_FIELD(path_hashclauses);
1150 _outPathKeyItem(StringInfo str, PathKeyItem *node)
1152 WRITE_NODE_TYPE("PATHKEYITEM");
1154 WRITE_NODE_FIELD(key);
1155 WRITE_OID_FIELD(sortop);
1159 _outRestrictInfo(StringInfo str, RestrictInfo *node)
1161 WRITE_NODE_TYPE("RESTRICTINFO");
1163 /* NB: this isn't a complete set of fields */
1164 WRITE_NODE_FIELD(clause);
1165 WRITE_BOOL_FIELD(is_pushed_down);
1166 WRITE_BOOL_FIELD(valid_everywhere);
1167 WRITE_BOOL_FIELD(can_join);
1168 WRITE_BITMAPSET_FIELD(clause_relids);
1169 WRITE_BITMAPSET_FIELD(left_relids);
1170 WRITE_BITMAPSET_FIELD(right_relids);
1171 WRITE_NODE_FIELD(orclause);
1172 WRITE_OID_FIELD(mergejoinoperator);
1173 WRITE_OID_FIELD(left_sortop);
1174 WRITE_OID_FIELD(right_sortop);
1175 WRITE_NODE_FIELD(left_pathkey);
1176 WRITE_NODE_FIELD(right_pathkey);
1177 WRITE_OID_FIELD(hashjoinoperator);
1181 _outJoinInfo(StringInfo str, JoinInfo *node)
1183 WRITE_NODE_TYPE("JOININFO");
1185 WRITE_BITMAPSET_FIELD(unjoined_relids);
1186 WRITE_NODE_FIELD(jinfo_restrictinfo);
1190 _outInClauseInfo(StringInfo str, InClauseInfo *node)
1192 WRITE_NODE_TYPE("INCLAUSEINFO");
1194 WRITE_BITMAPSET_FIELD(lefthand);
1195 WRITE_BITMAPSET_FIELD(righthand);
1196 WRITE_NODE_FIELD(sub_targetlist);
1199 /*****************************************************************************
1201 * Stuff from parsenodes.h.
1203 *****************************************************************************/
1206 _outCreateStmt(StringInfo str, CreateStmt *node)
1208 WRITE_NODE_TYPE("CREATESTMT");
1210 WRITE_NODE_FIELD(relation);
1211 WRITE_NODE_FIELD(tableElts);
1212 WRITE_NODE_FIELD(inhRelations);
1213 WRITE_NODE_FIELD(constraints);
1214 WRITE_ENUM_FIELD(hasoids, ContainsOids);
1215 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
1216 WRITE_STRING_FIELD(tablespacename);
1220 _outIndexStmt(StringInfo str, IndexStmt *node)
1222 WRITE_NODE_TYPE("INDEXSTMT");
1224 WRITE_STRING_FIELD(idxname);
1225 WRITE_NODE_FIELD(relation);
1226 WRITE_STRING_FIELD(accessMethod);
1227 WRITE_STRING_FIELD(tableSpace);
1228 WRITE_NODE_FIELD(indexParams);
1229 WRITE_NODE_FIELD(whereClause);
1230 WRITE_NODE_FIELD(rangetable);
1231 WRITE_BOOL_FIELD(unique);
1232 WRITE_BOOL_FIELD(primary);
1233 WRITE_BOOL_FIELD(isconstraint);
1237 _outNotifyStmt(StringInfo str, NotifyStmt *node)
1239 WRITE_NODE_TYPE("NOTIFY");
1241 WRITE_NODE_FIELD(relation);
1245 _outDeclareCursorStmt(StringInfo str, DeclareCursorStmt *node)
1247 WRITE_NODE_TYPE("DECLARECURSOR");
1249 WRITE_STRING_FIELD(portalname);
1250 WRITE_INT_FIELD(options);
1251 WRITE_NODE_FIELD(query);
1255 _outSelectStmt(StringInfo str, SelectStmt *node)
1257 WRITE_NODE_TYPE("SELECT");
1259 WRITE_NODE_FIELD(whereClause);
1260 WRITE_NODE_FIELD(distinctClause);
1261 WRITE_NODE_FIELD(into);
1262 WRITE_NODE_FIELD(intoColNames);
1263 WRITE_ENUM_FIELD(intoHasOids, ContainsOids);
1264 WRITE_NODE_FIELD(targetList);
1265 WRITE_NODE_FIELD(fromClause);
1266 WRITE_NODE_FIELD(whereClause);
1267 WRITE_NODE_FIELD(groupClause);
1268 WRITE_NODE_FIELD(havingClause);
1269 WRITE_NODE_FIELD(sortClause);
1270 WRITE_NODE_FIELD(limitOffset);
1271 WRITE_NODE_FIELD(limitCount);
1272 WRITE_NODE_FIELD(forUpdate);
1273 WRITE_ENUM_FIELD(op, SetOperation);
1274 WRITE_BOOL_FIELD(all);
1275 WRITE_NODE_FIELD(larg);
1276 WRITE_NODE_FIELD(rarg);
1280 _outFuncCall(StringInfo str, FuncCall *node)
1282 WRITE_NODE_TYPE("FUNCCALL");
1284 WRITE_NODE_FIELD(funcname);
1285 WRITE_NODE_FIELD(args);
1286 WRITE_BOOL_FIELD(agg_star);
1287 WRITE_BOOL_FIELD(agg_distinct);
1291 _outDefElem(StringInfo str, DefElem *node)
1293 WRITE_NODE_TYPE("DEFELEM");
1295 WRITE_STRING_FIELD(defname);
1296 WRITE_NODE_FIELD(arg);
1300 _outColumnDef(StringInfo str, ColumnDef *node)
1302 WRITE_NODE_TYPE("COLUMNDEF");
1304 WRITE_STRING_FIELD(colname);
1305 WRITE_NODE_FIELD(typename);
1306 WRITE_INT_FIELD(inhcount);
1307 WRITE_BOOL_FIELD(is_local);
1308 WRITE_BOOL_FIELD(is_not_null);
1309 WRITE_NODE_FIELD(raw_default);
1310 WRITE_STRING_FIELD(cooked_default);
1311 WRITE_NODE_FIELD(constraints);
1312 WRITE_NODE_FIELD(support);
1316 _outTypeName(StringInfo str, TypeName *node)
1318 WRITE_NODE_TYPE("TYPENAME");
1320 WRITE_NODE_FIELD(names);
1321 WRITE_OID_FIELD(typeid);
1322 WRITE_BOOL_FIELD(timezone);
1323 WRITE_BOOL_FIELD(setof);
1324 WRITE_BOOL_FIELD(pct_type);
1325 WRITE_INT_FIELD(typmod);
1326 WRITE_NODE_FIELD(arrayBounds);
1330 _outTypeCast(StringInfo str, TypeCast *node)
1332 WRITE_NODE_TYPE("TYPECAST");
1334 WRITE_NODE_FIELD(arg);
1335 WRITE_NODE_FIELD(typename);
1339 _outIndexElem(StringInfo str, IndexElem *node)
1341 WRITE_NODE_TYPE("INDEXELEM");
1343 WRITE_STRING_FIELD(name);
1344 WRITE_NODE_FIELD(expr);
1345 WRITE_NODE_FIELD(opclass);
1349 _outQuery(StringInfo str, Query *node)
1351 WRITE_NODE_TYPE("QUERY");
1353 WRITE_ENUM_FIELD(commandType, CmdType);
1354 WRITE_ENUM_FIELD(querySource, QuerySource);
1355 WRITE_BOOL_FIELD(canSetTag);
1358 * Hack to work around missing outfuncs routines for a lot of the
1359 * utility-statement node types. (The only one we actually *need* for
1360 * rules support is NotifyStmt.) Someday we ought to support 'em all,
1361 * but for the meantime do this to avoid getting lots of warnings when
1362 * running with debug_print_parse on.
1364 if (node->utilityStmt)
1366 switch (nodeTag(node->utilityStmt))
1371 case T_DeclareCursorStmt:
1372 WRITE_NODE_FIELD(utilityStmt);
1375 appendStringInfo(str, " :utilityStmt ?");
1380 appendStringInfo(str, " :utilityStmt <>");
1382 WRITE_INT_FIELD(resultRelation);
1383 WRITE_NODE_FIELD(into);
1384 WRITE_BOOL_FIELD(hasAggs);
1385 WRITE_BOOL_FIELD(hasSubLinks);
1386 WRITE_NODE_FIELD(rtable);
1387 WRITE_NODE_FIELD(jointree);
1388 WRITE_NODE_FIELD(rowMarks);
1389 WRITE_NODE_FIELD(targetList);
1390 WRITE_NODE_FIELD(groupClause);
1391 WRITE_NODE_FIELD(havingQual);
1392 WRITE_NODE_FIELD(distinctClause);
1393 WRITE_NODE_FIELD(sortClause);
1394 WRITE_NODE_FIELD(limitOffset);
1395 WRITE_NODE_FIELD(limitCount);
1396 WRITE_NODE_FIELD(setOperations);
1397 WRITE_NODE_FIELD(resultRelations);
1399 /* planner-internal fields are not written out */
1403 _outSortClause(StringInfo str, SortClause *node)
1405 WRITE_NODE_TYPE("SORTCLAUSE");
1407 WRITE_UINT_FIELD(tleSortGroupRef);
1408 WRITE_OID_FIELD(sortop);
1412 _outGroupClause(StringInfo str, GroupClause *node)
1414 WRITE_NODE_TYPE("GROUPCLAUSE");
1416 WRITE_UINT_FIELD(tleSortGroupRef);
1417 WRITE_OID_FIELD(sortop);
1421 _outSetOperationStmt(StringInfo str, SetOperationStmt *node)
1423 WRITE_NODE_TYPE("SETOPERATIONSTMT");
1425 WRITE_ENUM_FIELD(op, SetOperation);
1426 WRITE_BOOL_FIELD(all);
1427 WRITE_NODE_FIELD(larg);
1428 WRITE_NODE_FIELD(rarg);
1429 WRITE_NODE_FIELD(colTypes);
1433 _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
1435 WRITE_NODE_TYPE("RTE");
1437 /* put alias + eref first to make dump more legible */
1438 WRITE_NODE_FIELD(alias);
1439 WRITE_NODE_FIELD(eref);
1440 WRITE_ENUM_FIELD(rtekind, RTEKind);
1442 switch (node->rtekind)
1446 WRITE_OID_FIELD(relid);
1449 WRITE_NODE_FIELD(subquery);
1452 WRITE_NODE_FIELD(funcexpr);
1453 WRITE_NODE_FIELD(coldeflist);
1456 WRITE_ENUM_FIELD(jointype, JoinType);
1457 WRITE_NODE_FIELD(joinaliasvars);
1460 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
1464 WRITE_BOOL_FIELD(inh);
1465 WRITE_BOOL_FIELD(inFromCl);
1466 WRITE_UINT_FIELD(requiredPerms);
1467 WRITE_UINT_FIELD(checkAsUser);
1471 _outAExpr(StringInfo str, A_Expr *node)
1473 WRITE_NODE_TYPE("AEXPR");
1478 appendStringInfo(str, " ");
1479 WRITE_NODE_FIELD(name);
1482 appendStringInfo(str, " AND");
1485 appendStringInfo(str, " OR");
1488 appendStringInfo(str, " NOT");
1491 appendStringInfo(str, " ");
1492 WRITE_NODE_FIELD(name);
1493 appendStringInfo(str, " ANY ");
1496 appendStringInfo(str, " ");
1497 WRITE_NODE_FIELD(name);
1498 appendStringInfo(str, " ALL ");
1500 case AEXPR_DISTINCT:
1501 appendStringInfo(str, " DISTINCT ");
1502 WRITE_NODE_FIELD(name);
1505 appendStringInfo(str, " NULLIF ");
1506 WRITE_NODE_FIELD(name);
1509 appendStringInfo(str, " OF ");
1510 WRITE_NODE_FIELD(name);
1513 appendStringInfo(str, " ??");
1517 WRITE_NODE_FIELD(lexpr);
1518 WRITE_NODE_FIELD(rexpr);
1522 _outValue(StringInfo str, Value *value)
1524 switch (value->type)
1527 appendStringInfo(str, "%ld", value->val.ival);
1532 * We assume the value is a valid numeric literal and so does
1535 appendStringInfoString(str, value->val.str);
1538 appendStringInfoChar(str, '"');
1539 _outToken(str, value->val.str);
1540 appendStringInfoChar(str, '"');
1543 /* internal representation already has leading 'b' */
1544 appendStringInfoString(str, value->val.str);
1547 elog(ERROR, "unrecognized node type: %d", (int) value->type);
1553 _outColumnRef(StringInfo str, ColumnRef *node)
1555 WRITE_NODE_TYPE("COLUMNREF");
1557 WRITE_NODE_FIELD(fields);
1561 _outParamRef(StringInfo str, ParamRef *node)
1563 WRITE_NODE_TYPE("PARAMREF");
1565 WRITE_INT_FIELD(number);
1569 _outAConst(StringInfo str, A_Const *node)
1571 WRITE_NODE_TYPE("A_CONST");
1573 _outValue(str, &(node->val));
1574 WRITE_NODE_FIELD(typename);
1578 _outA_Indices(StringInfo str, A_Indices *node)
1580 WRITE_NODE_TYPE("A_INDICES");
1582 WRITE_NODE_FIELD(lidx);
1583 WRITE_NODE_FIELD(uidx);
1587 _outA_Indirection(StringInfo str, A_Indirection *node)
1589 WRITE_NODE_TYPE("A_INDIRECTION");
1591 WRITE_NODE_FIELD(arg);
1592 WRITE_NODE_FIELD(indirection);
1596 _outResTarget(StringInfo str, ResTarget *node)
1598 WRITE_NODE_TYPE("RESTARGET");
1600 WRITE_STRING_FIELD(name);
1601 WRITE_NODE_FIELD(indirection);
1602 WRITE_NODE_FIELD(val);
1606 _outConstraint(StringInfo str, Constraint *node)
1608 WRITE_NODE_TYPE("CONSTRAINT");
1610 WRITE_STRING_FIELD(name);
1612 appendStringInfo(str, " :contype ");
1613 switch (node->contype)
1615 case CONSTR_PRIMARY:
1616 appendStringInfo(str, "PRIMARY_KEY");
1617 WRITE_NODE_FIELD(keys);
1618 WRITE_STRING_FIELD(indexspace);
1622 appendStringInfo(str, "UNIQUE");
1623 WRITE_NODE_FIELD(keys);
1624 WRITE_STRING_FIELD(indexspace);
1628 appendStringInfo(str, "CHECK");
1629 WRITE_NODE_FIELD(raw_expr);
1630 WRITE_STRING_FIELD(cooked_expr);
1633 case CONSTR_DEFAULT:
1634 appendStringInfo(str, "DEFAULT");
1635 WRITE_NODE_FIELD(raw_expr);
1636 WRITE_STRING_FIELD(cooked_expr);
1639 case CONSTR_NOTNULL:
1640 appendStringInfo(str, "NOT_NULL");
1644 appendStringInfo(str, "<unrecognized_constraint>");
1650 _outFkConstraint(StringInfo str, FkConstraint *node)
1652 WRITE_NODE_TYPE("FKCONSTRAINT");
1654 WRITE_STRING_FIELD(constr_name);
1655 WRITE_NODE_FIELD(pktable);
1656 WRITE_NODE_FIELD(fk_attrs);
1657 WRITE_NODE_FIELD(pk_attrs);
1658 WRITE_CHAR_FIELD(fk_matchtype);
1659 WRITE_CHAR_FIELD(fk_upd_action);
1660 WRITE_CHAR_FIELD(fk_del_action);
1661 WRITE_BOOL_FIELD(deferrable);
1662 WRITE_BOOL_FIELD(initdeferred);
1663 WRITE_BOOL_FIELD(skip_validation);
1669 * converts a Node into ascii string and append it to 'str'
1672 _outNode(StringInfo str, void *obj)
1675 appendStringInfo(str, "<>");
1676 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
1678 else if (IsA(obj, Integer) ||
1681 IsA(obj, BitString))
1683 /* nodeRead does not want to see { } around these! */
1684 _outValue(str, obj);
1688 appendStringInfoChar(str, '{');
1689 switch (nodeTag(obj))
1695 _outResult(str, obj);
1698 _outAppend(str, obj);
1701 _outBitmapAnd(str, obj);
1704 _outBitmapOr(str, obj);
1710 _outSeqScan(str, obj);
1713 _outIndexScan(str, obj);
1715 case T_BitmapIndexScan:
1716 _outBitmapIndexScan(str, obj);
1718 case T_BitmapHeapScan:
1719 _outBitmapHeapScan(str, obj);
1722 _outTidScan(str, obj);
1724 case T_SubqueryScan:
1725 _outSubqueryScan(str, obj);
1727 case T_FunctionScan:
1728 _outFunctionScan(str, obj);
1734 _outNestLoop(str, obj);
1737 _outMergeJoin(str, obj);
1740 _outHashJoin(str, obj);
1746 _outGroup(str, obj);
1749 _outMaterial(str, obj);
1755 _outUnique(str, obj);
1758 _outSetOp(str, obj);
1761 _outLimit(str, obj);
1767 _outAlias(str, obj);
1770 _outRangeVar(str, obj);
1776 _outConst(str, obj);
1779 _outParam(str, obj);
1782 _outAggref(str, obj);
1785 _outArrayRef(str, obj);
1788 _outFuncExpr(str, obj);
1791 _outOpExpr(str, obj);
1793 case T_DistinctExpr:
1794 _outDistinctExpr(str, obj);
1796 case T_ScalarArrayOpExpr:
1797 _outScalarArrayOpExpr(str, obj);
1800 _outBoolExpr(str, obj);
1803 _outSubLink(str, obj);
1806 _outSubPlan(str, obj);
1809 _outFieldSelect(str, obj);
1812 _outFieldStore(str, obj);
1815 _outRelabelType(str, obj);
1817 case T_ConvertRowtypeExpr:
1818 _outConvertRowtypeExpr(str, obj);
1821 _outCaseExpr(str, obj);
1824 _outCaseWhen(str, obj);
1826 case T_CaseTestExpr:
1827 _outCaseTestExpr(str, obj);
1830 _outArrayExpr(str, obj);
1833 _outRowExpr(str, obj);
1835 case T_CoalesceExpr:
1836 _outCoalesceExpr(str, obj);
1839 _outNullIfExpr(str, obj);
1842 _outNullTest(str, obj);
1845 _outBooleanTest(str, obj);
1847 case T_CoerceToDomain:
1848 _outCoerceToDomain(str, obj);
1850 case T_CoerceToDomainValue:
1851 _outCoerceToDomainValue(str, obj);
1853 case T_SetToDefault:
1854 _outSetToDefault(str, obj);
1857 _outTargetEntry(str, obj);
1860 _outRangeTblRef(str, obj);
1863 _outJoinExpr(str, obj);
1866 _outFromExpr(str, obj);
1873 _outIndexPath(str, obj);
1875 case T_BitmapHeapPath:
1876 _outBitmapHeapPath(str, obj);
1878 case T_BitmapAndPath:
1879 _outBitmapAndPath(str, obj);
1881 case T_BitmapOrPath:
1882 _outBitmapOrPath(str, obj);
1885 _outTidPath(str, obj);
1888 _outAppendPath(str, obj);
1891 _outResultPath(str, obj);
1893 case T_MaterialPath:
1894 _outMaterialPath(str, obj);
1897 _outUniquePath(str, obj);
1900 _outNestPath(str, obj);
1903 _outMergePath(str, obj);
1906 _outHashPath(str, obj);
1909 _outPathKeyItem(str, obj);
1911 case T_RestrictInfo:
1912 _outRestrictInfo(str, obj);
1915 _outJoinInfo(str, obj);
1917 case T_InClauseInfo:
1918 _outInClauseInfo(str, obj);
1922 _outCreateStmt(str, obj);
1925 _outIndexStmt(str, obj);
1928 _outNotifyStmt(str, obj);
1930 case T_DeclareCursorStmt:
1931 _outDeclareCursorStmt(str, obj);
1934 _outSelectStmt(str, obj);
1937 _outColumnDef(str, obj);
1940 _outTypeName(str, obj);
1943 _outTypeCast(str, obj);
1946 _outIndexElem(str, obj);
1949 _outQuery(str, obj);
1952 _outSortClause(str, obj);
1955 _outGroupClause(str, obj);
1957 case T_SetOperationStmt:
1958 _outSetOperationStmt(str, obj);
1960 case T_RangeTblEntry:
1961 _outRangeTblEntry(str, obj);
1964 _outAExpr(str, obj);
1967 _outColumnRef(str, obj);
1970 _outParamRef(str, obj);
1973 _outAConst(str, obj);
1976 _outA_Indices(str, obj);
1978 case T_A_Indirection:
1979 _outA_Indirection(str, obj);
1982 _outResTarget(str, obj);
1985 _outConstraint(str, obj);
1987 case T_FkConstraint:
1988 _outFkConstraint(str, obj);
1991 _outFuncCall(str, obj);
1994 _outDefElem(str, obj);
2000 * This should be an ERROR, but it's too useful to be able
2001 * to dump structures that _outNode only understands part
2004 elog(WARNING, "could not dump unrecognized node type: %d",
2005 (int) nodeTag(obj));
2008 appendStringInfoChar(str, '}');
2014 * returns the ascii representation of the Node as a palloc'd string
2017 nodeToString(void *obj)
2021 /* see stringinfo.h for an explanation of this maneuver */
2022 initStringInfo(&str);
2023 _outNode(&str, obj);