1 /*-------------------------------------------------------------------------
4 * Output functions for Postgres tree nodes.
6 * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
11 * src/backend/nodes/outfuncs.c
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/plannodes.h"
28 #include "nodes/relation.h"
29 #include "utils/datum.h"
33 * Macros to simplify output of different kinds of fields. Use these
34 * wherever possible to reduce the chance for silly typos. Note that these
35 * hard-wire conventions about the names of the local variables in an Out
39 /* Write the label for the node type */
40 #define WRITE_NODE_TYPE(nodelabel) \
41 appendStringInfoString(str, nodelabel)
43 /* Write an integer field (anything written as ":fldname %d") */
44 #define WRITE_INT_FIELD(fldname) \
45 appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
47 /* Write an unsigned integer field (anything written as ":fldname %u") */
48 #define WRITE_UINT_FIELD(fldname) \
49 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
51 /* Write an OID field (don't hard-wire assumption that OID is same as uint) */
52 #define WRITE_OID_FIELD(fldname) \
53 appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
55 /* Write a long-integer field */
56 #define WRITE_LONG_FIELD(fldname) \
57 appendStringInfo(str, " :" CppAsString(fldname) " %ld", node->fldname)
59 /* Write a char field (ie, one ascii character) */
60 #define WRITE_CHAR_FIELD(fldname) \
61 appendStringInfo(str, " :" CppAsString(fldname) " %c", node->fldname)
63 /* Write an enumerated-type field as an integer code */
64 #define WRITE_ENUM_FIELD(fldname, enumtype) \
65 appendStringInfo(str, " :" CppAsString(fldname) " %d", \
68 /* Write a float field --- caller must give format to define precision */
69 #define WRITE_FLOAT_FIELD(fldname,format) \
70 appendStringInfo(str, " :" CppAsString(fldname) " " format, node->fldname)
72 /* Write a boolean field */
73 #define WRITE_BOOL_FIELD(fldname) \
74 appendStringInfo(str, " :" CppAsString(fldname) " %s", \
75 booltostr(node->fldname))
77 /* Write a character-string (possibly NULL) field */
78 #define WRITE_STRING_FIELD(fldname) \
79 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
80 _outToken(str, node->fldname))
82 /* Write a parse location field (actually same as INT case) */
83 #define WRITE_LOCATION_FIELD(fldname) \
84 appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
86 /* Write a Node field */
87 #define WRITE_NODE_FIELD(fldname) \
88 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
89 _outNode(str, node->fldname))
91 /* Write a bitmapset field */
92 #define WRITE_BITMAPSET_FIELD(fldname) \
93 (appendStringInfo(str, " :" CppAsString(fldname) " "), \
94 _outBitmapset(str, node->fldname))
97 #define booltostr(x) ((x) ? "true" : "false")
99 static void _outNode(StringInfo str, const void *obj);
104 * Convert an ordinary string (eg, an identifier) into a form that
105 * will be decoded back to a plain token by read.c's functions.
107 * If a null or empty string is given, it is encoded as "<>".
110 _outToken(StringInfo str, const char *s)
112 if (s == NULL || *s == '\0')
114 appendStringInfoString(str, "<>");
119 * Look for characters or patterns that are treated specially by read.c
120 * (either in pg_strtok() or in nodeRead()), and therefore need a
121 * protective backslash.
123 /* These characters only need to be quoted at the start of the string */
126 isdigit((unsigned char) *s) ||
127 ((*s == '+' || *s == '-') &&
128 (isdigit((unsigned char) s[1]) || s[1] == '.')))
129 appendStringInfoChar(str, '\\');
132 /* These chars must be backslashed anywhere in the string */
133 if (*s == ' ' || *s == '\n' || *s == '\t' ||
134 *s == '(' || *s == ')' || *s == '{' || *s == '}' ||
136 appendStringInfoChar(str, '\\');
137 appendStringInfoChar(str, *s++);
142 _outList(StringInfo str, const List *node)
146 appendStringInfoChar(str, '(');
148 if (IsA(node, IntList))
149 appendStringInfoChar(str, 'i');
150 else if (IsA(node, OidList))
151 appendStringInfoChar(str, 'o');
156 * For the sake of backward compatibility, we emit a slightly
157 * different whitespace format for lists of nodes vs. other types of
158 * lists. XXX: is this necessary?
162 _outNode(str, lfirst(lc));
164 appendStringInfoChar(str, ' ');
166 else if (IsA(node, IntList))
167 appendStringInfo(str, " %d", lfirst_int(lc));
168 else if (IsA(node, OidList))
169 appendStringInfo(str, " %u", lfirst_oid(lc));
171 elog(ERROR, "unrecognized list node type: %d",
175 appendStringInfoChar(str, ')');
180 * converts a bitmap set of integers
182 * Note: the output format is "(b int int ...)", similar to an integer List.
185 _outBitmapset(StringInfo str, const Bitmapset *bms)
190 appendStringInfoChar(str, '(');
191 appendStringInfoChar(str, 'b');
192 tmpset = bms_copy(bms);
193 while ((x = bms_first_member(tmpset)) >= 0)
194 appendStringInfo(str, " %d", x);
196 appendStringInfoChar(str, ')');
200 * Print the value of a Datum given its type.
203 _outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
209 length = datumGetSize(value, typbyval, typlen);
213 s = (char *) (&value);
214 appendStringInfo(str, "%u [ ", (unsigned int) length);
215 for (i = 0; i < (Size) sizeof(Datum); i++)
216 appendStringInfo(str, "%d ", (int) (s[i]));
217 appendStringInfoChar(str, ']');
221 s = (char *) DatumGetPointer(value);
222 if (!PointerIsValid(s))
223 appendStringInfoString(str, "0 [ ]");
226 appendStringInfo(str, "%u [ ", (unsigned int) length);
227 for (i = 0; i < length; i++)
228 appendStringInfo(str, "%d ", (int) (s[i]));
229 appendStringInfoChar(str, ']');
236 * Stuff from plannodes.h
240 _outPlannedStmt(StringInfo str, const PlannedStmt *node)
242 WRITE_NODE_TYPE("PLANNEDSTMT");
244 WRITE_ENUM_FIELD(commandType, CmdType);
245 WRITE_UINT_FIELD(queryId);
246 WRITE_BOOL_FIELD(hasReturning);
247 WRITE_BOOL_FIELD(hasModifyingCTE);
248 WRITE_BOOL_FIELD(canSetTag);
249 WRITE_BOOL_FIELD(transientPlan);
250 WRITE_NODE_FIELD(planTree);
251 WRITE_NODE_FIELD(rtable);
252 WRITE_NODE_FIELD(resultRelations);
253 WRITE_NODE_FIELD(utilityStmt);
254 WRITE_NODE_FIELD(subplans);
255 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
256 WRITE_NODE_FIELD(rowMarks);
257 WRITE_NODE_FIELD(relationOids);
258 WRITE_NODE_FIELD(invalItems);
259 WRITE_INT_FIELD(nParamExec);
263 * print the basic stuff of all nodes that inherit from Plan
266 _outPlanInfo(StringInfo str, const Plan *node)
268 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
269 WRITE_FLOAT_FIELD(total_cost, "%.2f");
270 WRITE_FLOAT_FIELD(plan_rows, "%.0f");
271 WRITE_INT_FIELD(plan_width);
272 WRITE_NODE_FIELD(targetlist);
273 WRITE_NODE_FIELD(qual);
274 WRITE_NODE_FIELD(lefttree);
275 WRITE_NODE_FIELD(righttree);
276 WRITE_NODE_FIELD(initPlan);
277 WRITE_BITMAPSET_FIELD(extParam);
278 WRITE_BITMAPSET_FIELD(allParam);
282 * print the basic stuff of all nodes that inherit from Scan
285 _outScanInfo(StringInfo str, const Scan *node)
287 _outPlanInfo(str, (const Plan *) node);
289 WRITE_UINT_FIELD(scanrelid);
293 * print the basic stuff of all nodes that inherit from Join
296 _outJoinPlanInfo(StringInfo str, const Join *node)
298 _outPlanInfo(str, (const Plan *) node);
300 WRITE_ENUM_FIELD(jointype, JoinType);
301 WRITE_NODE_FIELD(joinqual);
306 _outPlan(StringInfo str, const Plan *node)
308 WRITE_NODE_TYPE("PLAN");
310 _outPlanInfo(str, (const Plan *) node);
314 _outResult(StringInfo str, const Result *node)
316 WRITE_NODE_TYPE("RESULT");
318 _outPlanInfo(str, (const Plan *) node);
320 WRITE_NODE_FIELD(resconstantqual);
324 _outModifyTable(StringInfo str, const ModifyTable *node)
326 WRITE_NODE_TYPE("MODIFYTABLE");
328 _outPlanInfo(str, (const Plan *) node);
330 WRITE_ENUM_FIELD(operation, CmdType);
331 WRITE_BOOL_FIELD(canSetTag);
332 WRITE_NODE_FIELD(resultRelations);
333 WRITE_INT_FIELD(resultRelIndex);
334 WRITE_NODE_FIELD(plans);
335 WRITE_NODE_FIELD(withCheckOptionLists);
336 WRITE_NODE_FIELD(returningLists);
337 WRITE_NODE_FIELD(fdwPrivLists);
338 WRITE_NODE_FIELD(rowMarks);
339 WRITE_INT_FIELD(epqParam);
343 _outAppend(StringInfo str, const Append *node)
345 WRITE_NODE_TYPE("APPEND");
347 _outPlanInfo(str, (const Plan *) node);
349 WRITE_NODE_FIELD(appendplans);
353 _outMergeAppend(StringInfo str, const MergeAppend *node)
357 WRITE_NODE_TYPE("MERGEAPPEND");
359 _outPlanInfo(str, (const Plan *) node);
361 WRITE_NODE_FIELD(mergeplans);
363 WRITE_INT_FIELD(numCols);
365 appendStringInfoString(str, " :sortColIdx");
366 for (i = 0; i < node->numCols; i++)
367 appendStringInfo(str, " %d", node->sortColIdx[i]);
369 appendStringInfoString(str, " :sortOperators");
370 for (i = 0; i < node->numCols; i++)
371 appendStringInfo(str, " %u", node->sortOperators[i]);
373 appendStringInfoString(str, " :collations");
374 for (i = 0; i < node->numCols; i++)
375 appendStringInfo(str, " %u", node->collations[i]);
377 appendStringInfoString(str, " :nullsFirst");
378 for (i = 0; i < node->numCols; i++)
379 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
383 _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
387 WRITE_NODE_TYPE("RECURSIVEUNION");
389 _outPlanInfo(str, (const Plan *) node);
391 WRITE_INT_FIELD(wtParam);
392 WRITE_INT_FIELD(numCols);
394 appendStringInfoString(str, " :dupColIdx");
395 for (i = 0; i < node->numCols; i++)
396 appendStringInfo(str, " %d", node->dupColIdx[i]);
398 appendStringInfoString(str, " :dupOperators");
399 for (i = 0; i < node->numCols; i++)
400 appendStringInfo(str, " %u", node->dupOperators[i]);
402 WRITE_LONG_FIELD(numGroups);
406 _outBitmapAnd(StringInfo str, const BitmapAnd *node)
408 WRITE_NODE_TYPE("BITMAPAND");
410 _outPlanInfo(str, (const Plan *) node);
412 WRITE_NODE_FIELD(bitmapplans);
416 _outBitmapOr(StringInfo str, const BitmapOr *node)
418 WRITE_NODE_TYPE("BITMAPOR");
420 _outPlanInfo(str, (const Plan *) node);
422 WRITE_NODE_FIELD(bitmapplans);
426 _outScan(StringInfo str, const Scan *node)
428 WRITE_NODE_TYPE("SCAN");
430 _outScanInfo(str, node);
434 _outSeqScan(StringInfo str, const SeqScan *node)
436 WRITE_NODE_TYPE("SEQSCAN");
438 _outScanInfo(str, (const Scan *) node);
442 _outIndexScan(StringInfo str, const IndexScan *node)
444 WRITE_NODE_TYPE("INDEXSCAN");
446 _outScanInfo(str, (const Scan *) node);
448 WRITE_OID_FIELD(indexid);
449 WRITE_NODE_FIELD(indexqual);
450 WRITE_NODE_FIELD(indexqualorig);
451 WRITE_NODE_FIELD(indexorderby);
452 WRITE_NODE_FIELD(indexorderbyorig);
453 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
457 _outIndexOnlyScan(StringInfo str, const IndexOnlyScan *node)
459 WRITE_NODE_TYPE("INDEXONLYSCAN");
461 _outScanInfo(str, (const Scan *) node);
463 WRITE_OID_FIELD(indexid);
464 WRITE_NODE_FIELD(indexqual);
465 WRITE_NODE_FIELD(indexorderby);
466 WRITE_NODE_FIELD(indextlist);
467 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
471 _outBitmapIndexScan(StringInfo str, const BitmapIndexScan *node)
473 WRITE_NODE_TYPE("BITMAPINDEXSCAN");
475 _outScanInfo(str, (const Scan *) node);
477 WRITE_OID_FIELD(indexid);
478 WRITE_NODE_FIELD(indexqual);
479 WRITE_NODE_FIELD(indexqualorig);
483 _outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
485 WRITE_NODE_TYPE("BITMAPHEAPSCAN");
487 _outScanInfo(str, (const Scan *) node);
489 WRITE_NODE_FIELD(bitmapqualorig);
493 _outTidScan(StringInfo str, const TidScan *node)
495 WRITE_NODE_TYPE("TIDSCAN");
497 _outScanInfo(str, (const Scan *) node);
499 WRITE_NODE_FIELD(tidquals);
503 _outSubqueryScan(StringInfo str, const SubqueryScan *node)
505 WRITE_NODE_TYPE("SUBQUERYSCAN");
507 _outScanInfo(str, (const Scan *) node);
509 WRITE_NODE_FIELD(subplan);
513 _outFunctionScan(StringInfo str, const FunctionScan *node)
515 WRITE_NODE_TYPE("FUNCTIONSCAN");
517 _outScanInfo(str, (const Scan *) node);
519 WRITE_NODE_FIELD(functions);
520 WRITE_BOOL_FIELD(funcordinality);
524 _outValuesScan(StringInfo str, const ValuesScan *node)
526 WRITE_NODE_TYPE("VALUESSCAN");
528 _outScanInfo(str, (const Scan *) node);
530 WRITE_NODE_FIELD(values_lists);
534 _outCteScan(StringInfo str, const CteScan *node)
536 WRITE_NODE_TYPE("CTESCAN");
538 _outScanInfo(str, (const Scan *) node);
540 WRITE_INT_FIELD(ctePlanId);
541 WRITE_INT_FIELD(cteParam);
545 _outWorkTableScan(StringInfo str, const WorkTableScan *node)
547 WRITE_NODE_TYPE("WORKTABLESCAN");
549 _outScanInfo(str, (const Scan *) node);
551 WRITE_INT_FIELD(wtParam);
555 _outForeignScan(StringInfo str, const ForeignScan *node)
557 WRITE_NODE_TYPE("FOREIGNSCAN");
559 _outScanInfo(str, (const Scan *) node);
561 WRITE_NODE_FIELD(fdw_exprs);
562 WRITE_NODE_FIELD(fdw_private);
563 WRITE_BOOL_FIELD(fsSystemCol);
567 _outJoin(StringInfo str, const Join *node)
569 WRITE_NODE_TYPE("JOIN");
571 _outJoinPlanInfo(str, (const Join *) node);
575 _outNestLoop(StringInfo str, const NestLoop *node)
577 WRITE_NODE_TYPE("NESTLOOP");
579 _outJoinPlanInfo(str, (const Join *) node);
581 WRITE_NODE_FIELD(nestParams);
585 _outMergeJoin(StringInfo str, const MergeJoin *node)
590 WRITE_NODE_TYPE("MERGEJOIN");
592 _outJoinPlanInfo(str, (const Join *) node);
594 WRITE_NODE_FIELD(mergeclauses);
596 numCols = list_length(node->mergeclauses);
598 appendStringInfoString(str, " :mergeFamilies");
599 for (i = 0; i < numCols; i++)
600 appendStringInfo(str, " %u", node->mergeFamilies[i]);
602 appendStringInfoString(str, " :mergeCollations");
603 for (i = 0; i < numCols; i++)
604 appendStringInfo(str, " %u", node->mergeCollations[i]);
606 appendStringInfoString(str, " :mergeStrategies");
607 for (i = 0; i < numCols; i++)
608 appendStringInfo(str, " %d", node->mergeStrategies[i]);
610 appendStringInfoString(str, " :mergeNullsFirst");
611 for (i = 0; i < numCols; i++)
612 appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
616 _outHashJoin(StringInfo str, const HashJoin *node)
618 WRITE_NODE_TYPE("HASHJOIN");
620 _outJoinPlanInfo(str, (const Join *) node);
622 WRITE_NODE_FIELD(hashclauses);
626 _outAgg(StringInfo str, const Agg *node)
630 WRITE_NODE_TYPE("AGG");
632 _outPlanInfo(str, (const Plan *) node);
634 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
635 WRITE_INT_FIELD(numCols);
637 appendStringInfoString(str, " :grpColIdx");
638 for (i = 0; i < node->numCols; i++)
639 appendStringInfo(str, " %d", node->grpColIdx[i]);
641 appendStringInfoString(str, " :grpOperators");
642 for (i = 0; i < node->numCols; i++)
643 appendStringInfo(str, " %u", node->grpOperators[i]);
645 WRITE_LONG_FIELD(numGroups);
649 _outWindowAgg(StringInfo str, const WindowAgg *node)
653 WRITE_NODE_TYPE("WINDOWAGG");
655 _outPlanInfo(str, (const Plan *) node);
657 WRITE_UINT_FIELD(winref);
658 WRITE_INT_FIELD(partNumCols);
660 appendStringInfoString(str, " :partColIdx");
661 for (i = 0; i < node->partNumCols; i++)
662 appendStringInfo(str, " %d", node->partColIdx[i]);
664 appendStringInfoString(str, " :partOperations");
665 for (i = 0; i < node->partNumCols; i++)
666 appendStringInfo(str, " %u", node->partOperators[i]);
668 WRITE_INT_FIELD(ordNumCols);
670 appendStringInfoString(str, " :ordColIdx");
671 for (i = 0; i < node->ordNumCols; i++)
672 appendStringInfo(str, " %d", node->ordColIdx[i]);
674 appendStringInfoString(str, " :ordOperations");
675 for (i = 0; i < node->ordNumCols; i++)
676 appendStringInfo(str, " %u", node->ordOperators[i]);
678 WRITE_INT_FIELD(frameOptions);
679 WRITE_NODE_FIELD(startOffset);
680 WRITE_NODE_FIELD(endOffset);
684 _outGroup(StringInfo str, const Group *node)
688 WRITE_NODE_TYPE("GROUP");
690 _outPlanInfo(str, (const Plan *) node);
692 WRITE_INT_FIELD(numCols);
694 appendStringInfoString(str, " :grpColIdx");
695 for (i = 0; i < node->numCols; i++)
696 appendStringInfo(str, " %d", node->grpColIdx[i]);
698 appendStringInfoString(str, " :grpOperators");
699 for (i = 0; i < node->numCols; i++)
700 appendStringInfo(str, " %u", node->grpOperators[i]);
704 _outMaterial(StringInfo str, const Material *node)
706 WRITE_NODE_TYPE("MATERIAL");
708 _outPlanInfo(str, (const Plan *) node);
712 _outSort(StringInfo str, const Sort *node)
716 WRITE_NODE_TYPE("SORT");
718 _outPlanInfo(str, (const Plan *) node);
720 WRITE_INT_FIELD(numCols);
722 appendStringInfoString(str, " :sortColIdx");
723 for (i = 0; i < node->numCols; i++)
724 appendStringInfo(str, " %d", node->sortColIdx[i]);
726 appendStringInfoString(str, " :sortOperators");
727 for (i = 0; i < node->numCols; i++)
728 appendStringInfo(str, " %u", node->sortOperators[i]);
730 appendStringInfoString(str, " :collations");
731 for (i = 0; i < node->numCols; i++)
732 appendStringInfo(str, " %u", node->collations[i]);
734 appendStringInfoString(str, " :nullsFirst");
735 for (i = 0; i < node->numCols; i++)
736 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
740 _outUnique(StringInfo str, const Unique *node)
744 WRITE_NODE_TYPE("UNIQUE");
746 _outPlanInfo(str, (const Plan *) node);
748 WRITE_INT_FIELD(numCols);
750 appendStringInfoString(str, " :uniqColIdx");
751 for (i = 0; i < node->numCols; i++)
752 appendStringInfo(str, " %d", node->uniqColIdx[i]);
754 appendStringInfoString(str, " :uniqOperators");
755 for (i = 0; i < node->numCols; i++)
756 appendStringInfo(str, " %u", node->uniqOperators[i]);
760 _outHash(StringInfo str, const Hash *node)
762 WRITE_NODE_TYPE("HASH");
764 _outPlanInfo(str, (const Plan *) node);
766 WRITE_OID_FIELD(skewTable);
767 WRITE_INT_FIELD(skewColumn);
768 WRITE_BOOL_FIELD(skewInherit);
769 WRITE_OID_FIELD(skewColType);
770 WRITE_INT_FIELD(skewColTypmod);
774 _outSetOp(StringInfo str, const SetOp *node)
778 WRITE_NODE_TYPE("SETOP");
780 _outPlanInfo(str, (const Plan *) node);
782 WRITE_ENUM_FIELD(cmd, SetOpCmd);
783 WRITE_ENUM_FIELD(strategy, SetOpStrategy);
784 WRITE_INT_FIELD(numCols);
786 appendStringInfoString(str, " :dupColIdx");
787 for (i = 0; i < node->numCols; i++)
788 appendStringInfo(str, " %d", node->dupColIdx[i]);
790 appendStringInfoString(str, " :dupOperators");
791 for (i = 0; i < node->numCols; i++)
792 appendStringInfo(str, " %u", node->dupOperators[i]);
794 WRITE_INT_FIELD(flagColIdx);
795 WRITE_INT_FIELD(firstFlag);
796 WRITE_LONG_FIELD(numGroups);
800 _outLockRows(StringInfo str, const LockRows *node)
802 WRITE_NODE_TYPE("LOCKROWS");
804 _outPlanInfo(str, (const Plan *) node);
806 WRITE_NODE_FIELD(rowMarks);
807 WRITE_INT_FIELD(epqParam);
811 _outLimit(StringInfo str, const Limit *node)
813 WRITE_NODE_TYPE("LIMIT");
815 _outPlanInfo(str, (const Plan *) node);
817 WRITE_NODE_FIELD(limitOffset);
818 WRITE_NODE_FIELD(limitCount);
822 _outNestLoopParam(StringInfo str, const NestLoopParam *node)
824 WRITE_NODE_TYPE("NESTLOOPPARAM");
826 WRITE_INT_FIELD(paramno);
827 WRITE_NODE_FIELD(paramval);
831 _outPlanRowMark(StringInfo str, const PlanRowMark *node)
833 WRITE_NODE_TYPE("PLANROWMARK");
835 WRITE_UINT_FIELD(rti);
836 WRITE_UINT_FIELD(prti);
837 WRITE_UINT_FIELD(rowmarkId);
838 WRITE_ENUM_FIELD(markType, RowMarkType);
839 WRITE_BOOL_FIELD(waitPolicy);
840 WRITE_BOOL_FIELD(isParent);
844 _outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
846 WRITE_NODE_TYPE("PLANINVALITEM");
848 WRITE_INT_FIELD(cacheId);
849 WRITE_UINT_FIELD(hashValue);
852 /*****************************************************************************
854 * Stuff from primnodes.h.
856 *****************************************************************************/
859 _outAlias(StringInfo str, const Alias *node)
861 WRITE_NODE_TYPE("ALIAS");
863 WRITE_STRING_FIELD(aliasname);
864 WRITE_NODE_FIELD(colnames);
868 _outRangeVar(StringInfo str, const RangeVar *node)
870 WRITE_NODE_TYPE("RANGEVAR");
873 * we deliberately ignore catalogname here, since it is presently not
874 * semantically meaningful
876 WRITE_STRING_FIELD(schemaname);
877 WRITE_STRING_FIELD(relname);
878 WRITE_ENUM_FIELD(inhOpt, InhOption);
879 WRITE_CHAR_FIELD(relpersistence);
880 WRITE_NODE_FIELD(alias);
881 WRITE_LOCATION_FIELD(location);
885 _outIntoClause(StringInfo str, const IntoClause *node)
887 WRITE_NODE_TYPE("INTOCLAUSE");
889 WRITE_NODE_FIELD(rel);
890 WRITE_NODE_FIELD(colNames);
891 WRITE_NODE_FIELD(options);
892 WRITE_ENUM_FIELD(onCommit, OnCommitAction);
893 WRITE_STRING_FIELD(tableSpaceName);
894 WRITE_NODE_FIELD(viewQuery);
895 WRITE_BOOL_FIELD(skipData);
899 _outVar(StringInfo str, const Var *node)
901 WRITE_NODE_TYPE("VAR");
903 WRITE_UINT_FIELD(varno);
904 WRITE_INT_FIELD(varattno);
905 WRITE_OID_FIELD(vartype);
906 WRITE_INT_FIELD(vartypmod);
907 WRITE_OID_FIELD(varcollid);
908 WRITE_UINT_FIELD(varlevelsup);
909 WRITE_UINT_FIELD(varnoold);
910 WRITE_INT_FIELD(varoattno);
911 WRITE_LOCATION_FIELD(location);
915 _outConst(StringInfo str, const Const *node)
917 WRITE_NODE_TYPE("CONST");
919 WRITE_OID_FIELD(consttype);
920 WRITE_INT_FIELD(consttypmod);
921 WRITE_OID_FIELD(constcollid);
922 WRITE_INT_FIELD(constlen);
923 WRITE_BOOL_FIELD(constbyval);
924 WRITE_BOOL_FIELD(constisnull);
925 WRITE_LOCATION_FIELD(location);
927 appendStringInfoString(str, " :constvalue ");
928 if (node->constisnull)
929 appendStringInfoString(str, "<>");
931 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
935 _outParam(StringInfo str, const Param *node)
937 WRITE_NODE_TYPE("PARAM");
939 WRITE_ENUM_FIELD(paramkind, ParamKind);
940 WRITE_INT_FIELD(paramid);
941 WRITE_OID_FIELD(paramtype);
942 WRITE_INT_FIELD(paramtypmod);
943 WRITE_OID_FIELD(paramcollid);
944 WRITE_LOCATION_FIELD(location);
948 _outAggref(StringInfo str, const Aggref *node)
950 WRITE_NODE_TYPE("AGGREF");
952 WRITE_OID_FIELD(aggfnoid);
953 WRITE_OID_FIELD(aggtype);
954 WRITE_OID_FIELD(aggcollid);
955 WRITE_OID_FIELD(inputcollid);
956 WRITE_NODE_FIELD(aggdirectargs);
957 WRITE_NODE_FIELD(args);
958 WRITE_NODE_FIELD(aggorder);
959 WRITE_NODE_FIELD(aggdistinct);
960 WRITE_NODE_FIELD(aggfilter);
961 WRITE_BOOL_FIELD(aggstar);
962 WRITE_BOOL_FIELD(aggvariadic);
963 WRITE_CHAR_FIELD(aggkind);
964 WRITE_UINT_FIELD(agglevelsup);
965 WRITE_LOCATION_FIELD(location);
969 _outWindowFunc(StringInfo str, const WindowFunc *node)
971 WRITE_NODE_TYPE("WINDOWFUNC");
973 WRITE_OID_FIELD(winfnoid);
974 WRITE_OID_FIELD(wintype);
975 WRITE_OID_FIELD(wincollid);
976 WRITE_OID_FIELD(inputcollid);
977 WRITE_NODE_FIELD(args);
978 WRITE_NODE_FIELD(aggfilter);
979 WRITE_UINT_FIELD(winref);
980 WRITE_BOOL_FIELD(winstar);
981 WRITE_BOOL_FIELD(winagg);
982 WRITE_LOCATION_FIELD(location);
986 _outArrayRef(StringInfo str, const ArrayRef *node)
988 WRITE_NODE_TYPE("ARRAYREF");
990 WRITE_OID_FIELD(refarraytype);
991 WRITE_OID_FIELD(refelemtype);
992 WRITE_INT_FIELD(reftypmod);
993 WRITE_OID_FIELD(refcollid);
994 WRITE_NODE_FIELD(refupperindexpr);
995 WRITE_NODE_FIELD(reflowerindexpr);
996 WRITE_NODE_FIELD(refexpr);
997 WRITE_NODE_FIELD(refassgnexpr);
1001 _outFuncExpr(StringInfo str, const FuncExpr *node)
1003 WRITE_NODE_TYPE("FUNCEXPR");
1005 WRITE_OID_FIELD(funcid);
1006 WRITE_OID_FIELD(funcresulttype);
1007 WRITE_BOOL_FIELD(funcretset);
1008 WRITE_BOOL_FIELD(funcvariadic);
1009 WRITE_ENUM_FIELD(funcformat, CoercionForm);
1010 WRITE_OID_FIELD(funccollid);
1011 WRITE_OID_FIELD(inputcollid);
1012 WRITE_NODE_FIELD(args);
1013 WRITE_LOCATION_FIELD(location);
1017 _outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
1019 WRITE_NODE_TYPE("NAMEDARGEXPR");
1021 WRITE_NODE_FIELD(arg);
1022 WRITE_STRING_FIELD(name);
1023 WRITE_INT_FIELD(argnumber);
1024 WRITE_LOCATION_FIELD(location);
1028 _outOpExpr(StringInfo str, const OpExpr *node)
1030 WRITE_NODE_TYPE("OPEXPR");
1032 WRITE_OID_FIELD(opno);
1033 WRITE_OID_FIELD(opfuncid);
1034 WRITE_OID_FIELD(opresulttype);
1035 WRITE_BOOL_FIELD(opretset);
1036 WRITE_OID_FIELD(opcollid);
1037 WRITE_OID_FIELD(inputcollid);
1038 WRITE_NODE_FIELD(args);
1039 WRITE_LOCATION_FIELD(location);
1043 _outDistinctExpr(StringInfo str, const DistinctExpr *node)
1045 WRITE_NODE_TYPE("DISTINCTEXPR");
1047 WRITE_OID_FIELD(opno);
1048 WRITE_OID_FIELD(opfuncid);
1049 WRITE_OID_FIELD(opresulttype);
1050 WRITE_BOOL_FIELD(opretset);
1051 WRITE_OID_FIELD(opcollid);
1052 WRITE_OID_FIELD(inputcollid);
1053 WRITE_NODE_FIELD(args);
1054 WRITE_LOCATION_FIELD(location);
1058 _outNullIfExpr(StringInfo str, const NullIfExpr *node)
1060 WRITE_NODE_TYPE("NULLIFEXPR");
1062 WRITE_OID_FIELD(opno);
1063 WRITE_OID_FIELD(opfuncid);
1064 WRITE_OID_FIELD(opresulttype);
1065 WRITE_BOOL_FIELD(opretset);
1066 WRITE_OID_FIELD(opcollid);
1067 WRITE_OID_FIELD(inputcollid);
1068 WRITE_NODE_FIELD(args);
1069 WRITE_LOCATION_FIELD(location);
1073 _outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
1075 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
1077 WRITE_OID_FIELD(opno);
1078 WRITE_OID_FIELD(opfuncid);
1079 WRITE_BOOL_FIELD(useOr);
1080 WRITE_OID_FIELD(inputcollid);
1081 WRITE_NODE_FIELD(args);
1082 WRITE_LOCATION_FIELD(location);
1086 _outBoolExpr(StringInfo str, const BoolExpr *node)
1090 WRITE_NODE_TYPE("BOOLEXPR");
1092 /* do-it-yourself enum representation */
1093 switch (node->boolop)
1105 appendStringInfoString(str, " :boolop ");
1106 _outToken(str, opstr);
1108 WRITE_NODE_FIELD(args);
1109 WRITE_LOCATION_FIELD(location);
1113 _outSubLink(StringInfo str, const SubLink *node)
1115 WRITE_NODE_TYPE("SUBLINK");
1117 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1118 WRITE_INT_FIELD(subLinkId);
1119 WRITE_NODE_FIELD(testexpr);
1120 WRITE_NODE_FIELD(operName);
1121 WRITE_NODE_FIELD(subselect);
1122 WRITE_LOCATION_FIELD(location);
1126 _outSubPlan(StringInfo str, const SubPlan *node)
1128 WRITE_NODE_TYPE("SUBPLAN");
1130 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1131 WRITE_NODE_FIELD(testexpr);
1132 WRITE_NODE_FIELD(paramIds);
1133 WRITE_INT_FIELD(plan_id);
1134 WRITE_STRING_FIELD(plan_name);
1135 WRITE_OID_FIELD(firstColType);
1136 WRITE_INT_FIELD(firstColTypmod);
1137 WRITE_OID_FIELD(firstColCollation);
1138 WRITE_BOOL_FIELD(useHashTable);
1139 WRITE_BOOL_FIELD(unknownEqFalse);
1140 WRITE_NODE_FIELD(setParam);
1141 WRITE_NODE_FIELD(parParam);
1142 WRITE_NODE_FIELD(args);
1143 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1144 WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
1148 _outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
1150 WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
1152 WRITE_NODE_FIELD(subplans);
1156 _outFieldSelect(StringInfo str, const FieldSelect *node)
1158 WRITE_NODE_TYPE("FIELDSELECT");
1160 WRITE_NODE_FIELD(arg);
1161 WRITE_INT_FIELD(fieldnum);
1162 WRITE_OID_FIELD(resulttype);
1163 WRITE_INT_FIELD(resulttypmod);
1164 WRITE_OID_FIELD(resultcollid);
1168 _outFieldStore(StringInfo str, const FieldStore *node)
1170 WRITE_NODE_TYPE("FIELDSTORE");
1172 WRITE_NODE_FIELD(arg);
1173 WRITE_NODE_FIELD(newvals);
1174 WRITE_NODE_FIELD(fieldnums);
1175 WRITE_OID_FIELD(resulttype);
1179 _outRelabelType(StringInfo str, const RelabelType *node)
1181 WRITE_NODE_TYPE("RELABELTYPE");
1183 WRITE_NODE_FIELD(arg);
1184 WRITE_OID_FIELD(resulttype);
1185 WRITE_INT_FIELD(resulttypmod);
1186 WRITE_OID_FIELD(resultcollid);
1187 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
1188 WRITE_LOCATION_FIELD(location);
1192 _outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
1194 WRITE_NODE_TYPE("COERCEVIAIO");
1196 WRITE_NODE_FIELD(arg);
1197 WRITE_OID_FIELD(resulttype);
1198 WRITE_OID_FIELD(resultcollid);
1199 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1200 WRITE_LOCATION_FIELD(location);
1204 _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
1206 WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
1208 WRITE_NODE_FIELD(arg);
1209 WRITE_OID_FIELD(elemfuncid);
1210 WRITE_OID_FIELD(resulttype);
1211 WRITE_INT_FIELD(resulttypmod);
1212 WRITE_OID_FIELD(resultcollid);
1213 WRITE_BOOL_FIELD(isExplicit);
1214 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1215 WRITE_LOCATION_FIELD(location);
1219 _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
1221 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
1223 WRITE_NODE_FIELD(arg);
1224 WRITE_OID_FIELD(resulttype);
1225 WRITE_ENUM_FIELD(convertformat, CoercionForm);
1226 WRITE_LOCATION_FIELD(location);
1230 _outCollateExpr(StringInfo str, const CollateExpr *node)
1232 WRITE_NODE_TYPE("COLLATE");
1234 WRITE_NODE_FIELD(arg);
1235 WRITE_OID_FIELD(collOid);
1236 WRITE_LOCATION_FIELD(location);
1240 _outCaseExpr(StringInfo str, const CaseExpr *node)
1242 WRITE_NODE_TYPE("CASE");
1244 WRITE_OID_FIELD(casetype);
1245 WRITE_OID_FIELD(casecollid);
1246 WRITE_NODE_FIELD(arg);
1247 WRITE_NODE_FIELD(args);
1248 WRITE_NODE_FIELD(defresult);
1249 WRITE_LOCATION_FIELD(location);
1253 _outCaseWhen(StringInfo str, const CaseWhen *node)
1255 WRITE_NODE_TYPE("WHEN");
1257 WRITE_NODE_FIELD(expr);
1258 WRITE_NODE_FIELD(result);
1259 WRITE_LOCATION_FIELD(location);
1263 _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
1265 WRITE_NODE_TYPE("CASETESTEXPR");
1267 WRITE_OID_FIELD(typeId);
1268 WRITE_INT_FIELD(typeMod);
1269 WRITE_OID_FIELD(collation);
1273 _outArrayExpr(StringInfo str, const ArrayExpr *node)
1275 WRITE_NODE_TYPE("ARRAY");
1277 WRITE_OID_FIELD(array_typeid);
1278 WRITE_OID_FIELD(array_collid);
1279 WRITE_OID_FIELD(element_typeid);
1280 WRITE_NODE_FIELD(elements);
1281 WRITE_BOOL_FIELD(multidims);
1282 WRITE_LOCATION_FIELD(location);
1286 _outRowExpr(StringInfo str, const RowExpr *node)
1288 WRITE_NODE_TYPE("ROW");
1290 WRITE_NODE_FIELD(args);
1291 WRITE_OID_FIELD(row_typeid);
1292 WRITE_ENUM_FIELD(row_format, CoercionForm);
1293 WRITE_NODE_FIELD(colnames);
1294 WRITE_LOCATION_FIELD(location);
1298 _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
1300 WRITE_NODE_TYPE("ROWCOMPARE");
1302 WRITE_ENUM_FIELD(rctype, RowCompareType);
1303 WRITE_NODE_FIELD(opnos);
1304 WRITE_NODE_FIELD(opfamilies);
1305 WRITE_NODE_FIELD(inputcollids);
1306 WRITE_NODE_FIELD(largs);
1307 WRITE_NODE_FIELD(rargs);
1311 _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
1313 WRITE_NODE_TYPE("COALESCE");
1315 WRITE_OID_FIELD(coalescetype);
1316 WRITE_OID_FIELD(coalescecollid);
1317 WRITE_NODE_FIELD(args);
1318 WRITE_LOCATION_FIELD(location);
1322 _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
1324 WRITE_NODE_TYPE("MINMAX");
1326 WRITE_OID_FIELD(minmaxtype);
1327 WRITE_OID_FIELD(minmaxcollid);
1328 WRITE_OID_FIELD(inputcollid);
1329 WRITE_ENUM_FIELD(op, MinMaxOp);
1330 WRITE_NODE_FIELD(args);
1331 WRITE_LOCATION_FIELD(location);
1335 _outXmlExpr(StringInfo str, const XmlExpr *node)
1337 WRITE_NODE_TYPE("XMLEXPR");
1339 WRITE_ENUM_FIELD(op, XmlExprOp);
1340 WRITE_STRING_FIELD(name);
1341 WRITE_NODE_FIELD(named_args);
1342 WRITE_NODE_FIELD(arg_names);
1343 WRITE_NODE_FIELD(args);
1344 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
1345 WRITE_OID_FIELD(type);
1346 WRITE_INT_FIELD(typmod);
1347 WRITE_LOCATION_FIELD(location);
1351 _outNullTest(StringInfo str, const NullTest *node)
1353 WRITE_NODE_TYPE("NULLTEST");
1355 WRITE_NODE_FIELD(arg);
1356 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
1357 WRITE_BOOL_FIELD(argisrow);
1361 _outBooleanTest(StringInfo str, const BooleanTest *node)
1363 WRITE_NODE_TYPE("BOOLEANTEST");
1365 WRITE_NODE_FIELD(arg);
1366 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
1370 _outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
1372 WRITE_NODE_TYPE("COERCETODOMAIN");
1374 WRITE_NODE_FIELD(arg);
1375 WRITE_OID_FIELD(resulttype);
1376 WRITE_INT_FIELD(resulttypmod);
1377 WRITE_OID_FIELD(resultcollid);
1378 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
1379 WRITE_LOCATION_FIELD(location);
1383 _outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
1385 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
1387 WRITE_OID_FIELD(typeId);
1388 WRITE_INT_FIELD(typeMod);
1389 WRITE_OID_FIELD(collation);
1390 WRITE_LOCATION_FIELD(location);
1394 _outSetToDefault(StringInfo str, const SetToDefault *node)
1396 WRITE_NODE_TYPE("SETTODEFAULT");
1398 WRITE_OID_FIELD(typeId);
1399 WRITE_INT_FIELD(typeMod);
1400 WRITE_OID_FIELD(collation);
1401 WRITE_LOCATION_FIELD(location);
1405 _outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
1407 WRITE_NODE_TYPE("CURRENTOFEXPR");
1409 WRITE_UINT_FIELD(cvarno);
1410 WRITE_STRING_FIELD(cursor_name);
1411 WRITE_INT_FIELD(cursor_param);
1415 _outTargetEntry(StringInfo str, const TargetEntry *node)
1417 WRITE_NODE_TYPE("TARGETENTRY");
1419 WRITE_NODE_FIELD(expr);
1420 WRITE_INT_FIELD(resno);
1421 WRITE_STRING_FIELD(resname);
1422 WRITE_UINT_FIELD(ressortgroupref);
1423 WRITE_OID_FIELD(resorigtbl);
1424 WRITE_INT_FIELD(resorigcol);
1425 WRITE_BOOL_FIELD(resjunk);
1429 _outRangeTblRef(StringInfo str, const RangeTblRef *node)
1431 WRITE_NODE_TYPE("RANGETBLREF");
1433 WRITE_INT_FIELD(rtindex);
1437 _outJoinExpr(StringInfo str, const JoinExpr *node)
1439 WRITE_NODE_TYPE("JOINEXPR");
1441 WRITE_ENUM_FIELD(jointype, JoinType);
1442 WRITE_BOOL_FIELD(isNatural);
1443 WRITE_NODE_FIELD(larg);
1444 WRITE_NODE_FIELD(rarg);
1445 WRITE_NODE_FIELD(usingClause);
1446 WRITE_NODE_FIELD(quals);
1447 WRITE_NODE_FIELD(alias);
1448 WRITE_INT_FIELD(rtindex);
1452 _outFromExpr(StringInfo str, const FromExpr *node)
1454 WRITE_NODE_TYPE("FROMEXPR");
1456 WRITE_NODE_FIELD(fromlist);
1457 WRITE_NODE_FIELD(quals);
1460 /*****************************************************************************
1462 * Stuff from relation.h.
1464 *****************************************************************************/
1467 * print the basic stuff of all nodes that inherit from Path
1469 * Note we do NOT print the parent, else we'd be in infinite recursion.
1470 * We can print the parent's relids for identification purposes, though.
1471 * We also do not print the whole of param_info, since it's printed by
1472 * _outRelOptInfo; it's sufficient and less cluttering to print just the
1473 * required outer relids.
1476 _outPathInfo(StringInfo str, const Path *node)
1478 WRITE_ENUM_FIELD(pathtype, NodeTag);
1479 appendStringInfoString(str, " :parent_relids ");
1480 _outBitmapset(str, node->parent->relids);
1481 appendStringInfoString(str, " :required_outer ");
1482 if (node->param_info)
1483 _outBitmapset(str, node->param_info->ppi_req_outer);
1485 _outBitmapset(str, NULL);
1486 WRITE_FLOAT_FIELD(rows, "%.0f");
1487 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1488 WRITE_FLOAT_FIELD(total_cost, "%.2f");
1489 WRITE_NODE_FIELD(pathkeys);
1493 * print the basic stuff of all nodes that inherit from JoinPath
1496 _outJoinPathInfo(StringInfo str, const JoinPath *node)
1498 _outPathInfo(str, (const Path *) node);
1500 WRITE_ENUM_FIELD(jointype, JoinType);
1501 WRITE_NODE_FIELD(outerjoinpath);
1502 WRITE_NODE_FIELD(innerjoinpath);
1503 WRITE_NODE_FIELD(joinrestrictinfo);
1507 _outPath(StringInfo str, const Path *node)
1509 WRITE_NODE_TYPE("PATH");
1511 _outPathInfo(str, (const Path *) node);
1515 _outIndexPath(StringInfo str, const IndexPath *node)
1517 WRITE_NODE_TYPE("INDEXPATH");
1519 _outPathInfo(str, (const Path *) node);
1521 WRITE_NODE_FIELD(indexinfo);
1522 WRITE_NODE_FIELD(indexclauses);
1523 WRITE_NODE_FIELD(indexquals);
1524 WRITE_NODE_FIELD(indexqualcols);
1525 WRITE_NODE_FIELD(indexorderbys);
1526 WRITE_NODE_FIELD(indexorderbycols);
1527 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1528 WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1529 WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1533 _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
1535 WRITE_NODE_TYPE("BITMAPHEAPPATH");
1537 _outPathInfo(str, (const Path *) node);
1539 WRITE_NODE_FIELD(bitmapqual);
1543 _outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
1545 WRITE_NODE_TYPE("BITMAPANDPATH");
1547 _outPathInfo(str, (const Path *) node);
1549 WRITE_NODE_FIELD(bitmapquals);
1550 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1554 _outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
1556 WRITE_NODE_TYPE("BITMAPORPATH");
1558 _outPathInfo(str, (const Path *) node);
1560 WRITE_NODE_FIELD(bitmapquals);
1561 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1565 _outTidPath(StringInfo str, const TidPath *node)
1567 WRITE_NODE_TYPE("TIDPATH");
1569 _outPathInfo(str, (const Path *) node);
1571 WRITE_NODE_FIELD(tidquals);
1575 _outForeignPath(StringInfo str, const ForeignPath *node)
1577 WRITE_NODE_TYPE("FOREIGNPATH");
1579 _outPathInfo(str, (const Path *) node);
1581 WRITE_NODE_FIELD(fdw_private);
1585 _outAppendPath(StringInfo str, const AppendPath *node)
1587 WRITE_NODE_TYPE("APPENDPATH");
1589 _outPathInfo(str, (const Path *) node);
1591 WRITE_NODE_FIELD(subpaths);
1595 _outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
1597 WRITE_NODE_TYPE("MERGEAPPENDPATH");
1599 _outPathInfo(str, (const Path *) node);
1601 WRITE_NODE_FIELD(subpaths);
1602 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1606 _outResultPath(StringInfo str, const ResultPath *node)
1608 WRITE_NODE_TYPE("RESULTPATH");
1610 _outPathInfo(str, (const Path *) node);
1612 WRITE_NODE_FIELD(quals);
1616 _outMaterialPath(StringInfo str, const MaterialPath *node)
1618 WRITE_NODE_TYPE("MATERIALPATH");
1620 _outPathInfo(str, (const Path *) node);
1622 WRITE_NODE_FIELD(subpath);
1626 _outUniquePath(StringInfo str, const UniquePath *node)
1628 WRITE_NODE_TYPE("UNIQUEPATH");
1630 _outPathInfo(str, (const Path *) node);
1632 WRITE_NODE_FIELD(subpath);
1633 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1634 WRITE_NODE_FIELD(in_operators);
1635 WRITE_NODE_FIELD(uniq_exprs);
1639 _outNestPath(StringInfo str, const NestPath *node)
1641 WRITE_NODE_TYPE("NESTPATH");
1643 _outJoinPathInfo(str, (const JoinPath *) node);
1647 _outMergePath(StringInfo str, const MergePath *node)
1649 WRITE_NODE_TYPE("MERGEPATH");
1651 _outJoinPathInfo(str, (const JoinPath *) node);
1653 WRITE_NODE_FIELD(path_mergeclauses);
1654 WRITE_NODE_FIELD(outersortkeys);
1655 WRITE_NODE_FIELD(innersortkeys);
1656 WRITE_BOOL_FIELD(materialize_inner);
1660 _outHashPath(StringInfo str, const HashPath *node)
1662 WRITE_NODE_TYPE("HASHPATH");
1664 _outJoinPathInfo(str, (const JoinPath *) node);
1666 WRITE_NODE_FIELD(path_hashclauses);
1667 WRITE_INT_FIELD(num_batches);
1671 _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
1673 WRITE_NODE_TYPE("PLANNERGLOBAL");
1675 /* NB: this isn't a complete set of fields */
1676 WRITE_NODE_FIELD(subplans);
1677 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
1678 WRITE_NODE_FIELD(finalrtable);
1679 WRITE_NODE_FIELD(finalrowmarks);
1680 WRITE_NODE_FIELD(resultRelations);
1681 WRITE_NODE_FIELD(relationOids);
1682 WRITE_NODE_FIELD(invalItems);
1683 WRITE_INT_FIELD(nParamExec);
1684 WRITE_UINT_FIELD(lastPHId);
1685 WRITE_UINT_FIELD(lastRowMarkId);
1686 WRITE_BOOL_FIELD(transientPlan);
1690 _outPlannerInfo(StringInfo str, const PlannerInfo *node)
1692 WRITE_NODE_TYPE("PLANNERINFO");
1694 /* NB: this isn't a complete set of fields */
1695 WRITE_NODE_FIELD(parse);
1696 WRITE_NODE_FIELD(glob);
1697 WRITE_UINT_FIELD(query_level);
1698 WRITE_NODE_FIELD(plan_params);
1699 WRITE_BITMAPSET_FIELD(all_baserels);
1700 WRITE_BITMAPSET_FIELD(nullable_baserels);
1701 WRITE_NODE_FIELD(join_rel_list);
1702 WRITE_INT_FIELD(join_cur_level);
1703 WRITE_NODE_FIELD(init_plans);
1704 WRITE_NODE_FIELD(cte_plan_ids);
1705 WRITE_NODE_FIELD(multiexpr_params);
1706 WRITE_NODE_FIELD(eq_classes);
1707 WRITE_NODE_FIELD(canon_pathkeys);
1708 WRITE_NODE_FIELD(left_join_clauses);
1709 WRITE_NODE_FIELD(right_join_clauses);
1710 WRITE_NODE_FIELD(full_join_clauses);
1711 WRITE_NODE_FIELD(join_info_list);
1712 WRITE_NODE_FIELD(lateral_info_list);
1713 WRITE_NODE_FIELD(append_rel_list);
1714 WRITE_NODE_FIELD(rowMarks);
1715 WRITE_NODE_FIELD(placeholder_list);
1716 WRITE_NODE_FIELD(query_pathkeys);
1717 WRITE_NODE_FIELD(group_pathkeys);
1718 WRITE_NODE_FIELD(window_pathkeys);
1719 WRITE_NODE_FIELD(distinct_pathkeys);
1720 WRITE_NODE_FIELD(sort_pathkeys);
1721 WRITE_NODE_FIELD(minmax_aggs);
1722 WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
1723 WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
1724 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1725 WRITE_BOOL_FIELD(hasInheritedTarget);
1726 WRITE_BOOL_FIELD(hasJoinRTEs);
1727 WRITE_BOOL_FIELD(hasLateralRTEs);
1728 WRITE_BOOL_FIELD(hasHavingQual);
1729 WRITE_BOOL_FIELD(hasPseudoConstantQuals);
1730 WRITE_BOOL_FIELD(hasRecursion);
1731 WRITE_INT_FIELD(wt_param_id);
1732 WRITE_BITMAPSET_FIELD(curOuterRels);
1733 WRITE_NODE_FIELD(curOuterParams);
1737 _outRelOptInfo(StringInfo str, const RelOptInfo *node)
1739 WRITE_NODE_TYPE("RELOPTINFO");
1741 /* NB: this isn't a complete set of fields */
1742 WRITE_ENUM_FIELD(reloptkind, RelOptKind);
1743 WRITE_BITMAPSET_FIELD(relids);
1744 WRITE_FLOAT_FIELD(rows, "%.0f");
1745 WRITE_INT_FIELD(width);
1746 WRITE_BOOL_FIELD(consider_startup);
1747 WRITE_NODE_FIELD(reltargetlist);
1748 WRITE_NODE_FIELD(pathlist);
1749 WRITE_NODE_FIELD(ppilist);
1750 WRITE_NODE_FIELD(cheapest_startup_path);
1751 WRITE_NODE_FIELD(cheapest_total_path);
1752 WRITE_NODE_FIELD(cheapest_unique_path);
1753 WRITE_NODE_FIELD(cheapest_parameterized_paths);
1754 WRITE_UINT_FIELD(relid);
1755 WRITE_UINT_FIELD(reltablespace);
1756 WRITE_ENUM_FIELD(rtekind, RTEKind);
1757 WRITE_INT_FIELD(min_attr);
1758 WRITE_INT_FIELD(max_attr);
1759 WRITE_NODE_FIELD(lateral_vars);
1760 WRITE_BITMAPSET_FIELD(lateral_relids);
1761 WRITE_BITMAPSET_FIELD(lateral_referencers);
1762 WRITE_NODE_FIELD(indexlist);
1763 WRITE_UINT_FIELD(pages);
1764 WRITE_FLOAT_FIELD(tuples, "%.0f");
1765 WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
1766 WRITE_NODE_FIELD(subplan);
1767 WRITE_NODE_FIELD(subroot);
1768 WRITE_NODE_FIELD(subplan_params);
1769 /* we don't try to print fdwroutine or fdw_private */
1770 WRITE_NODE_FIELD(baserestrictinfo);
1771 WRITE_NODE_FIELD(joininfo);
1772 WRITE_BOOL_FIELD(has_eclass_joins);
1776 _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
1778 WRITE_NODE_TYPE("INDEXOPTINFO");
1780 /* NB: this isn't a complete set of fields */
1781 WRITE_OID_FIELD(indexoid);
1782 /* Do NOT print rel field, else infinite recursion */
1783 WRITE_UINT_FIELD(pages);
1784 WRITE_FLOAT_FIELD(tuples, "%.0f");
1785 WRITE_INT_FIELD(tree_height);
1786 WRITE_INT_FIELD(ncolumns);
1787 /* array fields aren't really worth the trouble to print */
1788 WRITE_OID_FIELD(relam);
1789 /* indexprs is redundant since we print indextlist */
1790 WRITE_NODE_FIELD(indpred);
1791 WRITE_NODE_FIELD(indextlist);
1792 WRITE_BOOL_FIELD(predOK);
1793 WRITE_BOOL_FIELD(unique);
1794 WRITE_BOOL_FIELD(immediate);
1795 WRITE_BOOL_FIELD(hypothetical);
1796 /* we don't bother with fields copied from the pg_am entry */
1800 _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
1803 * To simplify reading, we just chase up to the topmost merged EC and
1804 * print that, without bothering to show the merge-ees separately.
1806 while (node->ec_merged)
1807 node = node->ec_merged;
1809 WRITE_NODE_TYPE("EQUIVALENCECLASS");
1811 WRITE_NODE_FIELD(ec_opfamilies);
1812 WRITE_OID_FIELD(ec_collation);
1813 WRITE_NODE_FIELD(ec_members);
1814 WRITE_NODE_FIELD(ec_sources);
1815 WRITE_NODE_FIELD(ec_derives);
1816 WRITE_BITMAPSET_FIELD(ec_relids);
1817 WRITE_BOOL_FIELD(ec_has_const);
1818 WRITE_BOOL_FIELD(ec_has_volatile);
1819 WRITE_BOOL_FIELD(ec_below_outer_join);
1820 WRITE_BOOL_FIELD(ec_broken);
1821 WRITE_UINT_FIELD(ec_sortref);
1825 _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
1827 WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
1829 WRITE_NODE_FIELD(em_expr);
1830 WRITE_BITMAPSET_FIELD(em_relids);
1831 WRITE_BITMAPSET_FIELD(em_nullable_relids);
1832 WRITE_BOOL_FIELD(em_is_const);
1833 WRITE_BOOL_FIELD(em_is_child);
1834 WRITE_OID_FIELD(em_datatype);
1838 _outPathKey(StringInfo str, const PathKey *node)
1840 WRITE_NODE_TYPE("PATHKEY");
1842 WRITE_NODE_FIELD(pk_eclass);
1843 WRITE_OID_FIELD(pk_opfamily);
1844 WRITE_INT_FIELD(pk_strategy);
1845 WRITE_BOOL_FIELD(pk_nulls_first);
1849 _outParamPathInfo(StringInfo str, const ParamPathInfo *node)
1851 WRITE_NODE_TYPE("PARAMPATHINFO");
1853 WRITE_BITMAPSET_FIELD(ppi_req_outer);
1854 WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
1855 WRITE_NODE_FIELD(ppi_clauses);
1859 _outRestrictInfo(StringInfo str, const RestrictInfo *node)
1861 WRITE_NODE_TYPE("RESTRICTINFO");
1863 /* NB: this isn't a complete set of fields */
1864 WRITE_NODE_FIELD(clause);
1865 WRITE_BOOL_FIELD(is_pushed_down);
1866 WRITE_BOOL_FIELD(outerjoin_delayed);
1867 WRITE_BOOL_FIELD(can_join);
1868 WRITE_BOOL_FIELD(pseudoconstant);
1869 WRITE_BITMAPSET_FIELD(clause_relids);
1870 WRITE_BITMAPSET_FIELD(required_relids);
1871 WRITE_BITMAPSET_FIELD(outer_relids);
1872 WRITE_BITMAPSET_FIELD(nullable_relids);
1873 WRITE_BITMAPSET_FIELD(left_relids);
1874 WRITE_BITMAPSET_FIELD(right_relids);
1875 WRITE_NODE_FIELD(orclause);
1876 /* don't write parent_ec, leads to infinite recursion in plan tree dump */
1877 WRITE_FLOAT_FIELD(norm_selec, "%.4f");
1878 WRITE_FLOAT_FIELD(outer_selec, "%.4f");
1879 WRITE_NODE_FIELD(mergeopfamilies);
1880 /* don't write left_ec, leads to infinite recursion in plan tree dump */
1881 /* don't write right_ec, leads to infinite recursion in plan tree dump */
1882 WRITE_NODE_FIELD(left_em);
1883 WRITE_NODE_FIELD(right_em);
1884 WRITE_BOOL_FIELD(outer_is_left);
1885 WRITE_OID_FIELD(hashjoinoperator);
1889 _outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node)
1891 WRITE_NODE_TYPE("PLACEHOLDERVAR");
1893 WRITE_NODE_FIELD(phexpr);
1894 WRITE_BITMAPSET_FIELD(phrels);
1895 WRITE_UINT_FIELD(phid);
1896 WRITE_UINT_FIELD(phlevelsup);
1900 _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
1902 WRITE_NODE_TYPE("SPECIALJOININFO");
1904 WRITE_BITMAPSET_FIELD(min_lefthand);
1905 WRITE_BITMAPSET_FIELD(min_righthand);
1906 WRITE_BITMAPSET_FIELD(syn_lefthand);
1907 WRITE_BITMAPSET_FIELD(syn_righthand);
1908 WRITE_ENUM_FIELD(jointype, JoinType);
1909 WRITE_BOOL_FIELD(lhs_strict);
1910 WRITE_BOOL_FIELD(delay_upper_joins);
1911 WRITE_NODE_FIELD(join_quals);
1915 _outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node)
1917 WRITE_NODE_TYPE("LATERALJOININFO");
1919 WRITE_BITMAPSET_FIELD(lateral_lhs);
1920 WRITE_BITMAPSET_FIELD(lateral_rhs);
1924 _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
1926 WRITE_NODE_TYPE("APPENDRELINFO");
1928 WRITE_UINT_FIELD(parent_relid);
1929 WRITE_UINT_FIELD(child_relid);
1930 WRITE_OID_FIELD(parent_reltype);
1931 WRITE_OID_FIELD(child_reltype);
1932 WRITE_NODE_FIELD(translated_vars);
1933 WRITE_OID_FIELD(parent_reloid);
1937 _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
1939 WRITE_NODE_TYPE("PLACEHOLDERINFO");
1941 WRITE_UINT_FIELD(phid);
1942 WRITE_NODE_FIELD(ph_var);
1943 WRITE_BITMAPSET_FIELD(ph_eval_at);
1944 WRITE_BITMAPSET_FIELD(ph_lateral);
1945 WRITE_BITMAPSET_FIELD(ph_needed);
1946 WRITE_INT_FIELD(ph_width);
1950 _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
1952 WRITE_NODE_TYPE("MINMAXAGGINFO");
1954 WRITE_OID_FIELD(aggfnoid);
1955 WRITE_OID_FIELD(aggsortop);
1956 WRITE_NODE_FIELD(target);
1957 /* We intentionally omit subroot --- too large, not interesting enough */
1958 WRITE_NODE_FIELD(path);
1959 WRITE_FLOAT_FIELD(pathcost, "%.2f");
1960 WRITE_NODE_FIELD(param);
1964 _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
1966 WRITE_NODE_TYPE("PLANNERPARAMITEM");
1968 WRITE_NODE_FIELD(item);
1969 WRITE_INT_FIELD(paramId);
1972 /*****************************************************************************
1974 * Stuff from parsenodes.h.
1976 *****************************************************************************/
1979 * print the basic stuff of all nodes that inherit from CreateStmt
1982 _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
1984 WRITE_NODE_FIELD(relation);
1985 WRITE_NODE_FIELD(tableElts);
1986 WRITE_NODE_FIELD(inhRelations);
1987 WRITE_NODE_FIELD(ofTypename);
1988 WRITE_NODE_FIELD(constraints);
1989 WRITE_NODE_FIELD(options);
1990 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
1991 WRITE_STRING_FIELD(tablespacename);
1992 WRITE_BOOL_FIELD(if_not_exists);
1996 _outCreateStmt(StringInfo str, const CreateStmt *node)
1998 WRITE_NODE_TYPE("CREATESTMT");
2000 _outCreateStmtInfo(str, (const CreateStmt *) node);
2004 _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
2006 WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
2008 _outCreateStmtInfo(str, (const CreateStmt *) node);
2010 WRITE_STRING_FIELD(servername);
2011 WRITE_NODE_FIELD(options);
2015 _outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
2017 WRITE_NODE_TYPE("IMPORTFOREIGNSCHEMASTMT");
2019 WRITE_STRING_FIELD(server_name);
2020 WRITE_STRING_FIELD(remote_schema);
2021 WRITE_STRING_FIELD(local_schema);
2022 WRITE_ENUM_FIELD(list_type, ImportForeignSchemaType);
2023 WRITE_NODE_FIELD(table_list);
2024 WRITE_NODE_FIELD(options);
2028 _outIndexStmt(StringInfo str, const IndexStmt *node)
2030 WRITE_NODE_TYPE("INDEXSTMT");
2032 WRITE_STRING_FIELD(idxname);
2033 WRITE_NODE_FIELD(relation);
2034 WRITE_STRING_FIELD(accessMethod);
2035 WRITE_STRING_FIELD(tableSpace);
2036 WRITE_NODE_FIELD(indexParams);
2037 WRITE_NODE_FIELD(options);
2038 WRITE_NODE_FIELD(whereClause);
2039 WRITE_NODE_FIELD(excludeOpNames);
2040 WRITE_STRING_FIELD(idxcomment);
2041 WRITE_OID_FIELD(indexOid);
2042 WRITE_OID_FIELD(oldNode);
2043 WRITE_BOOL_FIELD(unique);
2044 WRITE_BOOL_FIELD(primary);
2045 WRITE_BOOL_FIELD(isconstraint);
2046 WRITE_BOOL_FIELD(deferrable);
2047 WRITE_BOOL_FIELD(initdeferred);
2048 WRITE_BOOL_FIELD(concurrent);
2052 _outNotifyStmt(StringInfo str, const NotifyStmt *node)
2054 WRITE_NODE_TYPE("NOTIFY");
2056 WRITE_STRING_FIELD(conditionname);
2057 WRITE_STRING_FIELD(payload);
2061 _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
2063 WRITE_NODE_TYPE("DECLARECURSOR");
2065 WRITE_STRING_FIELD(portalname);
2066 WRITE_INT_FIELD(options);
2067 WRITE_NODE_FIELD(query);
2071 _outSelectStmt(StringInfo str, const SelectStmt *node)
2073 WRITE_NODE_TYPE("SELECT");
2075 WRITE_NODE_FIELD(distinctClause);
2076 WRITE_NODE_FIELD(intoClause);
2077 WRITE_NODE_FIELD(targetList);
2078 WRITE_NODE_FIELD(fromClause);
2079 WRITE_NODE_FIELD(whereClause);
2080 WRITE_NODE_FIELD(groupClause);
2081 WRITE_NODE_FIELD(havingClause);
2082 WRITE_NODE_FIELD(windowClause);
2083 WRITE_NODE_FIELD(valuesLists);
2084 WRITE_NODE_FIELD(sortClause);
2085 WRITE_NODE_FIELD(limitOffset);
2086 WRITE_NODE_FIELD(limitCount);
2087 WRITE_NODE_FIELD(lockingClause);
2088 WRITE_NODE_FIELD(withClause);
2089 WRITE_ENUM_FIELD(op, SetOperation);
2090 WRITE_BOOL_FIELD(all);
2091 WRITE_NODE_FIELD(larg);
2092 WRITE_NODE_FIELD(rarg);
2096 _outFuncCall(StringInfo str, const FuncCall *node)
2098 WRITE_NODE_TYPE("FUNCCALL");
2100 WRITE_NODE_FIELD(funcname);
2101 WRITE_NODE_FIELD(args);
2102 WRITE_NODE_FIELD(agg_order);
2103 WRITE_NODE_FIELD(agg_filter);
2104 WRITE_BOOL_FIELD(agg_within_group);
2105 WRITE_BOOL_FIELD(agg_star);
2106 WRITE_BOOL_FIELD(agg_distinct);
2107 WRITE_BOOL_FIELD(func_variadic);
2108 WRITE_NODE_FIELD(over);
2109 WRITE_LOCATION_FIELD(location);
2113 _outDefElem(StringInfo str, const DefElem *node)
2115 WRITE_NODE_TYPE("DEFELEM");
2117 WRITE_STRING_FIELD(defnamespace);
2118 WRITE_STRING_FIELD(defname);
2119 WRITE_NODE_FIELD(arg);
2120 WRITE_ENUM_FIELD(defaction, DefElemAction);
2124 _outTableLikeClause(StringInfo str, const TableLikeClause *node)
2126 WRITE_NODE_TYPE("TABLELIKECLAUSE");
2128 WRITE_NODE_FIELD(relation);
2129 WRITE_UINT_FIELD(options);
2133 _outLockingClause(StringInfo str, const LockingClause *node)
2135 WRITE_NODE_TYPE("LOCKINGCLAUSE");
2137 WRITE_NODE_FIELD(lockedRels);
2138 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2139 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2143 _outXmlSerialize(StringInfo str, const XmlSerialize *node)
2145 WRITE_NODE_TYPE("XMLSERIALIZE");
2147 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
2148 WRITE_NODE_FIELD(expr);
2149 WRITE_NODE_FIELD(typeName);
2150 WRITE_LOCATION_FIELD(location);
2154 _outColumnDef(StringInfo str, const ColumnDef *node)
2156 WRITE_NODE_TYPE("COLUMNDEF");
2158 WRITE_STRING_FIELD(colname);
2159 WRITE_NODE_FIELD(typeName);
2160 WRITE_INT_FIELD(inhcount);
2161 WRITE_BOOL_FIELD(is_local);
2162 WRITE_BOOL_FIELD(is_not_null);
2163 WRITE_BOOL_FIELD(is_from_type);
2164 WRITE_CHAR_FIELD(storage);
2165 WRITE_NODE_FIELD(raw_default);
2166 WRITE_NODE_FIELD(cooked_default);
2167 WRITE_NODE_FIELD(collClause);
2168 WRITE_OID_FIELD(collOid);
2169 WRITE_NODE_FIELD(constraints);
2170 WRITE_NODE_FIELD(fdwoptions);
2171 WRITE_LOCATION_FIELD(location);
2175 _outTypeName(StringInfo str, const TypeName *node)
2177 WRITE_NODE_TYPE("TYPENAME");
2179 WRITE_NODE_FIELD(names);
2180 WRITE_OID_FIELD(typeOid);
2181 WRITE_BOOL_FIELD(setof);
2182 WRITE_BOOL_FIELD(pct_type);
2183 WRITE_NODE_FIELD(typmods);
2184 WRITE_INT_FIELD(typemod);
2185 WRITE_NODE_FIELD(arrayBounds);
2186 WRITE_LOCATION_FIELD(location);
2190 _outTypeCast(StringInfo str, const TypeCast *node)
2192 WRITE_NODE_TYPE("TYPECAST");
2194 WRITE_NODE_FIELD(arg);
2195 WRITE_NODE_FIELD(typeName);
2196 WRITE_LOCATION_FIELD(location);
2200 _outCollateClause(StringInfo str, const CollateClause *node)
2202 WRITE_NODE_TYPE("COLLATECLAUSE");
2204 WRITE_NODE_FIELD(arg);
2205 WRITE_NODE_FIELD(collname);
2206 WRITE_LOCATION_FIELD(location);
2210 _outIndexElem(StringInfo str, const IndexElem *node)
2212 WRITE_NODE_TYPE("INDEXELEM");
2214 WRITE_STRING_FIELD(name);
2215 WRITE_NODE_FIELD(expr);
2216 WRITE_STRING_FIELD(indexcolname);
2217 WRITE_NODE_FIELD(collation);
2218 WRITE_NODE_FIELD(opclass);
2219 WRITE_ENUM_FIELD(ordering, SortByDir);
2220 WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2224 _outQuery(StringInfo str, const Query *node)
2226 WRITE_NODE_TYPE("QUERY");
2228 WRITE_ENUM_FIELD(commandType, CmdType);
2229 WRITE_ENUM_FIELD(querySource, QuerySource);
2230 /* we intentionally do not print the queryId field */
2231 WRITE_BOOL_FIELD(canSetTag);
2234 * Hack to work around missing outfuncs routines for a lot of the
2235 * utility-statement node types. (The only one we actually *need* for
2236 * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2237 * for the meantime do this to avoid getting lots of warnings when running
2238 * with debug_print_parse on.
2240 if (node->utilityStmt)
2242 switch (nodeTag(node->utilityStmt))
2247 case T_DeclareCursorStmt:
2248 WRITE_NODE_FIELD(utilityStmt);
2251 appendStringInfoString(str, " :utilityStmt ?");
2256 appendStringInfoString(str, " :utilityStmt <>");
2258 WRITE_INT_FIELD(resultRelation);
2259 WRITE_BOOL_FIELD(hasAggs);
2260 WRITE_BOOL_FIELD(hasWindowFuncs);
2261 WRITE_BOOL_FIELD(hasSubLinks);
2262 WRITE_BOOL_FIELD(hasDistinctOn);
2263 WRITE_BOOL_FIELD(hasRecursive);
2264 WRITE_BOOL_FIELD(hasModifyingCTE);
2265 WRITE_BOOL_FIELD(hasForUpdate);
2266 WRITE_BOOL_FIELD(hasRowSecurity);
2267 WRITE_NODE_FIELD(cteList);
2268 WRITE_NODE_FIELD(rtable);
2269 WRITE_NODE_FIELD(jointree);
2270 WRITE_NODE_FIELD(targetList);
2271 WRITE_NODE_FIELD(withCheckOptions);
2272 WRITE_NODE_FIELD(returningList);
2273 WRITE_NODE_FIELD(groupClause);
2274 WRITE_NODE_FIELD(havingQual);
2275 WRITE_NODE_FIELD(windowClause);
2276 WRITE_NODE_FIELD(distinctClause);
2277 WRITE_NODE_FIELD(sortClause);
2278 WRITE_NODE_FIELD(limitOffset);
2279 WRITE_NODE_FIELD(limitCount);
2280 WRITE_NODE_FIELD(rowMarks);
2281 WRITE_NODE_FIELD(setOperations);
2282 WRITE_NODE_FIELD(constraintDeps);
2286 _outWithCheckOption(StringInfo str, const WithCheckOption *node)
2288 WRITE_NODE_TYPE("WITHCHECKOPTION");
2290 WRITE_STRING_FIELD(viewname);
2291 WRITE_NODE_FIELD(qual);
2292 WRITE_BOOL_FIELD(cascaded);
2296 _outSortGroupClause(StringInfo str, const SortGroupClause *node)
2298 WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2300 WRITE_UINT_FIELD(tleSortGroupRef);
2301 WRITE_OID_FIELD(eqop);
2302 WRITE_OID_FIELD(sortop);
2303 WRITE_BOOL_FIELD(nulls_first);
2304 WRITE_BOOL_FIELD(hashable);
2308 _outWindowClause(StringInfo str, const WindowClause *node)
2310 WRITE_NODE_TYPE("WINDOWCLAUSE");
2312 WRITE_STRING_FIELD(name);
2313 WRITE_STRING_FIELD(refname);
2314 WRITE_NODE_FIELD(partitionClause);
2315 WRITE_NODE_FIELD(orderClause);
2316 WRITE_INT_FIELD(frameOptions);
2317 WRITE_NODE_FIELD(startOffset);
2318 WRITE_NODE_FIELD(endOffset);
2319 WRITE_UINT_FIELD(winref);
2320 WRITE_BOOL_FIELD(copiedOrder);
2324 _outRowMarkClause(StringInfo str, const RowMarkClause *node)
2326 WRITE_NODE_TYPE("ROWMARKCLAUSE");
2328 WRITE_UINT_FIELD(rti);
2329 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2330 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2331 WRITE_BOOL_FIELD(pushedDown);
2335 _outWithClause(StringInfo str, const WithClause *node)
2337 WRITE_NODE_TYPE("WITHCLAUSE");
2339 WRITE_NODE_FIELD(ctes);
2340 WRITE_BOOL_FIELD(recursive);
2341 WRITE_LOCATION_FIELD(location);
2345 _outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
2347 WRITE_NODE_TYPE("COMMONTABLEEXPR");
2349 WRITE_STRING_FIELD(ctename);
2350 WRITE_NODE_FIELD(aliascolnames);
2351 WRITE_NODE_FIELD(ctequery);
2352 WRITE_LOCATION_FIELD(location);
2353 WRITE_BOOL_FIELD(cterecursive);
2354 WRITE_INT_FIELD(cterefcount);
2355 WRITE_NODE_FIELD(ctecolnames);
2356 WRITE_NODE_FIELD(ctecoltypes);
2357 WRITE_NODE_FIELD(ctecoltypmods);
2358 WRITE_NODE_FIELD(ctecolcollations);
2362 _outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
2364 WRITE_NODE_TYPE("SETOPERATIONSTMT");
2366 WRITE_ENUM_FIELD(op, SetOperation);
2367 WRITE_BOOL_FIELD(all);
2368 WRITE_NODE_FIELD(larg);
2369 WRITE_NODE_FIELD(rarg);
2370 WRITE_NODE_FIELD(colTypes);
2371 WRITE_NODE_FIELD(colTypmods);
2372 WRITE_NODE_FIELD(colCollations);
2373 WRITE_NODE_FIELD(groupClauses);
2377 _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
2379 WRITE_NODE_TYPE("RTE");
2381 /* put alias + eref first to make dump more legible */
2382 WRITE_NODE_FIELD(alias);
2383 WRITE_NODE_FIELD(eref);
2384 WRITE_ENUM_FIELD(rtekind, RTEKind);
2386 switch (node->rtekind)
2389 WRITE_OID_FIELD(relid);
2390 WRITE_CHAR_FIELD(relkind);
2393 WRITE_NODE_FIELD(subquery);
2394 WRITE_BOOL_FIELD(security_barrier);
2397 WRITE_ENUM_FIELD(jointype, JoinType);
2398 WRITE_NODE_FIELD(joinaliasvars);
2401 WRITE_NODE_FIELD(functions);
2402 WRITE_BOOL_FIELD(funcordinality);
2405 WRITE_NODE_FIELD(values_lists);
2406 WRITE_NODE_FIELD(values_collations);
2409 WRITE_STRING_FIELD(ctename);
2410 WRITE_UINT_FIELD(ctelevelsup);
2411 WRITE_BOOL_FIELD(self_reference);
2412 WRITE_NODE_FIELD(ctecoltypes);
2413 WRITE_NODE_FIELD(ctecoltypmods);
2414 WRITE_NODE_FIELD(ctecolcollations);
2417 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
2421 WRITE_BOOL_FIELD(lateral);
2422 WRITE_BOOL_FIELD(inh);
2423 WRITE_BOOL_FIELD(inFromCl);
2424 WRITE_UINT_FIELD(requiredPerms);
2425 WRITE_OID_FIELD(checkAsUser);
2426 WRITE_BITMAPSET_FIELD(selectedCols);
2427 WRITE_BITMAPSET_FIELD(modifiedCols);
2428 WRITE_NODE_FIELD(securityQuals);
2432 _outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
2434 WRITE_NODE_TYPE("RANGETBLFUNCTION");
2436 WRITE_NODE_FIELD(funcexpr);
2437 WRITE_INT_FIELD(funccolcount);
2438 WRITE_NODE_FIELD(funccolnames);
2439 WRITE_NODE_FIELD(funccoltypes);
2440 WRITE_NODE_FIELD(funccoltypmods);
2441 WRITE_NODE_FIELD(funccolcollations);
2442 WRITE_BITMAPSET_FIELD(funcparams);
2446 _outAExpr(StringInfo str, const A_Expr *node)
2448 WRITE_NODE_TYPE("AEXPR");
2453 appendStringInfoChar(str, ' ');
2454 WRITE_NODE_FIELD(name);
2457 appendStringInfoChar(str, ' ');
2458 WRITE_NODE_FIELD(name);
2459 appendStringInfoString(str, " ANY ");
2462 appendStringInfoChar(str, ' ');
2463 WRITE_NODE_FIELD(name);
2464 appendStringInfoString(str, " ALL ");
2466 case AEXPR_DISTINCT:
2467 appendStringInfoString(str, " DISTINCT ");
2468 WRITE_NODE_FIELD(name);
2471 appendStringInfoString(str, " NULLIF ");
2472 WRITE_NODE_FIELD(name);
2475 appendStringInfoString(str, " OF ");
2476 WRITE_NODE_FIELD(name);
2479 appendStringInfoString(str, " IN ");
2480 WRITE_NODE_FIELD(name);
2483 appendStringInfoString(str, " ??");
2487 WRITE_NODE_FIELD(lexpr);
2488 WRITE_NODE_FIELD(rexpr);
2489 WRITE_LOCATION_FIELD(location);
2493 _outValue(StringInfo str, const Value *value)
2495 switch (value->type)
2498 appendStringInfo(str, "%ld", value->val.ival);
2503 * We assume the value is a valid numeric literal and so does not
2506 appendStringInfoString(str, value->val.str);
2511 * We use _outToken to provide escaping of the string's content,
2512 * but we don't want it to do anything with an empty string.
2514 appendStringInfoChar(str, '"');
2515 if (value->val.str[0] != '\0')
2516 _outToken(str, value->val.str);
2517 appendStringInfoChar(str, '"');
2520 /* internal representation already has leading 'b' */
2521 appendStringInfoString(str, value->val.str);
2524 /* this is seen only within A_Const, not in transformed trees */
2525 appendStringInfoString(str, "NULL");
2528 elog(ERROR, "unrecognized node type: %d", (int) value->type);
2534 _outColumnRef(StringInfo str, const ColumnRef *node)
2536 WRITE_NODE_TYPE("COLUMNREF");
2538 WRITE_NODE_FIELD(fields);
2539 WRITE_LOCATION_FIELD(location);
2543 _outParamRef(StringInfo str, const ParamRef *node)
2545 WRITE_NODE_TYPE("PARAMREF");
2547 WRITE_INT_FIELD(number);
2548 WRITE_LOCATION_FIELD(location);
2552 _outAConst(StringInfo str, const A_Const *node)
2554 WRITE_NODE_TYPE("A_CONST");
2556 appendStringInfoString(str, " :val ");
2557 _outValue(str, &(node->val));
2558 WRITE_LOCATION_FIELD(location);
2562 _outA_Star(StringInfo str, const A_Star *node)
2564 WRITE_NODE_TYPE("A_STAR");
2568 _outA_Indices(StringInfo str, const A_Indices *node)
2570 WRITE_NODE_TYPE("A_INDICES");
2572 WRITE_NODE_FIELD(lidx);
2573 WRITE_NODE_FIELD(uidx);
2577 _outA_Indirection(StringInfo str, const A_Indirection *node)
2579 WRITE_NODE_TYPE("A_INDIRECTION");
2581 WRITE_NODE_FIELD(arg);
2582 WRITE_NODE_FIELD(indirection);
2586 _outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
2588 WRITE_NODE_TYPE("A_ARRAYEXPR");
2590 WRITE_NODE_FIELD(elements);
2591 WRITE_LOCATION_FIELD(location);
2595 _outResTarget(StringInfo str, const ResTarget *node)
2597 WRITE_NODE_TYPE("RESTARGET");
2599 WRITE_STRING_FIELD(name);
2600 WRITE_NODE_FIELD(indirection);
2601 WRITE_NODE_FIELD(val);
2602 WRITE_LOCATION_FIELD(location);
2606 _outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
2608 WRITE_NODE_TYPE("MULTIASSIGNREF");
2610 WRITE_NODE_FIELD(source);
2611 WRITE_INT_FIELD(colno);
2612 WRITE_INT_FIELD(ncolumns);
2616 _outSortBy(StringInfo str, const SortBy *node)
2618 WRITE_NODE_TYPE("SORTBY");
2620 WRITE_NODE_FIELD(node);
2621 WRITE_ENUM_FIELD(sortby_dir, SortByDir);
2622 WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
2623 WRITE_NODE_FIELD(useOp);
2624 WRITE_LOCATION_FIELD(location);
2628 _outWindowDef(StringInfo str, const WindowDef *node)
2630 WRITE_NODE_TYPE("WINDOWDEF");
2632 WRITE_STRING_FIELD(name);
2633 WRITE_STRING_FIELD(refname);
2634 WRITE_NODE_FIELD(partitionClause);
2635 WRITE_NODE_FIELD(orderClause);
2636 WRITE_INT_FIELD(frameOptions);
2637 WRITE_NODE_FIELD(startOffset);
2638 WRITE_NODE_FIELD(endOffset);
2639 WRITE_LOCATION_FIELD(location);
2643 _outRangeSubselect(StringInfo str, const RangeSubselect *node)
2645 WRITE_NODE_TYPE("RANGESUBSELECT");
2647 WRITE_BOOL_FIELD(lateral);
2648 WRITE_NODE_FIELD(subquery);
2649 WRITE_NODE_FIELD(alias);
2653 _outRangeFunction(StringInfo str, const RangeFunction *node)
2655 WRITE_NODE_TYPE("RANGEFUNCTION");
2657 WRITE_BOOL_FIELD(lateral);
2658 WRITE_BOOL_FIELD(ordinality);
2659 WRITE_BOOL_FIELD(is_rowsfrom);
2660 WRITE_NODE_FIELD(functions);
2661 WRITE_NODE_FIELD(alias);
2662 WRITE_NODE_FIELD(coldeflist);
2666 _outConstraint(StringInfo str, const Constraint *node)
2668 WRITE_NODE_TYPE("CONSTRAINT");
2670 WRITE_STRING_FIELD(conname);
2671 WRITE_BOOL_FIELD(deferrable);
2672 WRITE_BOOL_FIELD(initdeferred);
2673 WRITE_LOCATION_FIELD(location);
2675 appendStringInfoString(str, " :contype ");
2676 switch (node->contype)
2679 appendStringInfoString(str, "NULL");
2682 case CONSTR_NOTNULL:
2683 appendStringInfoString(str, "NOT_NULL");
2686 case CONSTR_DEFAULT:
2687 appendStringInfoString(str, "DEFAULT");
2688 WRITE_NODE_FIELD(raw_expr);
2689 WRITE_STRING_FIELD(cooked_expr);
2693 appendStringInfoString(str, "CHECK");
2694 WRITE_BOOL_FIELD(is_no_inherit);
2695 WRITE_NODE_FIELD(raw_expr);
2696 WRITE_STRING_FIELD(cooked_expr);
2699 case CONSTR_PRIMARY:
2700 appendStringInfoString(str, "PRIMARY_KEY");
2701 WRITE_NODE_FIELD(keys);
2702 WRITE_NODE_FIELD(options);
2703 WRITE_STRING_FIELD(indexname);
2704 WRITE_STRING_FIELD(indexspace);
2705 /* access_method and where_clause not currently used */
2709 appendStringInfoString(str, "UNIQUE");
2710 WRITE_NODE_FIELD(keys);
2711 WRITE_NODE_FIELD(options);
2712 WRITE_STRING_FIELD(indexname);
2713 WRITE_STRING_FIELD(indexspace);
2714 /* access_method and where_clause not currently used */
2717 case CONSTR_EXCLUSION:
2718 appendStringInfoString(str, "EXCLUSION");
2719 WRITE_NODE_FIELD(exclusions);
2720 WRITE_NODE_FIELD(options);
2721 WRITE_STRING_FIELD(indexname);
2722 WRITE_STRING_FIELD(indexspace);
2723 WRITE_STRING_FIELD(access_method);
2724 WRITE_NODE_FIELD(where_clause);
2727 case CONSTR_FOREIGN:
2728 appendStringInfoString(str, "FOREIGN_KEY");
2729 WRITE_NODE_FIELD(pktable);
2730 WRITE_NODE_FIELD(fk_attrs);
2731 WRITE_NODE_FIELD(pk_attrs);
2732 WRITE_CHAR_FIELD(fk_matchtype);
2733 WRITE_CHAR_FIELD(fk_upd_action);
2734 WRITE_CHAR_FIELD(fk_del_action);
2735 WRITE_NODE_FIELD(old_conpfeqop);
2736 WRITE_OID_FIELD(old_pktable_oid);
2737 WRITE_BOOL_FIELD(skip_validation);
2738 WRITE_BOOL_FIELD(initially_valid);
2741 case CONSTR_ATTR_DEFERRABLE:
2742 appendStringInfoString(str, "ATTR_DEFERRABLE");
2745 case CONSTR_ATTR_NOT_DEFERRABLE:
2746 appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
2749 case CONSTR_ATTR_DEFERRED:
2750 appendStringInfoString(str, "ATTR_DEFERRED");
2753 case CONSTR_ATTR_IMMEDIATE:
2754 appendStringInfoString(str, "ATTR_IMMEDIATE");
2758 appendStringInfo(str, "<unrecognized_constraint %d>",
2759 (int) node->contype);
2767 * converts a Node into ascii string and append it to 'str'
2770 _outNode(StringInfo str, const void *obj)
2773 appendStringInfoString(str, "<>");
2774 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
2776 else if (IsA(obj, Integer) ||
2779 IsA(obj, BitString))
2781 /* nodeRead does not want to see { } around these! */
2782 _outValue(str, obj);
2786 appendStringInfoChar(str, '{');
2787 switch (nodeTag(obj))
2790 _outPlannedStmt(str, obj);
2796 _outResult(str, obj);
2799 _outModifyTable(str, obj);
2802 _outAppend(str, obj);
2805 _outMergeAppend(str, obj);
2807 case T_RecursiveUnion:
2808 _outRecursiveUnion(str, obj);
2811 _outBitmapAnd(str, obj);
2814 _outBitmapOr(str, obj);
2820 _outSeqScan(str, obj);
2823 _outIndexScan(str, obj);
2825 case T_IndexOnlyScan:
2826 _outIndexOnlyScan(str, obj);
2828 case T_BitmapIndexScan:
2829 _outBitmapIndexScan(str, obj);
2831 case T_BitmapHeapScan:
2832 _outBitmapHeapScan(str, obj);
2835 _outTidScan(str, obj);
2837 case T_SubqueryScan:
2838 _outSubqueryScan(str, obj);
2840 case T_FunctionScan:
2841 _outFunctionScan(str, obj);
2844 _outValuesScan(str, obj);
2847 _outCteScan(str, obj);
2849 case T_WorkTableScan:
2850 _outWorkTableScan(str, obj);
2853 _outForeignScan(str, obj);
2859 _outNestLoop(str, obj);
2862 _outMergeJoin(str, obj);
2865 _outHashJoin(str, obj);
2871 _outWindowAgg(str, obj);
2874 _outGroup(str, obj);
2877 _outMaterial(str, obj);
2883 _outUnique(str, obj);
2889 _outSetOp(str, obj);
2892 _outLockRows(str, obj);
2895 _outLimit(str, obj);
2897 case T_NestLoopParam:
2898 _outNestLoopParam(str, obj);
2901 _outPlanRowMark(str, obj);
2903 case T_PlanInvalItem:
2904 _outPlanInvalItem(str, obj);
2907 _outAlias(str, obj);
2910 _outRangeVar(str, obj);
2913 _outIntoClause(str, obj);
2919 _outConst(str, obj);
2922 _outParam(str, obj);
2925 _outAggref(str, obj);
2928 _outWindowFunc(str, obj);
2931 _outArrayRef(str, obj);
2934 _outFuncExpr(str, obj);
2936 case T_NamedArgExpr:
2937 _outNamedArgExpr(str, obj);
2940 _outOpExpr(str, obj);
2942 case T_DistinctExpr:
2943 _outDistinctExpr(str, obj);
2946 _outNullIfExpr(str, obj);
2948 case T_ScalarArrayOpExpr:
2949 _outScalarArrayOpExpr(str, obj);
2952 _outBoolExpr(str, obj);
2955 _outSubLink(str, obj);
2958 _outSubPlan(str, obj);
2960 case T_AlternativeSubPlan:
2961 _outAlternativeSubPlan(str, obj);
2964 _outFieldSelect(str, obj);
2967 _outFieldStore(str, obj);
2970 _outRelabelType(str, obj);
2973 _outCoerceViaIO(str, obj);
2975 case T_ArrayCoerceExpr:
2976 _outArrayCoerceExpr(str, obj);
2978 case T_ConvertRowtypeExpr:
2979 _outConvertRowtypeExpr(str, obj);
2982 _outCollateExpr(str, obj);
2985 _outCaseExpr(str, obj);
2988 _outCaseWhen(str, obj);
2990 case T_CaseTestExpr:
2991 _outCaseTestExpr(str, obj);
2994 _outArrayExpr(str, obj);
2997 _outRowExpr(str, obj);
2999 case T_RowCompareExpr:
3000 _outRowCompareExpr(str, obj);
3002 case T_CoalesceExpr:
3003 _outCoalesceExpr(str, obj);
3006 _outMinMaxExpr(str, obj);
3009 _outXmlExpr(str, obj);
3012 _outNullTest(str, obj);
3015 _outBooleanTest(str, obj);
3017 case T_CoerceToDomain:
3018 _outCoerceToDomain(str, obj);
3020 case T_CoerceToDomainValue:
3021 _outCoerceToDomainValue(str, obj);
3023 case T_SetToDefault:
3024 _outSetToDefault(str, obj);
3026 case T_CurrentOfExpr:
3027 _outCurrentOfExpr(str, obj);
3030 _outTargetEntry(str, obj);
3033 _outRangeTblRef(str, obj);
3036 _outJoinExpr(str, obj);
3039 _outFromExpr(str, obj);
3046 _outIndexPath(str, obj);
3048 case T_BitmapHeapPath:
3049 _outBitmapHeapPath(str, obj);
3051 case T_BitmapAndPath:
3052 _outBitmapAndPath(str, obj);
3054 case T_BitmapOrPath:
3055 _outBitmapOrPath(str, obj);
3058 _outTidPath(str, obj);
3061 _outForeignPath(str, obj);
3064 _outAppendPath(str, obj);
3066 case T_MergeAppendPath:
3067 _outMergeAppendPath(str, obj);
3070 _outResultPath(str, obj);
3072 case T_MaterialPath:
3073 _outMaterialPath(str, obj);
3076 _outUniquePath(str, obj);
3079 _outNestPath(str, obj);
3082 _outMergePath(str, obj);
3085 _outHashPath(str, obj);
3087 case T_PlannerGlobal:
3088 _outPlannerGlobal(str, obj);
3091 _outPlannerInfo(str, obj);
3094 _outRelOptInfo(str, obj);
3096 case T_IndexOptInfo:
3097 _outIndexOptInfo(str, obj);
3099 case T_EquivalenceClass:
3100 _outEquivalenceClass(str, obj);
3102 case T_EquivalenceMember:
3103 _outEquivalenceMember(str, obj);
3106 _outPathKey(str, obj);
3108 case T_ParamPathInfo:
3109 _outParamPathInfo(str, obj);
3111 case T_RestrictInfo:
3112 _outRestrictInfo(str, obj);
3114 case T_PlaceHolderVar:
3115 _outPlaceHolderVar(str, obj);
3117 case T_SpecialJoinInfo:
3118 _outSpecialJoinInfo(str, obj);
3120 case T_LateralJoinInfo:
3121 _outLateralJoinInfo(str, obj);
3123 case T_AppendRelInfo:
3124 _outAppendRelInfo(str, obj);
3126 case T_PlaceHolderInfo:
3127 _outPlaceHolderInfo(str, obj);
3129 case T_MinMaxAggInfo:
3130 _outMinMaxAggInfo(str, obj);
3132 case T_PlannerParamItem:
3133 _outPlannerParamItem(str, obj);
3137 _outCreateStmt(str, obj);
3139 case T_CreateForeignTableStmt:
3140 _outCreateForeignTableStmt(str, obj);
3142 case T_ImportForeignSchemaStmt:
3143 _outImportForeignSchemaStmt(str, obj);
3146 _outIndexStmt(str, obj);
3149 _outNotifyStmt(str, obj);
3151 case T_DeclareCursorStmt:
3152 _outDeclareCursorStmt(str, obj);
3155 _outSelectStmt(str, obj);
3158 _outColumnDef(str, obj);
3161 _outTypeName(str, obj);
3164 _outTypeCast(str, obj);
3166 case T_CollateClause:
3167 _outCollateClause(str, obj);
3170 _outIndexElem(str, obj);
3173 _outQuery(str, obj);
3175 case T_WithCheckOption:
3176 _outWithCheckOption(str, obj);
3178 case T_SortGroupClause:
3179 _outSortGroupClause(str, obj);
3181 case T_WindowClause:
3182 _outWindowClause(str, obj);
3184 case T_RowMarkClause:
3185 _outRowMarkClause(str, obj);
3188 _outWithClause(str, obj);
3190 case T_CommonTableExpr:
3191 _outCommonTableExpr(str, obj);
3193 case T_SetOperationStmt:
3194 _outSetOperationStmt(str, obj);
3196 case T_RangeTblEntry:
3197 _outRangeTblEntry(str, obj);
3199 case T_RangeTblFunction:
3200 _outRangeTblFunction(str, obj);
3203 _outAExpr(str, obj);
3206 _outColumnRef(str, obj);
3209 _outParamRef(str, obj);
3212 _outAConst(str, obj);
3215 _outA_Star(str, obj);
3218 _outA_Indices(str, obj);
3220 case T_A_Indirection:
3221 _outA_Indirection(str, obj);
3224 _outA_ArrayExpr(str, obj);
3227 _outResTarget(str, obj);
3229 case T_MultiAssignRef:
3230 _outMultiAssignRef(str, obj);
3233 _outSortBy(str, obj);
3236 _outWindowDef(str, obj);
3238 case T_RangeSubselect:
3239 _outRangeSubselect(str, obj);
3241 case T_RangeFunction:
3242 _outRangeFunction(str, obj);
3245 _outConstraint(str, obj);
3248 _outFuncCall(str, obj);
3251 _outDefElem(str, obj);
3253 case T_TableLikeClause:
3254 _outTableLikeClause(str, obj);
3256 case T_LockingClause:
3257 _outLockingClause(str, obj);
3259 case T_XmlSerialize:
3260 _outXmlSerialize(str, obj);
3266 * This should be an ERROR, but it's too useful to be able to
3267 * dump structures that _outNode only understands part of.
3269 elog(WARNING, "could not dump unrecognized node type: %d",
3270 (int) nodeTag(obj));
3273 appendStringInfoChar(str, '}');
3279 * returns the ascii representation of the Node as a palloc'd string
3282 nodeToString(const void *obj)
3286 /* see stringinfo.h for an explanation of this maneuver */
3287 initStringInfo(&str);
3288 _outNode(&str, obj);