1 /*-------------------------------------------------------------------------
4 * Output functions for Postgres tree nodes.
6 * Portions Copyright (c) 1996-2015, 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)
189 appendStringInfoChar(str, '(');
190 appendStringInfoChar(str, 'b');
192 while ((x = bms_next_member(bms, x)) >= 0)
193 appendStringInfo(str, " %d", x);
194 appendStringInfoChar(str, ')');
198 * Print the value of a Datum given its type.
201 _outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
207 length = datumGetSize(value, typbyval, typlen);
211 s = (char *) (&value);
212 appendStringInfo(str, "%u [ ", (unsigned int) length);
213 for (i = 0; i < (Size) sizeof(Datum); i++)
214 appendStringInfo(str, "%d ", (int) (s[i]));
215 appendStringInfoChar(str, ']');
219 s = (char *) DatumGetPointer(value);
220 if (!PointerIsValid(s))
221 appendStringInfoString(str, "0 [ ]");
224 appendStringInfo(str, "%u [ ", (unsigned int) length);
225 for (i = 0; i < length; i++)
226 appendStringInfo(str, "%d ", (int) (s[i]));
227 appendStringInfoChar(str, ']');
234 * Stuff from plannodes.h
238 _outPlannedStmt(StringInfo str, const PlannedStmt *node)
240 WRITE_NODE_TYPE("PLANNEDSTMT");
242 WRITE_ENUM_FIELD(commandType, CmdType);
243 WRITE_UINT_FIELD(queryId);
244 WRITE_BOOL_FIELD(hasReturning);
245 WRITE_BOOL_FIELD(hasModifyingCTE);
246 WRITE_BOOL_FIELD(canSetTag);
247 WRITE_BOOL_FIELD(transientPlan);
248 WRITE_NODE_FIELD(planTree);
249 WRITE_NODE_FIELD(rtable);
250 WRITE_NODE_FIELD(resultRelations);
251 WRITE_NODE_FIELD(utilityStmt);
252 WRITE_NODE_FIELD(subplans);
253 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
254 WRITE_NODE_FIELD(rowMarks);
255 WRITE_NODE_FIELD(relationOids);
256 WRITE_NODE_FIELD(invalItems);
257 WRITE_INT_FIELD(nParamExec);
261 * print the basic stuff of all nodes that inherit from Plan
264 _outPlanInfo(StringInfo str, const Plan *node)
266 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
267 WRITE_FLOAT_FIELD(total_cost, "%.2f");
268 WRITE_FLOAT_FIELD(plan_rows, "%.0f");
269 WRITE_INT_FIELD(plan_width);
270 WRITE_NODE_FIELD(targetlist);
271 WRITE_NODE_FIELD(qual);
272 WRITE_NODE_FIELD(lefttree);
273 WRITE_NODE_FIELD(righttree);
274 WRITE_NODE_FIELD(initPlan);
275 WRITE_BITMAPSET_FIELD(extParam);
276 WRITE_BITMAPSET_FIELD(allParam);
280 * print the basic stuff of all nodes that inherit from Scan
283 _outScanInfo(StringInfo str, const Scan *node)
285 _outPlanInfo(str, (const Plan *) node);
287 WRITE_UINT_FIELD(scanrelid);
291 * print the basic stuff of all nodes that inherit from Join
294 _outJoinPlanInfo(StringInfo str, const Join *node)
296 _outPlanInfo(str, (const Plan *) node);
298 WRITE_ENUM_FIELD(jointype, JoinType);
299 WRITE_NODE_FIELD(joinqual);
304 _outPlan(StringInfo str, const Plan *node)
306 WRITE_NODE_TYPE("PLAN");
308 _outPlanInfo(str, (const Plan *) node);
312 _outResult(StringInfo str, const Result *node)
314 WRITE_NODE_TYPE("RESULT");
316 _outPlanInfo(str, (const Plan *) node);
318 WRITE_NODE_FIELD(resconstantqual);
322 _outModifyTable(StringInfo str, const ModifyTable *node)
324 WRITE_NODE_TYPE("MODIFYTABLE");
326 _outPlanInfo(str, (const Plan *) node);
328 WRITE_ENUM_FIELD(operation, CmdType);
329 WRITE_BOOL_FIELD(canSetTag);
330 WRITE_UINT_FIELD(nominalRelation);
331 WRITE_NODE_FIELD(resultRelations);
332 WRITE_INT_FIELD(resultRelIndex);
333 WRITE_NODE_FIELD(plans);
334 WRITE_NODE_FIELD(withCheckOptionLists);
335 WRITE_NODE_FIELD(returningLists);
336 WRITE_NODE_FIELD(fdwPrivLists);
337 WRITE_NODE_FIELD(rowMarks);
338 WRITE_INT_FIELD(epqParam);
342 _outAppend(StringInfo str, const Append *node)
344 WRITE_NODE_TYPE("APPEND");
346 _outPlanInfo(str, (const Plan *) node);
348 WRITE_NODE_FIELD(appendplans);
352 _outMergeAppend(StringInfo str, const MergeAppend *node)
356 WRITE_NODE_TYPE("MERGEAPPEND");
358 _outPlanInfo(str, (const Plan *) node);
360 WRITE_NODE_FIELD(mergeplans);
362 WRITE_INT_FIELD(numCols);
364 appendStringInfoString(str, " :sortColIdx");
365 for (i = 0; i < node->numCols; i++)
366 appendStringInfo(str, " %d", node->sortColIdx[i]);
368 appendStringInfoString(str, " :sortOperators");
369 for (i = 0; i < node->numCols; i++)
370 appendStringInfo(str, " %u", node->sortOperators[i]);
372 appendStringInfoString(str, " :collations");
373 for (i = 0; i < node->numCols; i++)
374 appendStringInfo(str, " %u", node->collations[i]);
376 appendStringInfoString(str, " :nullsFirst");
377 for (i = 0; i < node->numCols; i++)
378 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
382 _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
386 WRITE_NODE_TYPE("RECURSIVEUNION");
388 _outPlanInfo(str, (const Plan *) node);
390 WRITE_INT_FIELD(wtParam);
391 WRITE_INT_FIELD(numCols);
393 appendStringInfoString(str, " :dupColIdx");
394 for (i = 0; i < node->numCols; i++)
395 appendStringInfo(str, " %d", node->dupColIdx[i]);
397 appendStringInfoString(str, " :dupOperators");
398 for (i = 0; i < node->numCols; i++)
399 appendStringInfo(str, " %u", node->dupOperators[i]);
401 WRITE_LONG_FIELD(numGroups);
405 _outBitmapAnd(StringInfo str, const BitmapAnd *node)
407 WRITE_NODE_TYPE("BITMAPAND");
409 _outPlanInfo(str, (const Plan *) node);
411 WRITE_NODE_FIELD(bitmapplans);
415 _outBitmapOr(StringInfo str, const BitmapOr *node)
417 WRITE_NODE_TYPE("BITMAPOR");
419 _outPlanInfo(str, (const Plan *) node);
421 WRITE_NODE_FIELD(bitmapplans);
425 _outScan(StringInfo str, const Scan *node)
427 WRITE_NODE_TYPE("SCAN");
429 _outScanInfo(str, node);
433 _outSeqScan(StringInfo str, const SeqScan *node)
435 WRITE_NODE_TYPE("SEQSCAN");
437 _outScanInfo(str, (const Scan *) node);
441 _outIndexScan(StringInfo str, const IndexScan *node)
443 WRITE_NODE_TYPE("INDEXSCAN");
445 _outScanInfo(str, (const Scan *) node);
447 WRITE_OID_FIELD(indexid);
448 WRITE_NODE_FIELD(indexqual);
449 WRITE_NODE_FIELD(indexqualorig);
450 WRITE_NODE_FIELD(indexorderby);
451 WRITE_NODE_FIELD(indexorderbyorig);
452 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
456 _outIndexOnlyScan(StringInfo str, const IndexOnlyScan *node)
458 WRITE_NODE_TYPE("INDEXONLYSCAN");
460 _outScanInfo(str, (const Scan *) node);
462 WRITE_OID_FIELD(indexid);
463 WRITE_NODE_FIELD(indexqual);
464 WRITE_NODE_FIELD(indexorderby);
465 WRITE_NODE_FIELD(indextlist);
466 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
470 _outBitmapIndexScan(StringInfo str, const BitmapIndexScan *node)
472 WRITE_NODE_TYPE("BITMAPINDEXSCAN");
474 _outScanInfo(str, (const Scan *) node);
476 WRITE_OID_FIELD(indexid);
477 WRITE_NODE_FIELD(indexqual);
478 WRITE_NODE_FIELD(indexqualorig);
482 _outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
484 WRITE_NODE_TYPE("BITMAPHEAPSCAN");
486 _outScanInfo(str, (const Scan *) node);
488 WRITE_NODE_FIELD(bitmapqualorig);
492 _outTidScan(StringInfo str, const TidScan *node)
494 WRITE_NODE_TYPE("TIDSCAN");
496 _outScanInfo(str, (const Scan *) node);
498 WRITE_NODE_FIELD(tidquals);
502 _outSubqueryScan(StringInfo str, const SubqueryScan *node)
504 WRITE_NODE_TYPE("SUBQUERYSCAN");
506 _outScanInfo(str, (const Scan *) node);
508 WRITE_NODE_FIELD(subplan);
512 _outFunctionScan(StringInfo str, const FunctionScan *node)
514 WRITE_NODE_TYPE("FUNCTIONSCAN");
516 _outScanInfo(str, (const Scan *) node);
518 WRITE_NODE_FIELD(functions);
519 WRITE_BOOL_FIELD(funcordinality);
523 _outValuesScan(StringInfo str, const ValuesScan *node)
525 WRITE_NODE_TYPE("VALUESSCAN");
527 _outScanInfo(str, (const Scan *) node);
529 WRITE_NODE_FIELD(values_lists);
533 _outCteScan(StringInfo str, const CteScan *node)
535 WRITE_NODE_TYPE("CTESCAN");
537 _outScanInfo(str, (const Scan *) node);
539 WRITE_INT_FIELD(ctePlanId);
540 WRITE_INT_FIELD(cteParam);
544 _outWorkTableScan(StringInfo str, const WorkTableScan *node)
546 WRITE_NODE_TYPE("WORKTABLESCAN");
548 _outScanInfo(str, (const Scan *) node);
550 WRITE_INT_FIELD(wtParam);
554 _outForeignScan(StringInfo str, const ForeignScan *node)
556 WRITE_NODE_TYPE("FOREIGNSCAN");
558 _outScanInfo(str, (const Scan *) node);
560 WRITE_NODE_FIELD(fdw_exprs);
561 WRITE_NODE_FIELD(fdw_private);
562 WRITE_BOOL_FIELD(fsSystemCol);
566 _outCustomScan(StringInfo str, const CustomScan *node)
568 WRITE_NODE_TYPE("CUSTOMSCAN");
570 _outScanInfo(str, (const Scan *) node);
572 WRITE_UINT_FIELD(flags);
573 WRITE_NODE_FIELD(custom_exprs);
574 WRITE_NODE_FIELD(custom_private);
575 appendStringInfoString(str, " :methods ");
576 _outToken(str, node->methods->CustomName);
577 if (node->methods->TextOutCustomScan)
578 node->methods->TextOutCustomScan(str, node);
582 _outJoin(StringInfo str, const Join *node)
584 WRITE_NODE_TYPE("JOIN");
586 _outJoinPlanInfo(str, (const Join *) node);
590 _outNestLoop(StringInfo str, const NestLoop *node)
592 WRITE_NODE_TYPE("NESTLOOP");
594 _outJoinPlanInfo(str, (const Join *) node);
596 WRITE_NODE_FIELD(nestParams);
600 _outMergeJoin(StringInfo str, const MergeJoin *node)
605 WRITE_NODE_TYPE("MERGEJOIN");
607 _outJoinPlanInfo(str, (const Join *) node);
609 WRITE_NODE_FIELD(mergeclauses);
611 numCols = list_length(node->mergeclauses);
613 appendStringInfoString(str, " :mergeFamilies");
614 for (i = 0; i < numCols; i++)
615 appendStringInfo(str, " %u", node->mergeFamilies[i]);
617 appendStringInfoString(str, " :mergeCollations");
618 for (i = 0; i < numCols; i++)
619 appendStringInfo(str, " %u", node->mergeCollations[i]);
621 appendStringInfoString(str, " :mergeStrategies");
622 for (i = 0; i < numCols; i++)
623 appendStringInfo(str, " %d", node->mergeStrategies[i]);
625 appendStringInfoString(str, " :mergeNullsFirst");
626 for (i = 0; i < numCols; i++)
627 appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
631 _outHashJoin(StringInfo str, const HashJoin *node)
633 WRITE_NODE_TYPE("HASHJOIN");
635 _outJoinPlanInfo(str, (const Join *) node);
637 WRITE_NODE_FIELD(hashclauses);
641 _outAgg(StringInfo str, const Agg *node)
645 WRITE_NODE_TYPE("AGG");
647 _outPlanInfo(str, (const Plan *) node);
649 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
650 WRITE_INT_FIELD(numCols);
652 appendStringInfoString(str, " :grpColIdx");
653 for (i = 0; i < node->numCols; i++)
654 appendStringInfo(str, " %d", node->grpColIdx[i]);
656 appendStringInfoString(str, " :grpOperators");
657 for (i = 0; i < node->numCols; i++)
658 appendStringInfo(str, " %u", node->grpOperators[i]);
660 WRITE_LONG_FIELD(numGroups);
664 _outWindowAgg(StringInfo str, const WindowAgg *node)
668 WRITE_NODE_TYPE("WINDOWAGG");
670 _outPlanInfo(str, (const Plan *) node);
672 WRITE_UINT_FIELD(winref);
673 WRITE_INT_FIELD(partNumCols);
675 appendStringInfoString(str, " :partColIdx");
676 for (i = 0; i < node->partNumCols; i++)
677 appendStringInfo(str, " %d", node->partColIdx[i]);
679 appendStringInfoString(str, " :partOperations");
680 for (i = 0; i < node->partNumCols; i++)
681 appendStringInfo(str, " %u", node->partOperators[i]);
683 WRITE_INT_FIELD(ordNumCols);
685 appendStringInfoString(str, " :ordColIdx");
686 for (i = 0; i < node->ordNumCols; i++)
687 appendStringInfo(str, " %d", node->ordColIdx[i]);
689 appendStringInfoString(str, " :ordOperations");
690 for (i = 0; i < node->ordNumCols; i++)
691 appendStringInfo(str, " %u", node->ordOperators[i]);
693 WRITE_INT_FIELD(frameOptions);
694 WRITE_NODE_FIELD(startOffset);
695 WRITE_NODE_FIELD(endOffset);
699 _outGroup(StringInfo str, const Group *node)
703 WRITE_NODE_TYPE("GROUP");
705 _outPlanInfo(str, (const Plan *) node);
707 WRITE_INT_FIELD(numCols);
709 appendStringInfoString(str, " :grpColIdx");
710 for (i = 0; i < node->numCols; i++)
711 appendStringInfo(str, " %d", node->grpColIdx[i]);
713 appendStringInfoString(str, " :grpOperators");
714 for (i = 0; i < node->numCols; i++)
715 appendStringInfo(str, " %u", node->grpOperators[i]);
719 _outMaterial(StringInfo str, const Material *node)
721 WRITE_NODE_TYPE("MATERIAL");
723 _outPlanInfo(str, (const Plan *) node);
727 _outSort(StringInfo str, const Sort *node)
731 WRITE_NODE_TYPE("SORT");
733 _outPlanInfo(str, (const Plan *) node);
735 WRITE_INT_FIELD(numCols);
737 appendStringInfoString(str, " :sortColIdx");
738 for (i = 0; i < node->numCols; i++)
739 appendStringInfo(str, " %d", node->sortColIdx[i]);
741 appendStringInfoString(str, " :sortOperators");
742 for (i = 0; i < node->numCols; i++)
743 appendStringInfo(str, " %u", node->sortOperators[i]);
745 appendStringInfoString(str, " :collations");
746 for (i = 0; i < node->numCols; i++)
747 appendStringInfo(str, " %u", node->collations[i]);
749 appendStringInfoString(str, " :nullsFirst");
750 for (i = 0; i < node->numCols; i++)
751 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
755 _outUnique(StringInfo str, const Unique *node)
759 WRITE_NODE_TYPE("UNIQUE");
761 _outPlanInfo(str, (const Plan *) node);
763 WRITE_INT_FIELD(numCols);
765 appendStringInfoString(str, " :uniqColIdx");
766 for (i = 0; i < node->numCols; i++)
767 appendStringInfo(str, " %d", node->uniqColIdx[i]);
769 appendStringInfoString(str, " :uniqOperators");
770 for (i = 0; i < node->numCols; i++)
771 appendStringInfo(str, " %u", node->uniqOperators[i]);
775 _outHash(StringInfo str, const Hash *node)
777 WRITE_NODE_TYPE("HASH");
779 _outPlanInfo(str, (const Plan *) node);
781 WRITE_OID_FIELD(skewTable);
782 WRITE_INT_FIELD(skewColumn);
783 WRITE_BOOL_FIELD(skewInherit);
784 WRITE_OID_FIELD(skewColType);
785 WRITE_INT_FIELD(skewColTypmod);
789 _outSetOp(StringInfo str, const SetOp *node)
793 WRITE_NODE_TYPE("SETOP");
795 _outPlanInfo(str, (const Plan *) node);
797 WRITE_ENUM_FIELD(cmd, SetOpCmd);
798 WRITE_ENUM_FIELD(strategy, SetOpStrategy);
799 WRITE_INT_FIELD(numCols);
801 appendStringInfoString(str, " :dupColIdx");
802 for (i = 0; i < node->numCols; i++)
803 appendStringInfo(str, " %d", node->dupColIdx[i]);
805 appendStringInfoString(str, " :dupOperators");
806 for (i = 0; i < node->numCols; i++)
807 appendStringInfo(str, " %u", node->dupOperators[i]);
809 WRITE_INT_FIELD(flagColIdx);
810 WRITE_INT_FIELD(firstFlag);
811 WRITE_LONG_FIELD(numGroups);
815 _outLockRows(StringInfo str, const LockRows *node)
817 WRITE_NODE_TYPE("LOCKROWS");
819 _outPlanInfo(str, (const Plan *) node);
821 WRITE_NODE_FIELD(rowMarks);
822 WRITE_INT_FIELD(epqParam);
826 _outLimit(StringInfo str, const Limit *node)
828 WRITE_NODE_TYPE("LIMIT");
830 _outPlanInfo(str, (const Plan *) node);
832 WRITE_NODE_FIELD(limitOffset);
833 WRITE_NODE_FIELD(limitCount);
837 _outNestLoopParam(StringInfo str, const NestLoopParam *node)
839 WRITE_NODE_TYPE("NESTLOOPPARAM");
841 WRITE_INT_FIELD(paramno);
842 WRITE_NODE_FIELD(paramval);
846 _outPlanRowMark(StringInfo str, const PlanRowMark *node)
848 WRITE_NODE_TYPE("PLANROWMARK");
850 WRITE_UINT_FIELD(rti);
851 WRITE_UINT_FIELD(prti);
852 WRITE_UINT_FIELD(rowmarkId);
853 WRITE_ENUM_FIELD(markType, RowMarkType);
854 WRITE_BOOL_FIELD(waitPolicy);
855 WRITE_BOOL_FIELD(isParent);
859 _outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
861 WRITE_NODE_TYPE("PLANINVALITEM");
863 WRITE_INT_FIELD(cacheId);
864 WRITE_UINT_FIELD(hashValue);
867 /*****************************************************************************
869 * Stuff from primnodes.h.
871 *****************************************************************************/
874 _outAlias(StringInfo str, const Alias *node)
876 WRITE_NODE_TYPE("ALIAS");
878 WRITE_STRING_FIELD(aliasname);
879 WRITE_NODE_FIELD(colnames);
883 _outRangeVar(StringInfo str, const RangeVar *node)
885 WRITE_NODE_TYPE("RANGEVAR");
888 * we deliberately ignore catalogname here, since it is presently not
889 * semantically meaningful
891 WRITE_STRING_FIELD(schemaname);
892 WRITE_STRING_FIELD(relname);
893 WRITE_ENUM_FIELD(inhOpt, InhOption);
894 WRITE_CHAR_FIELD(relpersistence);
895 WRITE_NODE_FIELD(alias);
896 WRITE_LOCATION_FIELD(location);
900 _outIntoClause(StringInfo str, const IntoClause *node)
902 WRITE_NODE_TYPE("INTOCLAUSE");
904 WRITE_NODE_FIELD(rel);
905 WRITE_NODE_FIELD(colNames);
906 WRITE_NODE_FIELD(options);
907 WRITE_ENUM_FIELD(onCommit, OnCommitAction);
908 WRITE_STRING_FIELD(tableSpaceName);
909 WRITE_NODE_FIELD(viewQuery);
910 WRITE_BOOL_FIELD(skipData);
914 _outVar(StringInfo str, const Var *node)
916 WRITE_NODE_TYPE("VAR");
918 WRITE_UINT_FIELD(varno);
919 WRITE_INT_FIELD(varattno);
920 WRITE_OID_FIELD(vartype);
921 WRITE_INT_FIELD(vartypmod);
922 WRITE_OID_FIELD(varcollid);
923 WRITE_UINT_FIELD(varlevelsup);
924 WRITE_UINT_FIELD(varnoold);
925 WRITE_INT_FIELD(varoattno);
926 WRITE_LOCATION_FIELD(location);
930 _outConst(StringInfo str, const Const *node)
932 WRITE_NODE_TYPE("CONST");
934 WRITE_OID_FIELD(consttype);
935 WRITE_INT_FIELD(consttypmod);
936 WRITE_OID_FIELD(constcollid);
937 WRITE_INT_FIELD(constlen);
938 WRITE_BOOL_FIELD(constbyval);
939 WRITE_BOOL_FIELD(constisnull);
940 WRITE_LOCATION_FIELD(location);
942 appendStringInfoString(str, " :constvalue ");
943 if (node->constisnull)
944 appendStringInfoString(str, "<>");
946 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
950 _outParam(StringInfo str, const Param *node)
952 WRITE_NODE_TYPE("PARAM");
954 WRITE_ENUM_FIELD(paramkind, ParamKind);
955 WRITE_INT_FIELD(paramid);
956 WRITE_OID_FIELD(paramtype);
957 WRITE_INT_FIELD(paramtypmod);
958 WRITE_OID_FIELD(paramcollid);
959 WRITE_LOCATION_FIELD(location);
963 _outAggref(StringInfo str, const Aggref *node)
965 WRITE_NODE_TYPE("AGGREF");
967 WRITE_OID_FIELD(aggfnoid);
968 WRITE_OID_FIELD(aggtype);
969 WRITE_OID_FIELD(aggcollid);
970 WRITE_OID_FIELD(inputcollid);
971 WRITE_NODE_FIELD(aggdirectargs);
972 WRITE_NODE_FIELD(args);
973 WRITE_NODE_FIELD(aggorder);
974 WRITE_NODE_FIELD(aggdistinct);
975 WRITE_NODE_FIELD(aggfilter);
976 WRITE_BOOL_FIELD(aggstar);
977 WRITE_BOOL_FIELD(aggvariadic);
978 WRITE_CHAR_FIELD(aggkind);
979 WRITE_UINT_FIELD(agglevelsup);
980 WRITE_LOCATION_FIELD(location);
984 _outWindowFunc(StringInfo str, const WindowFunc *node)
986 WRITE_NODE_TYPE("WINDOWFUNC");
988 WRITE_OID_FIELD(winfnoid);
989 WRITE_OID_FIELD(wintype);
990 WRITE_OID_FIELD(wincollid);
991 WRITE_OID_FIELD(inputcollid);
992 WRITE_NODE_FIELD(args);
993 WRITE_NODE_FIELD(aggfilter);
994 WRITE_UINT_FIELD(winref);
995 WRITE_BOOL_FIELD(winstar);
996 WRITE_BOOL_FIELD(winagg);
997 WRITE_LOCATION_FIELD(location);
1001 _outArrayRef(StringInfo str, const ArrayRef *node)
1003 WRITE_NODE_TYPE("ARRAYREF");
1005 WRITE_OID_FIELD(refarraytype);
1006 WRITE_OID_FIELD(refelemtype);
1007 WRITE_INT_FIELD(reftypmod);
1008 WRITE_OID_FIELD(refcollid);
1009 WRITE_NODE_FIELD(refupperindexpr);
1010 WRITE_NODE_FIELD(reflowerindexpr);
1011 WRITE_NODE_FIELD(refexpr);
1012 WRITE_NODE_FIELD(refassgnexpr);
1016 _outFuncExpr(StringInfo str, const FuncExpr *node)
1018 WRITE_NODE_TYPE("FUNCEXPR");
1020 WRITE_OID_FIELD(funcid);
1021 WRITE_OID_FIELD(funcresulttype);
1022 WRITE_BOOL_FIELD(funcretset);
1023 WRITE_BOOL_FIELD(funcvariadic);
1024 WRITE_ENUM_FIELD(funcformat, CoercionForm);
1025 WRITE_OID_FIELD(funccollid);
1026 WRITE_OID_FIELD(inputcollid);
1027 WRITE_NODE_FIELD(args);
1028 WRITE_LOCATION_FIELD(location);
1032 _outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
1034 WRITE_NODE_TYPE("NAMEDARGEXPR");
1036 WRITE_NODE_FIELD(arg);
1037 WRITE_STRING_FIELD(name);
1038 WRITE_INT_FIELD(argnumber);
1039 WRITE_LOCATION_FIELD(location);
1043 _outOpExpr(StringInfo str, const OpExpr *node)
1045 WRITE_NODE_TYPE("OPEXPR");
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 _outDistinctExpr(StringInfo str, const DistinctExpr *node)
1060 WRITE_NODE_TYPE("DISTINCTEXPR");
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 _outNullIfExpr(StringInfo str, const NullIfExpr *node)
1075 WRITE_NODE_TYPE("NULLIFEXPR");
1077 WRITE_OID_FIELD(opno);
1078 WRITE_OID_FIELD(opfuncid);
1079 WRITE_OID_FIELD(opresulttype);
1080 WRITE_BOOL_FIELD(opretset);
1081 WRITE_OID_FIELD(opcollid);
1082 WRITE_OID_FIELD(inputcollid);
1083 WRITE_NODE_FIELD(args);
1084 WRITE_LOCATION_FIELD(location);
1088 _outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
1090 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
1092 WRITE_OID_FIELD(opno);
1093 WRITE_OID_FIELD(opfuncid);
1094 WRITE_BOOL_FIELD(useOr);
1095 WRITE_OID_FIELD(inputcollid);
1096 WRITE_NODE_FIELD(args);
1097 WRITE_LOCATION_FIELD(location);
1101 _outBoolExpr(StringInfo str, const BoolExpr *node)
1105 WRITE_NODE_TYPE("BOOLEXPR");
1107 /* do-it-yourself enum representation */
1108 switch (node->boolop)
1120 appendStringInfoString(str, " :boolop ");
1121 _outToken(str, opstr);
1123 WRITE_NODE_FIELD(args);
1124 WRITE_LOCATION_FIELD(location);
1128 _outSubLink(StringInfo str, const SubLink *node)
1130 WRITE_NODE_TYPE("SUBLINK");
1132 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1133 WRITE_INT_FIELD(subLinkId);
1134 WRITE_NODE_FIELD(testexpr);
1135 WRITE_NODE_FIELD(operName);
1136 WRITE_NODE_FIELD(subselect);
1137 WRITE_LOCATION_FIELD(location);
1141 _outSubPlan(StringInfo str, const SubPlan *node)
1143 WRITE_NODE_TYPE("SUBPLAN");
1145 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1146 WRITE_NODE_FIELD(testexpr);
1147 WRITE_NODE_FIELD(paramIds);
1148 WRITE_INT_FIELD(plan_id);
1149 WRITE_STRING_FIELD(plan_name);
1150 WRITE_OID_FIELD(firstColType);
1151 WRITE_INT_FIELD(firstColTypmod);
1152 WRITE_OID_FIELD(firstColCollation);
1153 WRITE_BOOL_FIELD(useHashTable);
1154 WRITE_BOOL_FIELD(unknownEqFalse);
1155 WRITE_NODE_FIELD(setParam);
1156 WRITE_NODE_FIELD(parParam);
1157 WRITE_NODE_FIELD(args);
1158 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1159 WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
1163 _outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
1165 WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
1167 WRITE_NODE_FIELD(subplans);
1171 _outFieldSelect(StringInfo str, const FieldSelect *node)
1173 WRITE_NODE_TYPE("FIELDSELECT");
1175 WRITE_NODE_FIELD(arg);
1176 WRITE_INT_FIELD(fieldnum);
1177 WRITE_OID_FIELD(resulttype);
1178 WRITE_INT_FIELD(resulttypmod);
1179 WRITE_OID_FIELD(resultcollid);
1183 _outFieldStore(StringInfo str, const FieldStore *node)
1185 WRITE_NODE_TYPE("FIELDSTORE");
1187 WRITE_NODE_FIELD(arg);
1188 WRITE_NODE_FIELD(newvals);
1189 WRITE_NODE_FIELD(fieldnums);
1190 WRITE_OID_FIELD(resulttype);
1194 _outRelabelType(StringInfo str, const RelabelType *node)
1196 WRITE_NODE_TYPE("RELABELTYPE");
1198 WRITE_NODE_FIELD(arg);
1199 WRITE_OID_FIELD(resulttype);
1200 WRITE_INT_FIELD(resulttypmod);
1201 WRITE_OID_FIELD(resultcollid);
1202 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
1203 WRITE_LOCATION_FIELD(location);
1207 _outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
1209 WRITE_NODE_TYPE("COERCEVIAIO");
1211 WRITE_NODE_FIELD(arg);
1212 WRITE_OID_FIELD(resulttype);
1213 WRITE_OID_FIELD(resultcollid);
1214 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1215 WRITE_LOCATION_FIELD(location);
1219 _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
1221 WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
1223 WRITE_NODE_FIELD(arg);
1224 WRITE_OID_FIELD(elemfuncid);
1225 WRITE_OID_FIELD(resulttype);
1226 WRITE_INT_FIELD(resulttypmod);
1227 WRITE_OID_FIELD(resultcollid);
1228 WRITE_BOOL_FIELD(isExplicit);
1229 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1230 WRITE_LOCATION_FIELD(location);
1234 _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
1236 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
1238 WRITE_NODE_FIELD(arg);
1239 WRITE_OID_FIELD(resulttype);
1240 WRITE_ENUM_FIELD(convertformat, CoercionForm);
1241 WRITE_LOCATION_FIELD(location);
1245 _outCollateExpr(StringInfo str, const CollateExpr *node)
1247 WRITE_NODE_TYPE("COLLATE");
1249 WRITE_NODE_FIELD(arg);
1250 WRITE_OID_FIELD(collOid);
1251 WRITE_LOCATION_FIELD(location);
1255 _outCaseExpr(StringInfo str, const CaseExpr *node)
1257 WRITE_NODE_TYPE("CASE");
1259 WRITE_OID_FIELD(casetype);
1260 WRITE_OID_FIELD(casecollid);
1261 WRITE_NODE_FIELD(arg);
1262 WRITE_NODE_FIELD(args);
1263 WRITE_NODE_FIELD(defresult);
1264 WRITE_LOCATION_FIELD(location);
1268 _outCaseWhen(StringInfo str, const CaseWhen *node)
1270 WRITE_NODE_TYPE("WHEN");
1272 WRITE_NODE_FIELD(expr);
1273 WRITE_NODE_FIELD(result);
1274 WRITE_LOCATION_FIELD(location);
1278 _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
1280 WRITE_NODE_TYPE("CASETESTEXPR");
1282 WRITE_OID_FIELD(typeId);
1283 WRITE_INT_FIELD(typeMod);
1284 WRITE_OID_FIELD(collation);
1288 _outArrayExpr(StringInfo str, const ArrayExpr *node)
1290 WRITE_NODE_TYPE("ARRAY");
1292 WRITE_OID_FIELD(array_typeid);
1293 WRITE_OID_FIELD(array_collid);
1294 WRITE_OID_FIELD(element_typeid);
1295 WRITE_NODE_FIELD(elements);
1296 WRITE_BOOL_FIELD(multidims);
1297 WRITE_LOCATION_FIELD(location);
1301 _outRowExpr(StringInfo str, const RowExpr *node)
1303 WRITE_NODE_TYPE("ROW");
1305 WRITE_NODE_FIELD(args);
1306 WRITE_OID_FIELD(row_typeid);
1307 WRITE_ENUM_FIELD(row_format, CoercionForm);
1308 WRITE_NODE_FIELD(colnames);
1309 WRITE_LOCATION_FIELD(location);
1313 _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
1315 WRITE_NODE_TYPE("ROWCOMPARE");
1317 WRITE_ENUM_FIELD(rctype, RowCompareType);
1318 WRITE_NODE_FIELD(opnos);
1319 WRITE_NODE_FIELD(opfamilies);
1320 WRITE_NODE_FIELD(inputcollids);
1321 WRITE_NODE_FIELD(largs);
1322 WRITE_NODE_FIELD(rargs);
1326 _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
1328 WRITE_NODE_TYPE("COALESCE");
1330 WRITE_OID_FIELD(coalescetype);
1331 WRITE_OID_FIELD(coalescecollid);
1332 WRITE_NODE_FIELD(args);
1333 WRITE_LOCATION_FIELD(location);
1337 _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
1339 WRITE_NODE_TYPE("MINMAX");
1341 WRITE_OID_FIELD(minmaxtype);
1342 WRITE_OID_FIELD(minmaxcollid);
1343 WRITE_OID_FIELD(inputcollid);
1344 WRITE_ENUM_FIELD(op, MinMaxOp);
1345 WRITE_NODE_FIELD(args);
1346 WRITE_LOCATION_FIELD(location);
1350 _outXmlExpr(StringInfo str, const XmlExpr *node)
1352 WRITE_NODE_TYPE("XMLEXPR");
1354 WRITE_ENUM_FIELD(op, XmlExprOp);
1355 WRITE_STRING_FIELD(name);
1356 WRITE_NODE_FIELD(named_args);
1357 WRITE_NODE_FIELD(arg_names);
1358 WRITE_NODE_FIELD(args);
1359 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
1360 WRITE_OID_FIELD(type);
1361 WRITE_INT_FIELD(typmod);
1362 WRITE_LOCATION_FIELD(location);
1366 _outNullTest(StringInfo str, const NullTest *node)
1368 WRITE_NODE_TYPE("NULLTEST");
1370 WRITE_NODE_FIELD(arg);
1371 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
1372 WRITE_BOOL_FIELD(argisrow);
1373 WRITE_LOCATION_FIELD(location);
1377 _outBooleanTest(StringInfo str, const BooleanTest *node)
1379 WRITE_NODE_TYPE("BOOLEANTEST");
1381 WRITE_NODE_FIELD(arg);
1382 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
1383 WRITE_LOCATION_FIELD(location);
1387 _outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
1389 WRITE_NODE_TYPE("COERCETODOMAIN");
1391 WRITE_NODE_FIELD(arg);
1392 WRITE_OID_FIELD(resulttype);
1393 WRITE_INT_FIELD(resulttypmod);
1394 WRITE_OID_FIELD(resultcollid);
1395 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
1396 WRITE_LOCATION_FIELD(location);
1400 _outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
1402 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
1404 WRITE_OID_FIELD(typeId);
1405 WRITE_INT_FIELD(typeMod);
1406 WRITE_OID_FIELD(collation);
1407 WRITE_LOCATION_FIELD(location);
1411 _outSetToDefault(StringInfo str, const SetToDefault *node)
1413 WRITE_NODE_TYPE("SETTODEFAULT");
1415 WRITE_OID_FIELD(typeId);
1416 WRITE_INT_FIELD(typeMod);
1417 WRITE_OID_FIELD(collation);
1418 WRITE_LOCATION_FIELD(location);
1422 _outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
1424 WRITE_NODE_TYPE("CURRENTOFEXPR");
1426 WRITE_UINT_FIELD(cvarno);
1427 WRITE_STRING_FIELD(cursor_name);
1428 WRITE_INT_FIELD(cursor_param);
1432 _outTargetEntry(StringInfo str, const TargetEntry *node)
1434 WRITE_NODE_TYPE("TARGETENTRY");
1436 WRITE_NODE_FIELD(expr);
1437 WRITE_INT_FIELD(resno);
1438 WRITE_STRING_FIELD(resname);
1439 WRITE_UINT_FIELD(ressortgroupref);
1440 WRITE_OID_FIELD(resorigtbl);
1441 WRITE_INT_FIELD(resorigcol);
1442 WRITE_BOOL_FIELD(resjunk);
1446 _outRangeTblRef(StringInfo str, const RangeTblRef *node)
1448 WRITE_NODE_TYPE("RANGETBLREF");
1450 WRITE_INT_FIELD(rtindex);
1454 _outJoinExpr(StringInfo str, const JoinExpr *node)
1456 WRITE_NODE_TYPE("JOINEXPR");
1458 WRITE_ENUM_FIELD(jointype, JoinType);
1459 WRITE_BOOL_FIELD(isNatural);
1460 WRITE_NODE_FIELD(larg);
1461 WRITE_NODE_FIELD(rarg);
1462 WRITE_NODE_FIELD(usingClause);
1463 WRITE_NODE_FIELD(quals);
1464 WRITE_NODE_FIELD(alias);
1465 WRITE_INT_FIELD(rtindex);
1469 _outFromExpr(StringInfo str, const FromExpr *node)
1471 WRITE_NODE_TYPE("FROMEXPR");
1473 WRITE_NODE_FIELD(fromlist);
1474 WRITE_NODE_FIELD(quals);
1477 /*****************************************************************************
1479 * Stuff from relation.h.
1481 *****************************************************************************/
1484 * print the basic stuff of all nodes that inherit from Path
1486 * Note we do NOT print the parent, else we'd be in infinite recursion.
1487 * We can print the parent's relids for identification purposes, though.
1488 * We also do not print the whole of param_info, since it's printed by
1489 * _outRelOptInfo; it's sufficient and less cluttering to print just the
1490 * required outer relids.
1493 _outPathInfo(StringInfo str, const Path *node)
1495 WRITE_ENUM_FIELD(pathtype, NodeTag);
1496 appendStringInfoString(str, " :parent_relids ");
1498 _outBitmapset(str, node->parent->relids);
1500 _outBitmapset(str, NULL);
1501 appendStringInfoString(str, " :required_outer ");
1502 if (node->param_info)
1503 _outBitmapset(str, node->param_info->ppi_req_outer);
1505 _outBitmapset(str, NULL);
1506 WRITE_FLOAT_FIELD(rows, "%.0f");
1507 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1508 WRITE_FLOAT_FIELD(total_cost, "%.2f");
1509 WRITE_NODE_FIELD(pathkeys);
1513 * print the basic stuff of all nodes that inherit from JoinPath
1516 _outJoinPathInfo(StringInfo str, const JoinPath *node)
1518 _outPathInfo(str, (const Path *) node);
1520 WRITE_ENUM_FIELD(jointype, JoinType);
1521 WRITE_NODE_FIELD(outerjoinpath);
1522 WRITE_NODE_FIELD(innerjoinpath);
1523 WRITE_NODE_FIELD(joinrestrictinfo);
1527 _outPath(StringInfo str, const Path *node)
1529 WRITE_NODE_TYPE("PATH");
1531 _outPathInfo(str, (const Path *) node);
1535 _outIndexPath(StringInfo str, const IndexPath *node)
1537 WRITE_NODE_TYPE("INDEXPATH");
1539 _outPathInfo(str, (const Path *) node);
1541 WRITE_NODE_FIELD(indexinfo);
1542 WRITE_NODE_FIELD(indexclauses);
1543 WRITE_NODE_FIELD(indexquals);
1544 WRITE_NODE_FIELD(indexqualcols);
1545 WRITE_NODE_FIELD(indexorderbys);
1546 WRITE_NODE_FIELD(indexorderbycols);
1547 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1548 WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1549 WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1553 _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
1555 WRITE_NODE_TYPE("BITMAPHEAPPATH");
1557 _outPathInfo(str, (const Path *) node);
1559 WRITE_NODE_FIELD(bitmapqual);
1563 _outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
1565 WRITE_NODE_TYPE("BITMAPANDPATH");
1567 _outPathInfo(str, (const Path *) node);
1569 WRITE_NODE_FIELD(bitmapquals);
1570 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1574 _outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
1576 WRITE_NODE_TYPE("BITMAPORPATH");
1578 _outPathInfo(str, (const Path *) node);
1580 WRITE_NODE_FIELD(bitmapquals);
1581 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1585 _outTidPath(StringInfo str, const TidPath *node)
1587 WRITE_NODE_TYPE("TIDPATH");
1589 _outPathInfo(str, (const Path *) node);
1591 WRITE_NODE_FIELD(tidquals);
1595 _outForeignPath(StringInfo str, const ForeignPath *node)
1597 WRITE_NODE_TYPE("FOREIGNPATH");
1599 _outPathInfo(str, (const Path *) node);
1601 WRITE_NODE_FIELD(fdw_private);
1605 _outCustomPath(StringInfo str, const CustomPath *node)
1607 WRITE_NODE_TYPE("CUSTOMPATH");
1609 _outPathInfo(str, (const Path *) node);
1611 WRITE_UINT_FIELD(flags);
1612 WRITE_NODE_FIELD(custom_private);
1613 appendStringInfoString(str, " :methods ");
1614 _outToken(str, node->methods->CustomName);
1615 if (node->methods->TextOutCustomPath)
1616 node->methods->TextOutCustomPath(str, node);
1620 _outAppendPath(StringInfo str, const AppendPath *node)
1622 WRITE_NODE_TYPE("APPENDPATH");
1624 _outPathInfo(str, (const Path *) node);
1626 WRITE_NODE_FIELD(subpaths);
1630 _outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
1632 WRITE_NODE_TYPE("MERGEAPPENDPATH");
1634 _outPathInfo(str, (const Path *) node);
1636 WRITE_NODE_FIELD(subpaths);
1637 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1641 _outResultPath(StringInfo str, const ResultPath *node)
1643 WRITE_NODE_TYPE("RESULTPATH");
1645 _outPathInfo(str, (const Path *) node);
1647 WRITE_NODE_FIELD(quals);
1651 _outMaterialPath(StringInfo str, const MaterialPath *node)
1653 WRITE_NODE_TYPE("MATERIALPATH");
1655 _outPathInfo(str, (const Path *) node);
1657 WRITE_NODE_FIELD(subpath);
1661 _outUniquePath(StringInfo str, const UniquePath *node)
1663 WRITE_NODE_TYPE("UNIQUEPATH");
1665 _outPathInfo(str, (const Path *) node);
1667 WRITE_NODE_FIELD(subpath);
1668 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1669 WRITE_NODE_FIELD(in_operators);
1670 WRITE_NODE_FIELD(uniq_exprs);
1674 _outNestPath(StringInfo str, const NestPath *node)
1676 WRITE_NODE_TYPE("NESTPATH");
1678 _outJoinPathInfo(str, (const JoinPath *) node);
1682 _outMergePath(StringInfo str, const MergePath *node)
1684 WRITE_NODE_TYPE("MERGEPATH");
1686 _outJoinPathInfo(str, (const JoinPath *) node);
1688 WRITE_NODE_FIELD(path_mergeclauses);
1689 WRITE_NODE_FIELD(outersortkeys);
1690 WRITE_NODE_FIELD(innersortkeys);
1691 WRITE_BOOL_FIELD(materialize_inner);
1695 _outHashPath(StringInfo str, const HashPath *node)
1697 WRITE_NODE_TYPE("HASHPATH");
1699 _outJoinPathInfo(str, (const JoinPath *) node);
1701 WRITE_NODE_FIELD(path_hashclauses);
1702 WRITE_INT_FIELD(num_batches);
1706 _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
1708 WRITE_NODE_TYPE("PLANNERGLOBAL");
1710 /* NB: this isn't a complete set of fields */
1711 WRITE_NODE_FIELD(subplans);
1712 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
1713 WRITE_NODE_FIELD(finalrtable);
1714 WRITE_NODE_FIELD(finalrowmarks);
1715 WRITE_NODE_FIELD(resultRelations);
1716 WRITE_NODE_FIELD(relationOids);
1717 WRITE_NODE_FIELD(invalItems);
1718 WRITE_INT_FIELD(nParamExec);
1719 WRITE_UINT_FIELD(lastPHId);
1720 WRITE_UINT_FIELD(lastRowMarkId);
1721 WRITE_BOOL_FIELD(transientPlan);
1725 _outPlannerInfo(StringInfo str, const PlannerInfo *node)
1727 WRITE_NODE_TYPE("PLANNERINFO");
1729 /* NB: this isn't a complete set of fields */
1730 WRITE_NODE_FIELD(parse);
1731 WRITE_NODE_FIELD(glob);
1732 WRITE_UINT_FIELD(query_level);
1733 WRITE_NODE_FIELD(plan_params);
1734 WRITE_BITMAPSET_FIELD(all_baserels);
1735 WRITE_BITMAPSET_FIELD(nullable_baserels);
1736 WRITE_NODE_FIELD(join_rel_list);
1737 WRITE_INT_FIELD(join_cur_level);
1738 WRITE_NODE_FIELD(init_plans);
1739 WRITE_NODE_FIELD(cte_plan_ids);
1740 WRITE_NODE_FIELD(multiexpr_params);
1741 WRITE_NODE_FIELD(eq_classes);
1742 WRITE_NODE_FIELD(canon_pathkeys);
1743 WRITE_NODE_FIELD(left_join_clauses);
1744 WRITE_NODE_FIELD(right_join_clauses);
1745 WRITE_NODE_FIELD(full_join_clauses);
1746 WRITE_NODE_FIELD(join_info_list);
1747 WRITE_NODE_FIELD(lateral_info_list);
1748 WRITE_NODE_FIELD(append_rel_list);
1749 WRITE_NODE_FIELD(rowMarks);
1750 WRITE_NODE_FIELD(placeholder_list);
1751 WRITE_NODE_FIELD(query_pathkeys);
1752 WRITE_NODE_FIELD(group_pathkeys);
1753 WRITE_NODE_FIELD(window_pathkeys);
1754 WRITE_NODE_FIELD(distinct_pathkeys);
1755 WRITE_NODE_FIELD(sort_pathkeys);
1756 WRITE_NODE_FIELD(minmax_aggs);
1757 WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
1758 WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
1759 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1760 WRITE_BOOL_FIELD(hasInheritedTarget);
1761 WRITE_BOOL_FIELD(hasJoinRTEs);
1762 WRITE_BOOL_FIELD(hasLateralRTEs);
1763 WRITE_BOOL_FIELD(hasHavingQual);
1764 WRITE_BOOL_FIELD(hasPseudoConstantQuals);
1765 WRITE_BOOL_FIELD(hasRecursion);
1766 WRITE_INT_FIELD(wt_param_id);
1767 WRITE_BITMAPSET_FIELD(curOuterRels);
1768 WRITE_NODE_FIELD(curOuterParams);
1772 _outRelOptInfo(StringInfo str, const RelOptInfo *node)
1774 WRITE_NODE_TYPE("RELOPTINFO");
1776 /* NB: this isn't a complete set of fields */
1777 WRITE_ENUM_FIELD(reloptkind, RelOptKind);
1778 WRITE_BITMAPSET_FIELD(relids);
1779 WRITE_FLOAT_FIELD(rows, "%.0f");
1780 WRITE_INT_FIELD(width);
1781 WRITE_BOOL_FIELD(consider_startup);
1782 WRITE_NODE_FIELD(reltargetlist);
1783 WRITE_NODE_FIELD(pathlist);
1784 WRITE_NODE_FIELD(ppilist);
1785 WRITE_NODE_FIELD(cheapest_startup_path);
1786 WRITE_NODE_FIELD(cheapest_total_path);
1787 WRITE_NODE_FIELD(cheapest_unique_path);
1788 WRITE_NODE_FIELD(cheapest_parameterized_paths);
1789 WRITE_UINT_FIELD(relid);
1790 WRITE_OID_FIELD(reltablespace);
1791 WRITE_ENUM_FIELD(rtekind, RTEKind);
1792 WRITE_INT_FIELD(min_attr);
1793 WRITE_INT_FIELD(max_attr);
1794 WRITE_NODE_FIELD(lateral_vars);
1795 WRITE_BITMAPSET_FIELD(lateral_relids);
1796 WRITE_BITMAPSET_FIELD(lateral_referencers);
1797 WRITE_NODE_FIELD(indexlist);
1798 WRITE_UINT_FIELD(pages);
1799 WRITE_FLOAT_FIELD(tuples, "%.0f");
1800 WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
1801 WRITE_NODE_FIELD(subplan);
1802 WRITE_NODE_FIELD(subroot);
1803 WRITE_NODE_FIELD(subplan_params);
1804 /* we don't try to print fdwroutine or fdw_private */
1805 WRITE_NODE_FIELD(baserestrictinfo);
1806 WRITE_NODE_FIELD(joininfo);
1807 WRITE_BOOL_FIELD(has_eclass_joins);
1811 _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
1813 WRITE_NODE_TYPE("INDEXOPTINFO");
1815 /* NB: this isn't a complete set of fields */
1816 WRITE_OID_FIELD(indexoid);
1817 /* Do NOT print rel field, else infinite recursion */
1818 WRITE_UINT_FIELD(pages);
1819 WRITE_FLOAT_FIELD(tuples, "%.0f");
1820 WRITE_INT_FIELD(tree_height);
1821 WRITE_INT_FIELD(ncolumns);
1822 /* array fields aren't really worth the trouble to print */
1823 WRITE_OID_FIELD(relam);
1824 /* indexprs is redundant since we print indextlist */
1825 WRITE_NODE_FIELD(indpred);
1826 WRITE_NODE_FIELD(indextlist);
1827 WRITE_BOOL_FIELD(predOK);
1828 WRITE_BOOL_FIELD(unique);
1829 WRITE_BOOL_FIELD(immediate);
1830 WRITE_BOOL_FIELD(hypothetical);
1831 /* we don't bother with fields copied from the pg_am entry */
1835 _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
1838 * To simplify reading, we just chase up to the topmost merged EC and
1839 * print that, without bothering to show the merge-ees separately.
1841 while (node->ec_merged)
1842 node = node->ec_merged;
1844 WRITE_NODE_TYPE("EQUIVALENCECLASS");
1846 WRITE_NODE_FIELD(ec_opfamilies);
1847 WRITE_OID_FIELD(ec_collation);
1848 WRITE_NODE_FIELD(ec_members);
1849 WRITE_NODE_FIELD(ec_sources);
1850 WRITE_NODE_FIELD(ec_derives);
1851 WRITE_BITMAPSET_FIELD(ec_relids);
1852 WRITE_BOOL_FIELD(ec_has_const);
1853 WRITE_BOOL_FIELD(ec_has_volatile);
1854 WRITE_BOOL_FIELD(ec_below_outer_join);
1855 WRITE_BOOL_FIELD(ec_broken);
1856 WRITE_UINT_FIELD(ec_sortref);
1860 _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
1862 WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
1864 WRITE_NODE_FIELD(em_expr);
1865 WRITE_BITMAPSET_FIELD(em_relids);
1866 WRITE_BITMAPSET_FIELD(em_nullable_relids);
1867 WRITE_BOOL_FIELD(em_is_const);
1868 WRITE_BOOL_FIELD(em_is_child);
1869 WRITE_OID_FIELD(em_datatype);
1873 _outPathKey(StringInfo str, const PathKey *node)
1875 WRITE_NODE_TYPE("PATHKEY");
1877 WRITE_NODE_FIELD(pk_eclass);
1878 WRITE_OID_FIELD(pk_opfamily);
1879 WRITE_INT_FIELD(pk_strategy);
1880 WRITE_BOOL_FIELD(pk_nulls_first);
1884 _outParamPathInfo(StringInfo str, const ParamPathInfo *node)
1886 WRITE_NODE_TYPE("PARAMPATHINFO");
1888 WRITE_BITMAPSET_FIELD(ppi_req_outer);
1889 WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
1890 WRITE_NODE_FIELD(ppi_clauses);
1894 _outRestrictInfo(StringInfo str, const RestrictInfo *node)
1896 WRITE_NODE_TYPE("RESTRICTINFO");
1898 /* NB: this isn't a complete set of fields */
1899 WRITE_NODE_FIELD(clause);
1900 WRITE_BOOL_FIELD(is_pushed_down);
1901 WRITE_BOOL_FIELD(outerjoin_delayed);
1902 WRITE_BOOL_FIELD(can_join);
1903 WRITE_BOOL_FIELD(pseudoconstant);
1904 WRITE_BITMAPSET_FIELD(clause_relids);
1905 WRITE_BITMAPSET_FIELD(required_relids);
1906 WRITE_BITMAPSET_FIELD(outer_relids);
1907 WRITE_BITMAPSET_FIELD(nullable_relids);
1908 WRITE_BITMAPSET_FIELD(left_relids);
1909 WRITE_BITMAPSET_FIELD(right_relids);
1910 WRITE_NODE_FIELD(orclause);
1911 /* don't write parent_ec, leads to infinite recursion in plan tree dump */
1912 WRITE_FLOAT_FIELD(norm_selec, "%.4f");
1913 WRITE_FLOAT_FIELD(outer_selec, "%.4f");
1914 WRITE_NODE_FIELD(mergeopfamilies);
1915 /* don't write left_ec, leads to infinite recursion in plan tree dump */
1916 /* don't write right_ec, leads to infinite recursion in plan tree dump */
1917 WRITE_NODE_FIELD(left_em);
1918 WRITE_NODE_FIELD(right_em);
1919 WRITE_BOOL_FIELD(outer_is_left);
1920 WRITE_OID_FIELD(hashjoinoperator);
1924 _outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node)
1926 WRITE_NODE_TYPE("PLACEHOLDERVAR");
1928 WRITE_NODE_FIELD(phexpr);
1929 WRITE_BITMAPSET_FIELD(phrels);
1930 WRITE_UINT_FIELD(phid);
1931 WRITE_UINT_FIELD(phlevelsup);
1935 _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
1937 WRITE_NODE_TYPE("SPECIALJOININFO");
1939 WRITE_BITMAPSET_FIELD(min_lefthand);
1940 WRITE_BITMAPSET_FIELD(min_righthand);
1941 WRITE_BITMAPSET_FIELD(syn_lefthand);
1942 WRITE_BITMAPSET_FIELD(syn_righthand);
1943 WRITE_ENUM_FIELD(jointype, JoinType);
1944 WRITE_BOOL_FIELD(lhs_strict);
1945 WRITE_BOOL_FIELD(delay_upper_joins);
1946 WRITE_NODE_FIELD(join_quals);
1950 _outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node)
1952 WRITE_NODE_TYPE("LATERALJOININFO");
1954 WRITE_BITMAPSET_FIELD(lateral_lhs);
1955 WRITE_BITMAPSET_FIELD(lateral_rhs);
1959 _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
1961 WRITE_NODE_TYPE("APPENDRELINFO");
1963 WRITE_UINT_FIELD(parent_relid);
1964 WRITE_UINT_FIELD(child_relid);
1965 WRITE_OID_FIELD(parent_reltype);
1966 WRITE_OID_FIELD(child_reltype);
1967 WRITE_NODE_FIELD(translated_vars);
1968 WRITE_OID_FIELD(parent_reloid);
1972 _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
1974 WRITE_NODE_TYPE("PLACEHOLDERINFO");
1976 WRITE_UINT_FIELD(phid);
1977 WRITE_NODE_FIELD(ph_var);
1978 WRITE_BITMAPSET_FIELD(ph_eval_at);
1979 WRITE_BITMAPSET_FIELD(ph_lateral);
1980 WRITE_BITMAPSET_FIELD(ph_needed);
1981 WRITE_INT_FIELD(ph_width);
1985 _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
1987 WRITE_NODE_TYPE("MINMAXAGGINFO");
1989 WRITE_OID_FIELD(aggfnoid);
1990 WRITE_OID_FIELD(aggsortop);
1991 WRITE_NODE_FIELD(target);
1992 /* We intentionally omit subroot --- too large, not interesting enough */
1993 WRITE_NODE_FIELD(path);
1994 WRITE_FLOAT_FIELD(pathcost, "%.2f");
1995 WRITE_NODE_FIELD(param);
1999 _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
2001 WRITE_NODE_TYPE("PLANNERPARAMITEM");
2003 WRITE_NODE_FIELD(item);
2004 WRITE_INT_FIELD(paramId);
2007 /*****************************************************************************
2009 * Stuff from parsenodes.h.
2011 *****************************************************************************/
2014 * print the basic stuff of all nodes that inherit from CreateStmt
2017 _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
2019 WRITE_NODE_FIELD(relation);
2020 WRITE_NODE_FIELD(tableElts);
2021 WRITE_NODE_FIELD(inhRelations);
2022 WRITE_NODE_FIELD(ofTypename);
2023 WRITE_NODE_FIELD(constraints);
2024 WRITE_NODE_FIELD(options);
2025 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
2026 WRITE_STRING_FIELD(tablespacename);
2027 WRITE_BOOL_FIELD(if_not_exists);
2031 _outCreateStmt(StringInfo str, const CreateStmt *node)
2033 WRITE_NODE_TYPE("CREATESTMT");
2035 _outCreateStmtInfo(str, (const CreateStmt *) node);
2039 _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
2041 WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
2043 _outCreateStmtInfo(str, (const CreateStmt *) node);
2045 WRITE_STRING_FIELD(servername);
2046 WRITE_NODE_FIELD(options);
2050 _outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
2052 WRITE_NODE_TYPE("IMPORTFOREIGNSCHEMASTMT");
2054 WRITE_STRING_FIELD(server_name);
2055 WRITE_STRING_FIELD(remote_schema);
2056 WRITE_STRING_FIELD(local_schema);
2057 WRITE_ENUM_FIELD(list_type, ImportForeignSchemaType);
2058 WRITE_NODE_FIELD(table_list);
2059 WRITE_NODE_FIELD(options);
2063 _outIndexStmt(StringInfo str, const IndexStmt *node)
2065 WRITE_NODE_TYPE("INDEXSTMT");
2067 WRITE_STRING_FIELD(idxname);
2068 WRITE_NODE_FIELD(relation);
2069 WRITE_STRING_FIELD(accessMethod);
2070 WRITE_STRING_FIELD(tableSpace);
2071 WRITE_NODE_FIELD(indexParams);
2072 WRITE_NODE_FIELD(options);
2073 WRITE_NODE_FIELD(whereClause);
2074 WRITE_NODE_FIELD(excludeOpNames);
2075 WRITE_STRING_FIELD(idxcomment);
2076 WRITE_OID_FIELD(indexOid);
2077 WRITE_OID_FIELD(oldNode);
2078 WRITE_BOOL_FIELD(unique);
2079 WRITE_BOOL_FIELD(primary);
2080 WRITE_BOOL_FIELD(isconstraint);
2081 WRITE_BOOL_FIELD(deferrable);
2082 WRITE_BOOL_FIELD(initdeferred);
2083 WRITE_BOOL_FIELD(transformed);
2084 WRITE_BOOL_FIELD(concurrent);
2085 WRITE_BOOL_FIELD(if_not_exists);
2089 _outNotifyStmt(StringInfo str, const NotifyStmt *node)
2091 WRITE_NODE_TYPE("NOTIFY");
2093 WRITE_STRING_FIELD(conditionname);
2094 WRITE_STRING_FIELD(payload);
2098 _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
2100 WRITE_NODE_TYPE("DECLARECURSOR");
2102 WRITE_STRING_FIELD(portalname);
2103 WRITE_INT_FIELD(options);
2104 WRITE_NODE_FIELD(query);
2108 _outSelectStmt(StringInfo str, const SelectStmt *node)
2110 WRITE_NODE_TYPE("SELECT");
2112 WRITE_NODE_FIELD(distinctClause);
2113 WRITE_NODE_FIELD(intoClause);
2114 WRITE_NODE_FIELD(targetList);
2115 WRITE_NODE_FIELD(fromClause);
2116 WRITE_NODE_FIELD(whereClause);
2117 WRITE_NODE_FIELD(groupClause);
2118 WRITE_NODE_FIELD(havingClause);
2119 WRITE_NODE_FIELD(windowClause);
2120 WRITE_NODE_FIELD(valuesLists);
2121 WRITE_NODE_FIELD(sortClause);
2122 WRITE_NODE_FIELD(limitOffset);
2123 WRITE_NODE_FIELD(limitCount);
2124 WRITE_NODE_FIELD(lockingClause);
2125 WRITE_NODE_FIELD(withClause);
2126 WRITE_ENUM_FIELD(op, SetOperation);
2127 WRITE_BOOL_FIELD(all);
2128 WRITE_NODE_FIELD(larg);
2129 WRITE_NODE_FIELD(rarg);
2133 _outFuncCall(StringInfo str, const FuncCall *node)
2135 WRITE_NODE_TYPE("FUNCCALL");
2137 WRITE_NODE_FIELD(funcname);
2138 WRITE_NODE_FIELD(args);
2139 WRITE_NODE_FIELD(agg_order);
2140 WRITE_NODE_FIELD(agg_filter);
2141 WRITE_BOOL_FIELD(agg_within_group);
2142 WRITE_BOOL_FIELD(agg_star);
2143 WRITE_BOOL_FIELD(agg_distinct);
2144 WRITE_BOOL_FIELD(func_variadic);
2145 WRITE_NODE_FIELD(over);
2146 WRITE_LOCATION_FIELD(location);
2150 _outDefElem(StringInfo str, const DefElem *node)
2152 WRITE_NODE_TYPE("DEFELEM");
2154 WRITE_STRING_FIELD(defnamespace);
2155 WRITE_STRING_FIELD(defname);
2156 WRITE_NODE_FIELD(arg);
2157 WRITE_ENUM_FIELD(defaction, DefElemAction);
2161 _outTableLikeClause(StringInfo str, const TableLikeClause *node)
2163 WRITE_NODE_TYPE("TABLELIKECLAUSE");
2165 WRITE_NODE_FIELD(relation);
2166 WRITE_UINT_FIELD(options);
2170 _outLockingClause(StringInfo str, const LockingClause *node)
2172 WRITE_NODE_TYPE("LOCKINGCLAUSE");
2174 WRITE_NODE_FIELD(lockedRels);
2175 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2176 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2180 _outXmlSerialize(StringInfo str, const XmlSerialize *node)
2182 WRITE_NODE_TYPE("XMLSERIALIZE");
2184 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
2185 WRITE_NODE_FIELD(expr);
2186 WRITE_NODE_FIELD(typeName);
2187 WRITE_LOCATION_FIELD(location);
2191 _outColumnDef(StringInfo str, const ColumnDef *node)
2193 WRITE_NODE_TYPE("COLUMNDEF");
2195 WRITE_STRING_FIELD(colname);
2196 WRITE_NODE_FIELD(typeName);
2197 WRITE_INT_FIELD(inhcount);
2198 WRITE_BOOL_FIELD(is_local);
2199 WRITE_BOOL_FIELD(is_not_null);
2200 WRITE_BOOL_FIELD(is_from_type);
2201 WRITE_CHAR_FIELD(storage);
2202 WRITE_NODE_FIELD(raw_default);
2203 WRITE_NODE_FIELD(cooked_default);
2204 WRITE_NODE_FIELD(collClause);
2205 WRITE_OID_FIELD(collOid);
2206 WRITE_NODE_FIELD(constraints);
2207 WRITE_NODE_FIELD(fdwoptions);
2208 WRITE_LOCATION_FIELD(location);
2212 _outTypeName(StringInfo str, const TypeName *node)
2214 WRITE_NODE_TYPE("TYPENAME");
2216 WRITE_NODE_FIELD(names);
2217 WRITE_OID_FIELD(typeOid);
2218 WRITE_BOOL_FIELD(setof);
2219 WRITE_BOOL_FIELD(pct_type);
2220 WRITE_NODE_FIELD(typmods);
2221 WRITE_INT_FIELD(typemod);
2222 WRITE_NODE_FIELD(arrayBounds);
2223 WRITE_LOCATION_FIELD(location);
2227 _outTypeCast(StringInfo str, const TypeCast *node)
2229 WRITE_NODE_TYPE("TYPECAST");
2231 WRITE_NODE_FIELD(arg);
2232 WRITE_NODE_FIELD(typeName);
2233 WRITE_LOCATION_FIELD(location);
2237 _outCollateClause(StringInfo str, const CollateClause *node)
2239 WRITE_NODE_TYPE("COLLATECLAUSE");
2241 WRITE_NODE_FIELD(arg);
2242 WRITE_NODE_FIELD(collname);
2243 WRITE_LOCATION_FIELD(location);
2247 _outIndexElem(StringInfo str, const IndexElem *node)
2249 WRITE_NODE_TYPE("INDEXELEM");
2251 WRITE_STRING_FIELD(name);
2252 WRITE_NODE_FIELD(expr);
2253 WRITE_STRING_FIELD(indexcolname);
2254 WRITE_NODE_FIELD(collation);
2255 WRITE_NODE_FIELD(opclass);
2256 WRITE_ENUM_FIELD(ordering, SortByDir);
2257 WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2261 _outQuery(StringInfo str, const Query *node)
2263 WRITE_NODE_TYPE("QUERY");
2265 WRITE_ENUM_FIELD(commandType, CmdType);
2266 WRITE_ENUM_FIELD(querySource, QuerySource);
2267 /* we intentionally do not print the queryId field */
2268 WRITE_BOOL_FIELD(canSetTag);
2271 * Hack to work around missing outfuncs routines for a lot of the
2272 * utility-statement node types. (The only one we actually *need* for
2273 * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2274 * for the meantime do this to avoid getting lots of warnings when running
2275 * with debug_print_parse on.
2277 if (node->utilityStmt)
2279 switch (nodeTag(node->utilityStmt))
2284 case T_DeclareCursorStmt:
2285 WRITE_NODE_FIELD(utilityStmt);
2288 appendStringInfoString(str, " :utilityStmt ?");
2293 appendStringInfoString(str, " :utilityStmt <>");
2295 WRITE_INT_FIELD(resultRelation);
2296 WRITE_BOOL_FIELD(hasAggs);
2297 WRITE_BOOL_FIELD(hasWindowFuncs);
2298 WRITE_BOOL_FIELD(hasSubLinks);
2299 WRITE_BOOL_FIELD(hasDistinctOn);
2300 WRITE_BOOL_FIELD(hasRecursive);
2301 WRITE_BOOL_FIELD(hasModifyingCTE);
2302 WRITE_BOOL_FIELD(hasForUpdate);
2303 WRITE_BOOL_FIELD(hasRowSecurity);
2304 WRITE_NODE_FIELD(cteList);
2305 WRITE_NODE_FIELD(rtable);
2306 WRITE_NODE_FIELD(jointree);
2307 WRITE_NODE_FIELD(targetList);
2308 WRITE_NODE_FIELD(withCheckOptions);
2309 WRITE_NODE_FIELD(returningList);
2310 WRITE_NODE_FIELD(groupClause);
2311 WRITE_NODE_FIELD(havingQual);
2312 WRITE_NODE_FIELD(windowClause);
2313 WRITE_NODE_FIELD(distinctClause);
2314 WRITE_NODE_FIELD(sortClause);
2315 WRITE_NODE_FIELD(limitOffset);
2316 WRITE_NODE_FIELD(limitCount);
2317 WRITE_NODE_FIELD(rowMarks);
2318 WRITE_NODE_FIELD(setOperations);
2319 WRITE_NODE_FIELD(constraintDeps);
2323 _outWithCheckOption(StringInfo str, const WithCheckOption *node)
2325 WRITE_NODE_TYPE("WITHCHECKOPTION");
2327 WRITE_STRING_FIELD(viewname);
2328 WRITE_NODE_FIELD(qual);
2329 WRITE_BOOL_FIELD(cascaded);
2333 _outSortGroupClause(StringInfo str, const SortGroupClause *node)
2335 WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2337 WRITE_UINT_FIELD(tleSortGroupRef);
2338 WRITE_OID_FIELD(eqop);
2339 WRITE_OID_FIELD(sortop);
2340 WRITE_BOOL_FIELD(nulls_first);
2341 WRITE_BOOL_FIELD(hashable);
2345 _outWindowClause(StringInfo str, const WindowClause *node)
2347 WRITE_NODE_TYPE("WINDOWCLAUSE");
2349 WRITE_STRING_FIELD(name);
2350 WRITE_STRING_FIELD(refname);
2351 WRITE_NODE_FIELD(partitionClause);
2352 WRITE_NODE_FIELD(orderClause);
2353 WRITE_INT_FIELD(frameOptions);
2354 WRITE_NODE_FIELD(startOffset);
2355 WRITE_NODE_FIELD(endOffset);
2356 WRITE_UINT_FIELD(winref);
2357 WRITE_BOOL_FIELD(copiedOrder);
2361 _outRowMarkClause(StringInfo str, const RowMarkClause *node)
2363 WRITE_NODE_TYPE("ROWMARKCLAUSE");
2365 WRITE_UINT_FIELD(rti);
2366 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2367 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2368 WRITE_BOOL_FIELD(pushedDown);
2372 _outWithClause(StringInfo str, const WithClause *node)
2374 WRITE_NODE_TYPE("WITHCLAUSE");
2376 WRITE_NODE_FIELD(ctes);
2377 WRITE_BOOL_FIELD(recursive);
2378 WRITE_LOCATION_FIELD(location);
2382 _outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
2384 WRITE_NODE_TYPE("COMMONTABLEEXPR");
2386 WRITE_STRING_FIELD(ctename);
2387 WRITE_NODE_FIELD(aliascolnames);
2388 WRITE_NODE_FIELD(ctequery);
2389 WRITE_LOCATION_FIELD(location);
2390 WRITE_BOOL_FIELD(cterecursive);
2391 WRITE_INT_FIELD(cterefcount);
2392 WRITE_NODE_FIELD(ctecolnames);
2393 WRITE_NODE_FIELD(ctecoltypes);
2394 WRITE_NODE_FIELD(ctecoltypmods);
2395 WRITE_NODE_FIELD(ctecolcollations);
2399 _outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
2401 WRITE_NODE_TYPE("SETOPERATIONSTMT");
2403 WRITE_ENUM_FIELD(op, SetOperation);
2404 WRITE_BOOL_FIELD(all);
2405 WRITE_NODE_FIELD(larg);
2406 WRITE_NODE_FIELD(rarg);
2407 WRITE_NODE_FIELD(colTypes);
2408 WRITE_NODE_FIELD(colTypmods);
2409 WRITE_NODE_FIELD(colCollations);
2410 WRITE_NODE_FIELD(groupClauses);
2414 _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
2416 WRITE_NODE_TYPE("RTE");
2418 /* put alias + eref first to make dump more legible */
2419 WRITE_NODE_FIELD(alias);
2420 WRITE_NODE_FIELD(eref);
2421 WRITE_ENUM_FIELD(rtekind, RTEKind);
2423 switch (node->rtekind)
2426 WRITE_OID_FIELD(relid);
2427 WRITE_CHAR_FIELD(relkind);
2430 WRITE_NODE_FIELD(subquery);
2431 WRITE_BOOL_FIELD(security_barrier);
2434 WRITE_ENUM_FIELD(jointype, JoinType);
2435 WRITE_NODE_FIELD(joinaliasvars);
2438 WRITE_NODE_FIELD(functions);
2439 WRITE_BOOL_FIELD(funcordinality);
2442 WRITE_NODE_FIELD(values_lists);
2443 WRITE_NODE_FIELD(values_collations);
2446 WRITE_STRING_FIELD(ctename);
2447 WRITE_UINT_FIELD(ctelevelsup);
2448 WRITE_BOOL_FIELD(self_reference);
2449 WRITE_NODE_FIELD(ctecoltypes);
2450 WRITE_NODE_FIELD(ctecoltypmods);
2451 WRITE_NODE_FIELD(ctecolcollations);
2454 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
2458 WRITE_BOOL_FIELD(lateral);
2459 WRITE_BOOL_FIELD(inh);
2460 WRITE_BOOL_FIELD(inFromCl);
2461 WRITE_UINT_FIELD(requiredPerms);
2462 WRITE_OID_FIELD(checkAsUser);
2463 WRITE_BITMAPSET_FIELD(selectedCols);
2464 WRITE_BITMAPSET_FIELD(modifiedCols);
2465 WRITE_NODE_FIELD(securityQuals);
2469 _outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
2471 WRITE_NODE_TYPE("RANGETBLFUNCTION");
2473 WRITE_NODE_FIELD(funcexpr);
2474 WRITE_INT_FIELD(funccolcount);
2475 WRITE_NODE_FIELD(funccolnames);
2476 WRITE_NODE_FIELD(funccoltypes);
2477 WRITE_NODE_FIELD(funccoltypmods);
2478 WRITE_NODE_FIELD(funccolcollations);
2479 WRITE_BITMAPSET_FIELD(funcparams);
2483 _outAExpr(StringInfo str, const A_Expr *node)
2485 WRITE_NODE_TYPE("AEXPR");
2490 appendStringInfoChar(str, ' ');
2491 WRITE_NODE_FIELD(name);
2494 appendStringInfoChar(str, ' ');
2495 WRITE_NODE_FIELD(name);
2496 appendStringInfoString(str, " ANY ");
2499 appendStringInfoChar(str, ' ');
2500 WRITE_NODE_FIELD(name);
2501 appendStringInfoString(str, " ALL ");
2503 case AEXPR_DISTINCT:
2504 appendStringInfoString(str, " DISTINCT ");
2505 WRITE_NODE_FIELD(name);
2508 appendStringInfoString(str, " NULLIF ");
2509 WRITE_NODE_FIELD(name);
2512 appendStringInfoString(str, " OF ");
2513 WRITE_NODE_FIELD(name);
2516 appendStringInfoString(str, " IN ");
2517 WRITE_NODE_FIELD(name);
2520 appendStringInfoString(str, " BETWEEN ");
2521 WRITE_NODE_FIELD(name);
2523 case AEXPR_NOT_BETWEEN:
2524 appendStringInfoString(str, " NOT_BETWEEN ");
2525 WRITE_NODE_FIELD(name);
2527 case AEXPR_BETWEEN_SYM:
2528 appendStringInfoString(str, " BETWEEN_SYM ");
2529 WRITE_NODE_FIELD(name);
2531 case AEXPR_NOT_BETWEEN_SYM:
2532 appendStringInfoString(str, " NOT_BETWEEN_SYM ");
2533 WRITE_NODE_FIELD(name);
2536 appendStringInfoString(str, " ??");
2540 WRITE_NODE_FIELD(lexpr);
2541 WRITE_NODE_FIELD(rexpr);
2542 WRITE_LOCATION_FIELD(location);
2546 _outValue(StringInfo str, const Value *value)
2548 switch (value->type)
2551 appendStringInfo(str, "%ld", value->val.ival);
2556 * We assume the value is a valid numeric literal and so does not
2559 appendStringInfoString(str, value->val.str);
2564 * We use _outToken to provide escaping of the string's content,
2565 * but we don't want it to do anything with an empty string.
2567 appendStringInfoChar(str, '"');
2568 if (value->val.str[0] != '\0')
2569 _outToken(str, value->val.str);
2570 appendStringInfoChar(str, '"');
2573 /* internal representation already has leading 'b' */
2574 appendStringInfoString(str, value->val.str);
2577 /* this is seen only within A_Const, not in transformed trees */
2578 appendStringInfoString(str, "NULL");
2581 elog(ERROR, "unrecognized node type: %d", (int) value->type);
2587 _outColumnRef(StringInfo str, const ColumnRef *node)
2589 WRITE_NODE_TYPE("COLUMNREF");
2591 WRITE_NODE_FIELD(fields);
2592 WRITE_LOCATION_FIELD(location);
2596 _outParamRef(StringInfo str, const ParamRef *node)
2598 WRITE_NODE_TYPE("PARAMREF");
2600 WRITE_INT_FIELD(number);
2601 WRITE_LOCATION_FIELD(location);
2605 _outAConst(StringInfo str, const A_Const *node)
2607 WRITE_NODE_TYPE("A_CONST");
2609 appendStringInfoString(str, " :val ");
2610 _outValue(str, &(node->val));
2611 WRITE_LOCATION_FIELD(location);
2615 _outA_Star(StringInfo str, const A_Star *node)
2617 WRITE_NODE_TYPE("A_STAR");
2621 _outA_Indices(StringInfo str, const A_Indices *node)
2623 WRITE_NODE_TYPE("A_INDICES");
2625 WRITE_NODE_FIELD(lidx);
2626 WRITE_NODE_FIELD(uidx);
2630 _outA_Indirection(StringInfo str, const A_Indirection *node)
2632 WRITE_NODE_TYPE("A_INDIRECTION");
2634 WRITE_NODE_FIELD(arg);
2635 WRITE_NODE_FIELD(indirection);
2639 _outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
2641 WRITE_NODE_TYPE("A_ARRAYEXPR");
2643 WRITE_NODE_FIELD(elements);
2644 WRITE_LOCATION_FIELD(location);
2648 _outResTarget(StringInfo str, const ResTarget *node)
2650 WRITE_NODE_TYPE("RESTARGET");
2652 WRITE_STRING_FIELD(name);
2653 WRITE_NODE_FIELD(indirection);
2654 WRITE_NODE_FIELD(val);
2655 WRITE_LOCATION_FIELD(location);
2659 _outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
2661 WRITE_NODE_TYPE("MULTIASSIGNREF");
2663 WRITE_NODE_FIELD(source);
2664 WRITE_INT_FIELD(colno);
2665 WRITE_INT_FIELD(ncolumns);
2669 _outSortBy(StringInfo str, const SortBy *node)
2671 WRITE_NODE_TYPE("SORTBY");
2673 WRITE_NODE_FIELD(node);
2674 WRITE_ENUM_FIELD(sortby_dir, SortByDir);
2675 WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
2676 WRITE_NODE_FIELD(useOp);
2677 WRITE_LOCATION_FIELD(location);
2681 _outWindowDef(StringInfo str, const WindowDef *node)
2683 WRITE_NODE_TYPE("WINDOWDEF");
2685 WRITE_STRING_FIELD(name);
2686 WRITE_STRING_FIELD(refname);
2687 WRITE_NODE_FIELD(partitionClause);
2688 WRITE_NODE_FIELD(orderClause);
2689 WRITE_INT_FIELD(frameOptions);
2690 WRITE_NODE_FIELD(startOffset);
2691 WRITE_NODE_FIELD(endOffset);
2692 WRITE_LOCATION_FIELD(location);
2696 _outRangeSubselect(StringInfo str, const RangeSubselect *node)
2698 WRITE_NODE_TYPE("RANGESUBSELECT");
2700 WRITE_BOOL_FIELD(lateral);
2701 WRITE_NODE_FIELD(subquery);
2702 WRITE_NODE_FIELD(alias);
2706 _outRangeFunction(StringInfo str, const RangeFunction *node)
2708 WRITE_NODE_TYPE("RANGEFUNCTION");
2710 WRITE_BOOL_FIELD(lateral);
2711 WRITE_BOOL_FIELD(ordinality);
2712 WRITE_BOOL_FIELD(is_rowsfrom);
2713 WRITE_NODE_FIELD(functions);
2714 WRITE_NODE_FIELD(alias);
2715 WRITE_NODE_FIELD(coldeflist);
2719 _outConstraint(StringInfo str, const Constraint *node)
2721 WRITE_NODE_TYPE("CONSTRAINT");
2723 WRITE_STRING_FIELD(conname);
2724 WRITE_BOOL_FIELD(deferrable);
2725 WRITE_BOOL_FIELD(initdeferred);
2726 WRITE_LOCATION_FIELD(location);
2728 appendStringInfoString(str, " :contype ");
2729 switch (node->contype)
2732 appendStringInfoString(str, "NULL");
2735 case CONSTR_NOTNULL:
2736 appendStringInfoString(str, "NOT_NULL");
2739 case CONSTR_DEFAULT:
2740 appendStringInfoString(str, "DEFAULT");
2741 WRITE_NODE_FIELD(raw_expr);
2742 WRITE_STRING_FIELD(cooked_expr);
2746 appendStringInfoString(str, "CHECK");
2747 WRITE_BOOL_FIELD(is_no_inherit);
2748 WRITE_NODE_FIELD(raw_expr);
2749 WRITE_STRING_FIELD(cooked_expr);
2752 case CONSTR_PRIMARY:
2753 appendStringInfoString(str, "PRIMARY_KEY");
2754 WRITE_NODE_FIELD(keys);
2755 WRITE_NODE_FIELD(options);
2756 WRITE_STRING_FIELD(indexname);
2757 WRITE_STRING_FIELD(indexspace);
2758 /* access_method and where_clause not currently used */
2762 appendStringInfoString(str, "UNIQUE");
2763 WRITE_NODE_FIELD(keys);
2764 WRITE_NODE_FIELD(options);
2765 WRITE_STRING_FIELD(indexname);
2766 WRITE_STRING_FIELD(indexspace);
2767 /* access_method and where_clause not currently used */
2770 case CONSTR_EXCLUSION:
2771 appendStringInfoString(str, "EXCLUSION");
2772 WRITE_NODE_FIELD(exclusions);
2773 WRITE_NODE_FIELD(options);
2774 WRITE_STRING_FIELD(indexname);
2775 WRITE_STRING_FIELD(indexspace);
2776 WRITE_STRING_FIELD(access_method);
2777 WRITE_NODE_FIELD(where_clause);
2780 case CONSTR_FOREIGN:
2781 appendStringInfoString(str, "FOREIGN_KEY");
2782 WRITE_NODE_FIELD(pktable);
2783 WRITE_NODE_FIELD(fk_attrs);
2784 WRITE_NODE_FIELD(pk_attrs);
2785 WRITE_CHAR_FIELD(fk_matchtype);
2786 WRITE_CHAR_FIELD(fk_upd_action);
2787 WRITE_CHAR_FIELD(fk_del_action);
2788 WRITE_NODE_FIELD(old_conpfeqop);
2789 WRITE_OID_FIELD(old_pktable_oid);
2790 WRITE_BOOL_FIELD(skip_validation);
2791 WRITE_BOOL_FIELD(initially_valid);
2794 case CONSTR_ATTR_DEFERRABLE:
2795 appendStringInfoString(str, "ATTR_DEFERRABLE");
2798 case CONSTR_ATTR_NOT_DEFERRABLE:
2799 appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
2802 case CONSTR_ATTR_DEFERRED:
2803 appendStringInfoString(str, "ATTR_DEFERRED");
2806 case CONSTR_ATTR_IMMEDIATE:
2807 appendStringInfoString(str, "ATTR_IMMEDIATE");
2811 appendStringInfo(str, "<unrecognized_constraint %d>",
2812 (int) node->contype);
2820 * converts a Node into ascii string and append it to 'str'
2823 _outNode(StringInfo str, const void *obj)
2826 appendStringInfoString(str, "<>");
2827 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
2829 else if (IsA(obj, Integer) ||
2832 IsA(obj, BitString))
2834 /* nodeRead does not want to see { } around these! */
2835 _outValue(str, obj);
2839 appendStringInfoChar(str, '{');
2840 switch (nodeTag(obj))
2843 _outPlannedStmt(str, obj);
2849 _outResult(str, obj);
2852 _outModifyTable(str, obj);
2855 _outAppend(str, obj);
2858 _outMergeAppend(str, obj);
2860 case T_RecursiveUnion:
2861 _outRecursiveUnion(str, obj);
2864 _outBitmapAnd(str, obj);
2867 _outBitmapOr(str, obj);
2873 _outSeqScan(str, obj);
2876 _outIndexScan(str, obj);
2878 case T_IndexOnlyScan:
2879 _outIndexOnlyScan(str, obj);
2881 case T_BitmapIndexScan:
2882 _outBitmapIndexScan(str, obj);
2884 case T_BitmapHeapScan:
2885 _outBitmapHeapScan(str, obj);
2888 _outTidScan(str, obj);
2890 case T_SubqueryScan:
2891 _outSubqueryScan(str, obj);
2893 case T_FunctionScan:
2894 _outFunctionScan(str, obj);
2897 _outValuesScan(str, obj);
2900 _outCteScan(str, obj);
2902 case T_WorkTableScan:
2903 _outWorkTableScan(str, obj);
2906 _outForeignScan(str, obj);
2909 _outCustomScan(str, obj);
2915 _outNestLoop(str, obj);
2918 _outMergeJoin(str, obj);
2921 _outHashJoin(str, obj);
2927 _outWindowAgg(str, obj);
2930 _outGroup(str, obj);
2933 _outMaterial(str, obj);
2939 _outUnique(str, obj);
2945 _outSetOp(str, obj);
2948 _outLockRows(str, obj);
2951 _outLimit(str, obj);
2953 case T_NestLoopParam:
2954 _outNestLoopParam(str, obj);
2957 _outPlanRowMark(str, obj);
2959 case T_PlanInvalItem:
2960 _outPlanInvalItem(str, obj);
2963 _outAlias(str, obj);
2966 _outRangeVar(str, obj);
2969 _outIntoClause(str, obj);
2975 _outConst(str, obj);
2978 _outParam(str, obj);
2981 _outAggref(str, obj);
2984 _outWindowFunc(str, obj);
2987 _outArrayRef(str, obj);
2990 _outFuncExpr(str, obj);
2992 case T_NamedArgExpr:
2993 _outNamedArgExpr(str, obj);
2996 _outOpExpr(str, obj);
2998 case T_DistinctExpr:
2999 _outDistinctExpr(str, obj);
3002 _outNullIfExpr(str, obj);
3004 case T_ScalarArrayOpExpr:
3005 _outScalarArrayOpExpr(str, obj);
3008 _outBoolExpr(str, obj);
3011 _outSubLink(str, obj);
3014 _outSubPlan(str, obj);
3016 case T_AlternativeSubPlan:
3017 _outAlternativeSubPlan(str, obj);
3020 _outFieldSelect(str, obj);
3023 _outFieldStore(str, obj);
3026 _outRelabelType(str, obj);
3029 _outCoerceViaIO(str, obj);
3031 case T_ArrayCoerceExpr:
3032 _outArrayCoerceExpr(str, obj);
3034 case T_ConvertRowtypeExpr:
3035 _outConvertRowtypeExpr(str, obj);
3038 _outCollateExpr(str, obj);
3041 _outCaseExpr(str, obj);
3044 _outCaseWhen(str, obj);
3046 case T_CaseTestExpr:
3047 _outCaseTestExpr(str, obj);
3050 _outArrayExpr(str, obj);
3053 _outRowExpr(str, obj);
3055 case T_RowCompareExpr:
3056 _outRowCompareExpr(str, obj);
3058 case T_CoalesceExpr:
3059 _outCoalesceExpr(str, obj);
3062 _outMinMaxExpr(str, obj);
3065 _outXmlExpr(str, obj);
3068 _outNullTest(str, obj);
3071 _outBooleanTest(str, obj);
3073 case T_CoerceToDomain:
3074 _outCoerceToDomain(str, obj);
3076 case T_CoerceToDomainValue:
3077 _outCoerceToDomainValue(str, obj);
3079 case T_SetToDefault:
3080 _outSetToDefault(str, obj);
3082 case T_CurrentOfExpr:
3083 _outCurrentOfExpr(str, obj);
3086 _outTargetEntry(str, obj);
3089 _outRangeTblRef(str, obj);
3092 _outJoinExpr(str, obj);
3095 _outFromExpr(str, obj);
3102 _outIndexPath(str, obj);
3104 case T_BitmapHeapPath:
3105 _outBitmapHeapPath(str, obj);
3107 case T_BitmapAndPath:
3108 _outBitmapAndPath(str, obj);
3110 case T_BitmapOrPath:
3111 _outBitmapOrPath(str, obj);
3114 _outTidPath(str, obj);
3117 _outForeignPath(str, obj);
3120 _outCustomPath(str, obj);
3123 _outAppendPath(str, obj);
3125 case T_MergeAppendPath:
3126 _outMergeAppendPath(str, obj);
3129 _outResultPath(str, obj);
3131 case T_MaterialPath:
3132 _outMaterialPath(str, obj);
3135 _outUniquePath(str, obj);
3138 _outNestPath(str, obj);
3141 _outMergePath(str, obj);
3144 _outHashPath(str, obj);
3146 case T_PlannerGlobal:
3147 _outPlannerGlobal(str, obj);
3150 _outPlannerInfo(str, obj);
3153 _outRelOptInfo(str, obj);
3155 case T_IndexOptInfo:
3156 _outIndexOptInfo(str, obj);
3158 case T_EquivalenceClass:
3159 _outEquivalenceClass(str, obj);
3161 case T_EquivalenceMember:
3162 _outEquivalenceMember(str, obj);
3165 _outPathKey(str, obj);
3167 case T_ParamPathInfo:
3168 _outParamPathInfo(str, obj);
3170 case T_RestrictInfo:
3171 _outRestrictInfo(str, obj);
3173 case T_PlaceHolderVar:
3174 _outPlaceHolderVar(str, obj);
3176 case T_SpecialJoinInfo:
3177 _outSpecialJoinInfo(str, obj);
3179 case T_LateralJoinInfo:
3180 _outLateralJoinInfo(str, obj);
3182 case T_AppendRelInfo:
3183 _outAppendRelInfo(str, obj);
3185 case T_PlaceHolderInfo:
3186 _outPlaceHolderInfo(str, obj);
3188 case T_MinMaxAggInfo:
3189 _outMinMaxAggInfo(str, obj);
3191 case T_PlannerParamItem:
3192 _outPlannerParamItem(str, obj);
3196 _outCreateStmt(str, obj);
3198 case T_CreateForeignTableStmt:
3199 _outCreateForeignTableStmt(str, obj);
3201 case T_ImportForeignSchemaStmt:
3202 _outImportForeignSchemaStmt(str, obj);
3205 _outIndexStmt(str, obj);
3208 _outNotifyStmt(str, obj);
3210 case T_DeclareCursorStmt:
3211 _outDeclareCursorStmt(str, obj);
3214 _outSelectStmt(str, obj);
3217 _outColumnDef(str, obj);
3220 _outTypeName(str, obj);
3223 _outTypeCast(str, obj);
3225 case T_CollateClause:
3226 _outCollateClause(str, obj);
3229 _outIndexElem(str, obj);
3232 _outQuery(str, obj);
3234 case T_WithCheckOption:
3235 _outWithCheckOption(str, obj);
3237 case T_SortGroupClause:
3238 _outSortGroupClause(str, obj);
3240 case T_WindowClause:
3241 _outWindowClause(str, obj);
3243 case T_RowMarkClause:
3244 _outRowMarkClause(str, obj);
3247 _outWithClause(str, obj);
3249 case T_CommonTableExpr:
3250 _outCommonTableExpr(str, obj);
3252 case T_SetOperationStmt:
3253 _outSetOperationStmt(str, obj);
3255 case T_RangeTblEntry:
3256 _outRangeTblEntry(str, obj);
3258 case T_RangeTblFunction:
3259 _outRangeTblFunction(str, obj);
3262 _outAExpr(str, obj);
3265 _outColumnRef(str, obj);
3268 _outParamRef(str, obj);
3271 _outAConst(str, obj);
3274 _outA_Star(str, obj);
3277 _outA_Indices(str, obj);
3279 case T_A_Indirection:
3280 _outA_Indirection(str, obj);
3283 _outA_ArrayExpr(str, obj);
3286 _outResTarget(str, obj);
3288 case T_MultiAssignRef:
3289 _outMultiAssignRef(str, obj);
3292 _outSortBy(str, obj);
3295 _outWindowDef(str, obj);
3297 case T_RangeSubselect:
3298 _outRangeSubselect(str, obj);
3300 case T_RangeFunction:
3301 _outRangeFunction(str, obj);
3304 _outConstraint(str, obj);
3307 _outFuncCall(str, obj);
3310 _outDefElem(str, obj);
3312 case T_TableLikeClause:
3313 _outTableLikeClause(str, obj);
3315 case T_LockingClause:
3316 _outLockingClause(str, obj);
3318 case T_XmlSerialize:
3319 _outXmlSerialize(str, obj);
3325 * This should be an ERROR, but it's too useful to be able to
3326 * dump structures that _outNode only understands part of.
3328 elog(WARNING, "could not dump unrecognized node type: %d",
3329 (int) nodeTag(obj));
3332 appendStringInfoChar(str, '}');
3338 * returns the ascii representation of the Node as a palloc'd string
3341 nodeToString(const void *obj)
3345 /* see stringinfo.h for an explanation of this maneuver */
3346 initStringInfo(&str);
3347 _outNode(&str, obj);