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(isUpsert);
247 WRITE_BOOL_FIELD(canSetTag);
248 WRITE_BOOL_FIELD(transientPlan);
249 WRITE_NODE_FIELD(planTree);
250 WRITE_NODE_FIELD(rtable);
251 WRITE_NODE_FIELD(resultRelations);
252 WRITE_NODE_FIELD(utilityStmt);
253 WRITE_NODE_FIELD(subplans);
254 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
255 WRITE_NODE_FIELD(rowMarks);
256 WRITE_NODE_FIELD(relationOids);
257 WRITE_NODE_FIELD(invalItems);
258 WRITE_INT_FIELD(nParamExec);
259 WRITE_BOOL_FIELD(hasRowSecurity);
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_UINT_FIELD(nominalRelation);
333 WRITE_NODE_FIELD(resultRelations);
334 WRITE_INT_FIELD(resultRelIndex);
335 WRITE_NODE_FIELD(plans);
336 WRITE_NODE_FIELD(withCheckOptionLists);
337 WRITE_NODE_FIELD(returningLists);
338 WRITE_NODE_FIELD(fdwPrivLists);
339 WRITE_NODE_FIELD(rowMarks);
340 WRITE_INT_FIELD(epqParam);
341 WRITE_ENUM_FIELD(onConflictAction, OnConflictAction);
342 WRITE_NODE_FIELD(arbiterIndexes);
343 WRITE_NODE_FIELD(onConflictSet);
344 WRITE_NODE_FIELD(onConflictWhere);
345 WRITE_INT_FIELD(exclRelRTI);
346 WRITE_NODE_FIELD(exclRelTlist);
350 _outAppend(StringInfo str, const Append *node)
352 WRITE_NODE_TYPE("APPEND");
354 _outPlanInfo(str, (const Plan *) node);
356 WRITE_NODE_FIELD(appendplans);
360 _outMergeAppend(StringInfo str, const MergeAppend *node)
364 WRITE_NODE_TYPE("MERGEAPPEND");
366 _outPlanInfo(str, (const Plan *) node);
368 WRITE_NODE_FIELD(mergeplans);
370 WRITE_INT_FIELD(numCols);
372 appendStringInfoString(str, " :sortColIdx");
373 for (i = 0; i < node->numCols; i++)
374 appendStringInfo(str, " %d", node->sortColIdx[i]);
376 appendStringInfoString(str, " :sortOperators");
377 for (i = 0; i < node->numCols; i++)
378 appendStringInfo(str, " %u", node->sortOperators[i]);
380 appendStringInfoString(str, " :collations");
381 for (i = 0; i < node->numCols; i++)
382 appendStringInfo(str, " %u", node->collations[i]);
384 appendStringInfoString(str, " :nullsFirst");
385 for (i = 0; i < node->numCols; i++)
386 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
390 _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
394 WRITE_NODE_TYPE("RECURSIVEUNION");
396 _outPlanInfo(str, (const Plan *) node);
398 WRITE_INT_FIELD(wtParam);
399 WRITE_INT_FIELD(numCols);
401 appendStringInfoString(str, " :dupColIdx");
402 for (i = 0; i < node->numCols; i++)
403 appendStringInfo(str, " %d", node->dupColIdx[i]);
405 appendStringInfoString(str, " :dupOperators");
406 for (i = 0; i < node->numCols; i++)
407 appendStringInfo(str, " %u", node->dupOperators[i]);
409 WRITE_LONG_FIELD(numGroups);
413 _outBitmapAnd(StringInfo str, const BitmapAnd *node)
415 WRITE_NODE_TYPE("BITMAPAND");
417 _outPlanInfo(str, (const Plan *) node);
419 WRITE_NODE_FIELD(bitmapplans);
423 _outBitmapOr(StringInfo str, const BitmapOr *node)
425 WRITE_NODE_TYPE("BITMAPOR");
427 _outPlanInfo(str, (const Plan *) node);
429 WRITE_NODE_FIELD(bitmapplans);
433 _outScan(StringInfo str, const Scan *node)
435 WRITE_NODE_TYPE("SCAN");
437 _outScanInfo(str, node);
441 _outSeqScan(StringInfo str, const SeqScan *node)
443 WRITE_NODE_TYPE("SEQSCAN");
445 _outScanInfo(str, (const Scan *) node);
449 _outIndexScan(StringInfo str, const IndexScan *node)
451 WRITE_NODE_TYPE("INDEXSCAN");
453 _outScanInfo(str, (const Scan *) node);
455 WRITE_OID_FIELD(indexid);
456 WRITE_NODE_FIELD(indexqual);
457 WRITE_NODE_FIELD(indexqualorig);
458 WRITE_NODE_FIELD(indexorderby);
459 WRITE_NODE_FIELD(indexorderbyorig);
460 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
464 _outIndexOnlyScan(StringInfo str, const IndexOnlyScan *node)
466 WRITE_NODE_TYPE("INDEXONLYSCAN");
468 _outScanInfo(str, (const Scan *) node);
470 WRITE_OID_FIELD(indexid);
471 WRITE_NODE_FIELD(indexqual);
472 WRITE_NODE_FIELD(indexorderby);
473 WRITE_NODE_FIELD(indextlist);
474 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
478 _outBitmapIndexScan(StringInfo str, const BitmapIndexScan *node)
480 WRITE_NODE_TYPE("BITMAPINDEXSCAN");
482 _outScanInfo(str, (const Scan *) node);
484 WRITE_OID_FIELD(indexid);
485 WRITE_NODE_FIELD(indexqual);
486 WRITE_NODE_FIELD(indexqualorig);
490 _outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
492 WRITE_NODE_TYPE("BITMAPHEAPSCAN");
494 _outScanInfo(str, (const Scan *) node);
496 WRITE_NODE_FIELD(bitmapqualorig);
500 _outTidScan(StringInfo str, const TidScan *node)
502 WRITE_NODE_TYPE("TIDSCAN");
504 _outScanInfo(str, (const Scan *) node);
506 WRITE_NODE_FIELD(tidquals);
510 _outSubqueryScan(StringInfo str, const SubqueryScan *node)
512 WRITE_NODE_TYPE("SUBQUERYSCAN");
514 _outScanInfo(str, (const Scan *) node);
516 WRITE_NODE_FIELD(subplan);
520 _outFunctionScan(StringInfo str, const FunctionScan *node)
522 WRITE_NODE_TYPE("FUNCTIONSCAN");
524 _outScanInfo(str, (const Scan *) node);
526 WRITE_NODE_FIELD(functions);
527 WRITE_BOOL_FIELD(funcordinality);
531 _outValuesScan(StringInfo str, const ValuesScan *node)
533 WRITE_NODE_TYPE("VALUESSCAN");
535 _outScanInfo(str, (const Scan *) node);
537 WRITE_NODE_FIELD(values_lists);
541 _outCteScan(StringInfo str, const CteScan *node)
543 WRITE_NODE_TYPE("CTESCAN");
545 _outScanInfo(str, (const Scan *) node);
547 WRITE_INT_FIELD(ctePlanId);
548 WRITE_INT_FIELD(cteParam);
552 _outWorkTableScan(StringInfo str, const WorkTableScan *node)
554 WRITE_NODE_TYPE("WORKTABLESCAN");
556 _outScanInfo(str, (const Scan *) node);
558 WRITE_INT_FIELD(wtParam);
562 _outForeignScan(StringInfo str, const ForeignScan *node)
564 WRITE_NODE_TYPE("FOREIGNSCAN");
566 _outScanInfo(str, (const Scan *) node);
568 WRITE_OID_FIELD(fs_server);
569 WRITE_NODE_FIELD(fdw_exprs);
570 WRITE_NODE_FIELD(fdw_private);
571 WRITE_NODE_FIELD(fdw_scan_tlist);
572 WRITE_BITMAPSET_FIELD(fs_relids);
573 WRITE_BOOL_FIELD(fsSystemCol);
577 _outCustomScan(StringInfo str, const CustomScan *node)
579 WRITE_NODE_TYPE("CUSTOMSCAN");
581 _outScanInfo(str, (const Scan *) node);
583 WRITE_UINT_FIELD(flags);
584 WRITE_NODE_FIELD(custom_exprs);
585 WRITE_NODE_FIELD(custom_private);
586 WRITE_NODE_FIELD(custom_scan_tlist);
587 WRITE_BITMAPSET_FIELD(custom_relids);
588 appendStringInfoString(str, " :methods ");
589 _outToken(str, node->methods->CustomName);
590 if (node->methods->TextOutCustomScan)
591 node->methods->TextOutCustomScan(str, node);
595 _outJoin(StringInfo str, const Join *node)
597 WRITE_NODE_TYPE("JOIN");
599 _outJoinPlanInfo(str, (const Join *) node);
603 _outNestLoop(StringInfo str, const NestLoop *node)
605 WRITE_NODE_TYPE("NESTLOOP");
607 _outJoinPlanInfo(str, (const Join *) node);
609 WRITE_NODE_FIELD(nestParams);
613 _outMergeJoin(StringInfo str, const MergeJoin *node)
618 WRITE_NODE_TYPE("MERGEJOIN");
620 _outJoinPlanInfo(str, (const Join *) node);
622 WRITE_NODE_FIELD(mergeclauses);
624 numCols = list_length(node->mergeclauses);
626 appendStringInfoString(str, " :mergeFamilies");
627 for (i = 0; i < numCols; i++)
628 appendStringInfo(str, " %u", node->mergeFamilies[i]);
630 appendStringInfoString(str, " :mergeCollations");
631 for (i = 0; i < numCols; i++)
632 appendStringInfo(str, " %u", node->mergeCollations[i]);
634 appendStringInfoString(str, " :mergeStrategies");
635 for (i = 0; i < numCols; i++)
636 appendStringInfo(str, " %d", node->mergeStrategies[i]);
638 appendStringInfoString(str, " :mergeNullsFirst");
639 for (i = 0; i < numCols; i++)
640 appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
644 _outHashJoin(StringInfo str, const HashJoin *node)
646 WRITE_NODE_TYPE("HASHJOIN");
648 _outJoinPlanInfo(str, (const Join *) node);
650 WRITE_NODE_FIELD(hashclauses);
654 _outAgg(StringInfo str, const Agg *node)
658 WRITE_NODE_TYPE("AGG");
660 _outPlanInfo(str, (const Plan *) node);
662 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
663 WRITE_INT_FIELD(numCols);
665 appendStringInfoString(str, " :grpColIdx");
666 for (i = 0; i < node->numCols; i++)
667 appendStringInfo(str, " %d", node->grpColIdx[i]);
669 appendStringInfoString(str, " :grpOperators");
670 for (i = 0; i < node->numCols; i++)
671 appendStringInfo(str, " %u", node->grpOperators[i]);
673 WRITE_LONG_FIELD(numGroups);
677 _outWindowAgg(StringInfo str, const WindowAgg *node)
681 WRITE_NODE_TYPE("WINDOWAGG");
683 _outPlanInfo(str, (const Plan *) node);
685 WRITE_UINT_FIELD(winref);
686 WRITE_INT_FIELD(partNumCols);
688 appendStringInfoString(str, " :partColIdx");
689 for (i = 0; i < node->partNumCols; i++)
690 appendStringInfo(str, " %d", node->partColIdx[i]);
692 appendStringInfoString(str, " :partOperations");
693 for (i = 0; i < node->partNumCols; i++)
694 appendStringInfo(str, " %u", node->partOperators[i]);
696 WRITE_INT_FIELD(ordNumCols);
698 appendStringInfoString(str, " :ordColIdx");
699 for (i = 0; i < node->ordNumCols; i++)
700 appendStringInfo(str, " %d", node->ordColIdx[i]);
702 appendStringInfoString(str, " :ordOperations");
703 for (i = 0; i < node->ordNumCols; i++)
704 appendStringInfo(str, " %u", node->ordOperators[i]);
706 WRITE_INT_FIELD(frameOptions);
707 WRITE_NODE_FIELD(startOffset);
708 WRITE_NODE_FIELD(endOffset);
712 _outGroup(StringInfo str, const Group *node)
716 WRITE_NODE_TYPE("GROUP");
718 _outPlanInfo(str, (const Plan *) node);
720 WRITE_INT_FIELD(numCols);
722 appendStringInfoString(str, " :grpColIdx");
723 for (i = 0; i < node->numCols; i++)
724 appendStringInfo(str, " %d", node->grpColIdx[i]);
726 appendStringInfoString(str, " :grpOperators");
727 for (i = 0; i < node->numCols; i++)
728 appendStringInfo(str, " %u", node->grpOperators[i]);
732 _outMaterial(StringInfo str, const Material *node)
734 WRITE_NODE_TYPE("MATERIAL");
736 _outPlanInfo(str, (const Plan *) node);
740 _outSort(StringInfo str, const Sort *node)
744 WRITE_NODE_TYPE("SORT");
746 _outPlanInfo(str, (const Plan *) node);
748 WRITE_INT_FIELD(numCols);
750 appendStringInfoString(str, " :sortColIdx");
751 for (i = 0; i < node->numCols; i++)
752 appendStringInfo(str, " %d", node->sortColIdx[i]);
754 appendStringInfoString(str, " :sortOperators");
755 for (i = 0; i < node->numCols; i++)
756 appendStringInfo(str, " %u", node->sortOperators[i]);
758 appendStringInfoString(str, " :collations");
759 for (i = 0; i < node->numCols; i++)
760 appendStringInfo(str, " %u", node->collations[i]);
762 appendStringInfoString(str, " :nullsFirst");
763 for (i = 0; i < node->numCols; i++)
764 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
768 _outUnique(StringInfo str, const Unique *node)
772 WRITE_NODE_TYPE("UNIQUE");
774 _outPlanInfo(str, (const Plan *) node);
776 WRITE_INT_FIELD(numCols);
778 appendStringInfoString(str, " :uniqColIdx");
779 for (i = 0; i < node->numCols; i++)
780 appendStringInfo(str, " %d", node->uniqColIdx[i]);
782 appendStringInfoString(str, " :uniqOperators");
783 for (i = 0; i < node->numCols; i++)
784 appendStringInfo(str, " %u", node->uniqOperators[i]);
788 _outHash(StringInfo str, const Hash *node)
790 WRITE_NODE_TYPE("HASH");
792 _outPlanInfo(str, (const Plan *) node);
794 WRITE_OID_FIELD(skewTable);
795 WRITE_INT_FIELD(skewColumn);
796 WRITE_BOOL_FIELD(skewInherit);
797 WRITE_OID_FIELD(skewColType);
798 WRITE_INT_FIELD(skewColTypmod);
802 _outSetOp(StringInfo str, const SetOp *node)
806 WRITE_NODE_TYPE("SETOP");
808 _outPlanInfo(str, (const Plan *) node);
810 WRITE_ENUM_FIELD(cmd, SetOpCmd);
811 WRITE_ENUM_FIELD(strategy, SetOpStrategy);
812 WRITE_INT_FIELD(numCols);
814 appendStringInfoString(str, " :dupColIdx");
815 for (i = 0; i < node->numCols; i++)
816 appendStringInfo(str, " %d", node->dupColIdx[i]);
818 appendStringInfoString(str, " :dupOperators");
819 for (i = 0; i < node->numCols; i++)
820 appendStringInfo(str, " %u", node->dupOperators[i]);
822 WRITE_INT_FIELD(flagColIdx);
823 WRITE_INT_FIELD(firstFlag);
824 WRITE_LONG_FIELD(numGroups);
828 _outLockRows(StringInfo str, const LockRows *node)
830 WRITE_NODE_TYPE("LOCKROWS");
832 _outPlanInfo(str, (const Plan *) node);
834 WRITE_NODE_FIELD(rowMarks);
835 WRITE_INT_FIELD(epqParam);
839 _outLimit(StringInfo str, const Limit *node)
841 WRITE_NODE_TYPE("LIMIT");
843 _outPlanInfo(str, (const Plan *) node);
845 WRITE_NODE_FIELD(limitOffset);
846 WRITE_NODE_FIELD(limitCount);
850 _outNestLoopParam(StringInfo str, const NestLoopParam *node)
852 WRITE_NODE_TYPE("NESTLOOPPARAM");
854 WRITE_INT_FIELD(paramno);
855 WRITE_NODE_FIELD(paramval);
859 _outPlanRowMark(StringInfo str, const PlanRowMark *node)
861 WRITE_NODE_TYPE("PLANROWMARK");
863 WRITE_UINT_FIELD(rti);
864 WRITE_UINT_FIELD(prti);
865 WRITE_UINT_FIELD(rowmarkId);
866 WRITE_ENUM_FIELD(markType, RowMarkType);
867 WRITE_INT_FIELD(allMarkTypes);
868 WRITE_ENUM_FIELD(strength, LockClauseStrength);
869 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
870 WRITE_BOOL_FIELD(isParent);
874 _outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
876 WRITE_NODE_TYPE("PLANINVALITEM");
878 WRITE_INT_FIELD(cacheId);
879 WRITE_UINT_FIELD(hashValue);
882 /*****************************************************************************
884 * Stuff from primnodes.h.
886 *****************************************************************************/
889 _outAlias(StringInfo str, const Alias *node)
891 WRITE_NODE_TYPE("ALIAS");
893 WRITE_STRING_FIELD(aliasname);
894 WRITE_NODE_FIELD(colnames);
898 _outRangeVar(StringInfo str, const RangeVar *node)
900 WRITE_NODE_TYPE("RANGEVAR");
903 * we deliberately ignore catalogname here, since it is presently not
904 * semantically meaningful
906 WRITE_STRING_FIELD(schemaname);
907 WRITE_STRING_FIELD(relname);
908 WRITE_ENUM_FIELD(inhOpt, InhOption);
909 WRITE_CHAR_FIELD(relpersistence);
910 WRITE_NODE_FIELD(alias);
911 WRITE_LOCATION_FIELD(location);
915 _outIntoClause(StringInfo str, const IntoClause *node)
917 WRITE_NODE_TYPE("INTOCLAUSE");
919 WRITE_NODE_FIELD(rel);
920 WRITE_NODE_FIELD(colNames);
921 WRITE_NODE_FIELD(options);
922 WRITE_ENUM_FIELD(onCommit, OnCommitAction);
923 WRITE_STRING_FIELD(tableSpaceName);
924 WRITE_NODE_FIELD(viewQuery);
925 WRITE_BOOL_FIELD(skipData);
929 _outVar(StringInfo str, const Var *node)
931 WRITE_NODE_TYPE("VAR");
933 WRITE_UINT_FIELD(varno);
934 WRITE_INT_FIELD(varattno);
935 WRITE_OID_FIELD(vartype);
936 WRITE_INT_FIELD(vartypmod);
937 WRITE_OID_FIELD(varcollid);
938 WRITE_UINT_FIELD(varlevelsup);
939 WRITE_UINT_FIELD(varnoold);
940 WRITE_INT_FIELD(varoattno);
941 WRITE_LOCATION_FIELD(location);
945 _outConst(StringInfo str, const Const *node)
947 WRITE_NODE_TYPE("CONST");
949 WRITE_OID_FIELD(consttype);
950 WRITE_INT_FIELD(consttypmod);
951 WRITE_OID_FIELD(constcollid);
952 WRITE_INT_FIELD(constlen);
953 WRITE_BOOL_FIELD(constbyval);
954 WRITE_BOOL_FIELD(constisnull);
955 WRITE_LOCATION_FIELD(location);
957 appendStringInfoString(str, " :constvalue ");
958 if (node->constisnull)
959 appendStringInfoString(str, "<>");
961 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
965 _outParam(StringInfo str, const Param *node)
967 WRITE_NODE_TYPE("PARAM");
969 WRITE_ENUM_FIELD(paramkind, ParamKind);
970 WRITE_INT_FIELD(paramid);
971 WRITE_OID_FIELD(paramtype);
972 WRITE_INT_FIELD(paramtypmod);
973 WRITE_OID_FIELD(paramcollid);
974 WRITE_LOCATION_FIELD(location);
978 _outAggref(StringInfo str, const Aggref *node)
980 WRITE_NODE_TYPE("AGGREF");
982 WRITE_OID_FIELD(aggfnoid);
983 WRITE_OID_FIELD(aggtype);
984 WRITE_OID_FIELD(aggcollid);
985 WRITE_OID_FIELD(inputcollid);
986 WRITE_NODE_FIELD(aggdirectargs);
987 WRITE_NODE_FIELD(args);
988 WRITE_NODE_FIELD(aggorder);
989 WRITE_NODE_FIELD(aggdistinct);
990 WRITE_NODE_FIELD(aggfilter);
991 WRITE_BOOL_FIELD(aggstar);
992 WRITE_BOOL_FIELD(aggvariadic);
993 WRITE_CHAR_FIELD(aggkind);
994 WRITE_UINT_FIELD(agglevelsup);
995 WRITE_LOCATION_FIELD(location);
999 _outWindowFunc(StringInfo str, const WindowFunc *node)
1001 WRITE_NODE_TYPE("WINDOWFUNC");
1003 WRITE_OID_FIELD(winfnoid);
1004 WRITE_OID_FIELD(wintype);
1005 WRITE_OID_FIELD(wincollid);
1006 WRITE_OID_FIELD(inputcollid);
1007 WRITE_NODE_FIELD(args);
1008 WRITE_NODE_FIELD(aggfilter);
1009 WRITE_UINT_FIELD(winref);
1010 WRITE_BOOL_FIELD(winstar);
1011 WRITE_BOOL_FIELD(winagg);
1012 WRITE_LOCATION_FIELD(location);
1016 _outArrayRef(StringInfo str, const ArrayRef *node)
1018 WRITE_NODE_TYPE("ARRAYREF");
1020 WRITE_OID_FIELD(refarraytype);
1021 WRITE_OID_FIELD(refelemtype);
1022 WRITE_INT_FIELD(reftypmod);
1023 WRITE_OID_FIELD(refcollid);
1024 WRITE_NODE_FIELD(refupperindexpr);
1025 WRITE_NODE_FIELD(reflowerindexpr);
1026 WRITE_NODE_FIELD(refexpr);
1027 WRITE_NODE_FIELD(refassgnexpr);
1031 _outFuncExpr(StringInfo str, const FuncExpr *node)
1033 WRITE_NODE_TYPE("FUNCEXPR");
1035 WRITE_OID_FIELD(funcid);
1036 WRITE_OID_FIELD(funcresulttype);
1037 WRITE_BOOL_FIELD(funcretset);
1038 WRITE_BOOL_FIELD(funcvariadic);
1039 WRITE_ENUM_FIELD(funcformat, CoercionForm);
1040 WRITE_OID_FIELD(funccollid);
1041 WRITE_OID_FIELD(inputcollid);
1042 WRITE_NODE_FIELD(args);
1043 WRITE_LOCATION_FIELD(location);
1047 _outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
1049 WRITE_NODE_TYPE("NAMEDARGEXPR");
1051 WRITE_NODE_FIELD(arg);
1052 WRITE_STRING_FIELD(name);
1053 WRITE_INT_FIELD(argnumber);
1054 WRITE_LOCATION_FIELD(location);
1058 _outOpExpr(StringInfo str, const OpExpr *node)
1060 WRITE_NODE_TYPE("OPEXPR");
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 _outDistinctExpr(StringInfo str, const DistinctExpr *node)
1075 WRITE_NODE_TYPE("DISTINCTEXPR");
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 _outNullIfExpr(StringInfo str, const NullIfExpr *node)
1090 WRITE_NODE_TYPE("NULLIFEXPR");
1092 WRITE_OID_FIELD(opno);
1093 WRITE_OID_FIELD(opfuncid);
1094 WRITE_OID_FIELD(opresulttype);
1095 WRITE_BOOL_FIELD(opretset);
1096 WRITE_OID_FIELD(opcollid);
1097 WRITE_OID_FIELD(inputcollid);
1098 WRITE_NODE_FIELD(args);
1099 WRITE_LOCATION_FIELD(location);
1103 _outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
1105 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
1107 WRITE_OID_FIELD(opno);
1108 WRITE_OID_FIELD(opfuncid);
1109 WRITE_BOOL_FIELD(useOr);
1110 WRITE_OID_FIELD(inputcollid);
1111 WRITE_NODE_FIELD(args);
1112 WRITE_LOCATION_FIELD(location);
1116 _outBoolExpr(StringInfo str, const BoolExpr *node)
1120 WRITE_NODE_TYPE("BOOLEXPR");
1122 /* do-it-yourself enum representation */
1123 switch (node->boolop)
1135 appendStringInfoString(str, " :boolop ");
1136 _outToken(str, opstr);
1138 WRITE_NODE_FIELD(args);
1139 WRITE_LOCATION_FIELD(location);
1143 _outSubLink(StringInfo str, const SubLink *node)
1145 WRITE_NODE_TYPE("SUBLINK");
1147 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1148 WRITE_INT_FIELD(subLinkId);
1149 WRITE_NODE_FIELD(testexpr);
1150 WRITE_NODE_FIELD(operName);
1151 WRITE_NODE_FIELD(subselect);
1152 WRITE_LOCATION_FIELD(location);
1156 _outSubPlan(StringInfo str, const SubPlan *node)
1158 WRITE_NODE_TYPE("SUBPLAN");
1160 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1161 WRITE_NODE_FIELD(testexpr);
1162 WRITE_NODE_FIELD(paramIds);
1163 WRITE_INT_FIELD(plan_id);
1164 WRITE_STRING_FIELD(plan_name);
1165 WRITE_OID_FIELD(firstColType);
1166 WRITE_INT_FIELD(firstColTypmod);
1167 WRITE_OID_FIELD(firstColCollation);
1168 WRITE_BOOL_FIELD(useHashTable);
1169 WRITE_BOOL_FIELD(unknownEqFalse);
1170 WRITE_NODE_FIELD(setParam);
1171 WRITE_NODE_FIELD(parParam);
1172 WRITE_NODE_FIELD(args);
1173 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1174 WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
1178 _outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
1180 WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
1182 WRITE_NODE_FIELD(subplans);
1186 _outFieldSelect(StringInfo str, const FieldSelect *node)
1188 WRITE_NODE_TYPE("FIELDSELECT");
1190 WRITE_NODE_FIELD(arg);
1191 WRITE_INT_FIELD(fieldnum);
1192 WRITE_OID_FIELD(resulttype);
1193 WRITE_INT_FIELD(resulttypmod);
1194 WRITE_OID_FIELD(resultcollid);
1198 _outFieldStore(StringInfo str, const FieldStore *node)
1200 WRITE_NODE_TYPE("FIELDSTORE");
1202 WRITE_NODE_FIELD(arg);
1203 WRITE_NODE_FIELD(newvals);
1204 WRITE_NODE_FIELD(fieldnums);
1205 WRITE_OID_FIELD(resulttype);
1209 _outRelabelType(StringInfo str, const RelabelType *node)
1211 WRITE_NODE_TYPE("RELABELTYPE");
1213 WRITE_NODE_FIELD(arg);
1214 WRITE_OID_FIELD(resulttype);
1215 WRITE_INT_FIELD(resulttypmod);
1216 WRITE_OID_FIELD(resultcollid);
1217 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
1218 WRITE_LOCATION_FIELD(location);
1222 _outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
1224 WRITE_NODE_TYPE("COERCEVIAIO");
1226 WRITE_NODE_FIELD(arg);
1227 WRITE_OID_FIELD(resulttype);
1228 WRITE_OID_FIELD(resultcollid);
1229 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1230 WRITE_LOCATION_FIELD(location);
1234 _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
1236 WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
1238 WRITE_NODE_FIELD(arg);
1239 WRITE_OID_FIELD(elemfuncid);
1240 WRITE_OID_FIELD(resulttype);
1241 WRITE_INT_FIELD(resulttypmod);
1242 WRITE_OID_FIELD(resultcollid);
1243 WRITE_BOOL_FIELD(isExplicit);
1244 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1245 WRITE_LOCATION_FIELD(location);
1249 _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
1251 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
1253 WRITE_NODE_FIELD(arg);
1254 WRITE_OID_FIELD(resulttype);
1255 WRITE_ENUM_FIELD(convertformat, CoercionForm);
1256 WRITE_LOCATION_FIELD(location);
1260 _outCollateExpr(StringInfo str, const CollateExpr *node)
1262 WRITE_NODE_TYPE("COLLATE");
1264 WRITE_NODE_FIELD(arg);
1265 WRITE_OID_FIELD(collOid);
1266 WRITE_LOCATION_FIELD(location);
1270 _outCaseExpr(StringInfo str, const CaseExpr *node)
1272 WRITE_NODE_TYPE("CASE");
1274 WRITE_OID_FIELD(casetype);
1275 WRITE_OID_FIELD(casecollid);
1276 WRITE_NODE_FIELD(arg);
1277 WRITE_NODE_FIELD(args);
1278 WRITE_NODE_FIELD(defresult);
1279 WRITE_LOCATION_FIELD(location);
1283 _outCaseWhen(StringInfo str, const CaseWhen *node)
1285 WRITE_NODE_TYPE("WHEN");
1287 WRITE_NODE_FIELD(expr);
1288 WRITE_NODE_FIELD(result);
1289 WRITE_LOCATION_FIELD(location);
1293 _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
1295 WRITE_NODE_TYPE("CASETESTEXPR");
1297 WRITE_OID_FIELD(typeId);
1298 WRITE_INT_FIELD(typeMod);
1299 WRITE_OID_FIELD(collation);
1303 _outArrayExpr(StringInfo str, const ArrayExpr *node)
1305 WRITE_NODE_TYPE("ARRAY");
1307 WRITE_OID_FIELD(array_typeid);
1308 WRITE_OID_FIELD(array_collid);
1309 WRITE_OID_FIELD(element_typeid);
1310 WRITE_NODE_FIELD(elements);
1311 WRITE_BOOL_FIELD(multidims);
1312 WRITE_LOCATION_FIELD(location);
1316 _outRowExpr(StringInfo str, const RowExpr *node)
1318 WRITE_NODE_TYPE("ROW");
1320 WRITE_NODE_FIELD(args);
1321 WRITE_OID_FIELD(row_typeid);
1322 WRITE_ENUM_FIELD(row_format, CoercionForm);
1323 WRITE_NODE_FIELD(colnames);
1324 WRITE_LOCATION_FIELD(location);
1328 _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
1330 WRITE_NODE_TYPE("ROWCOMPARE");
1332 WRITE_ENUM_FIELD(rctype, RowCompareType);
1333 WRITE_NODE_FIELD(opnos);
1334 WRITE_NODE_FIELD(opfamilies);
1335 WRITE_NODE_FIELD(inputcollids);
1336 WRITE_NODE_FIELD(largs);
1337 WRITE_NODE_FIELD(rargs);
1341 _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
1343 WRITE_NODE_TYPE("COALESCE");
1345 WRITE_OID_FIELD(coalescetype);
1346 WRITE_OID_FIELD(coalescecollid);
1347 WRITE_NODE_FIELD(args);
1348 WRITE_LOCATION_FIELD(location);
1352 _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
1354 WRITE_NODE_TYPE("MINMAX");
1356 WRITE_OID_FIELD(minmaxtype);
1357 WRITE_OID_FIELD(minmaxcollid);
1358 WRITE_OID_FIELD(inputcollid);
1359 WRITE_ENUM_FIELD(op, MinMaxOp);
1360 WRITE_NODE_FIELD(args);
1361 WRITE_LOCATION_FIELD(location);
1365 _outXmlExpr(StringInfo str, const XmlExpr *node)
1367 WRITE_NODE_TYPE("XMLEXPR");
1369 WRITE_ENUM_FIELD(op, XmlExprOp);
1370 WRITE_STRING_FIELD(name);
1371 WRITE_NODE_FIELD(named_args);
1372 WRITE_NODE_FIELD(arg_names);
1373 WRITE_NODE_FIELD(args);
1374 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
1375 WRITE_OID_FIELD(type);
1376 WRITE_INT_FIELD(typmod);
1377 WRITE_LOCATION_FIELD(location);
1381 _outNullTest(StringInfo str, const NullTest *node)
1383 WRITE_NODE_TYPE("NULLTEST");
1385 WRITE_NODE_FIELD(arg);
1386 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
1387 WRITE_BOOL_FIELD(argisrow);
1388 WRITE_LOCATION_FIELD(location);
1392 _outBooleanTest(StringInfo str, const BooleanTest *node)
1394 WRITE_NODE_TYPE("BOOLEANTEST");
1396 WRITE_NODE_FIELD(arg);
1397 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
1398 WRITE_LOCATION_FIELD(location);
1402 _outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
1404 WRITE_NODE_TYPE("COERCETODOMAIN");
1406 WRITE_NODE_FIELD(arg);
1407 WRITE_OID_FIELD(resulttype);
1408 WRITE_INT_FIELD(resulttypmod);
1409 WRITE_OID_FIELD(resultcollid);
1410 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
1411 WRITE_LOCATION_FIELD(location);
1415 _outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
1417 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
1419 WRITE_OID_FIELD(typeId);
1420 WRITE_INT_FIELD(typeMod);
1421 WRITE_OID_FIELD(collation);
1422 WRITE_LOCATION_FIELD(location);
1426 _outSetToDefault(StringInfo str, const SetToDefault *node)
1428 WRITE_NODE_TYPE("SETTODEFAULT");
1430 WRITE_OID_FIELD(typeId);
1431 WRITE_INT_FIELD(typeMod);
1432 WRITE_OID_FIELD(collation);
1433 WRITE_LOCATION_FIELD(location);
1437 _outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
1439 WRITE_NODE_TYPE("CURRENTOFEXPR");
1441 WRITE_UINT_FIELD(cvarno);
1442 WRITE_STRING_FIELD(cursor_name);
1443 WRITE_INT_FIELD(cursor_param);
1447 _outInferenceElem(StringInfo str, const InferenceElem *node)
1449 WRITE_NODE_TYPE("INFERENCEELEM");
1451 WRITE_NODE_FIELD(expr);
1452 WRITE_OID_FIELD(infercollid);
1453 WRITE_OID_FIELD(inferopfamily);
1454 WRITE_OID_FIELD(inferopcinputtype);
1458 _outTargetEntry(StringInfo str, const TargetEntry *node)
1460 WRITE_NODE_TYPE("TARGETENTRY");
1462 WRITE_NODE_FIELD(expr);
1463 WRITE_INT_FIELD(resno);
1464 WRITE_STRING_FIELD(resname);
1465 WRITE_UINT_FIELD(ressortgroupref);
1466 WRITE_OID_FIELD(resorigtbl);
1467 WRITE_INT_FIELD(resorigcol);
1468 WRITE_BOOL_FIELD(resjunk);
1472 _outRangeTblRef(StringInfo str, const RangeTblRef *node)
1474 WRITE_NODE_TYPE("RANGETBLREF");
1476 WRITE_INT_FIELD(rtindex);
1480 _outJoinExpr(StringInfo str, const JoinExpr *node)
1482 WRITE_NODE_TYPE("JOINEXPR");
1484 WRITE_ENUM_FIELD(jointype, JoinType);
1485 WRITE_BOOL_FIELD(isNatural);
1486 WRITE_NODE_FIELD(larg);
1487 WRITE_NODE_FIELD(rarg);
1488 WRITE_NODE_FIELD(usingClause);
1489 WRITE_NODE_FIELD(quals);
1490 WRITE_NODE_FIELD(alias);
1491 WRITE_INT_FIELD(rtindex);
1495 _outFromExpr(StringInfo str, const FromExpr *node)
1497 WRITE_NODE_TYPE("FROMEXPR");
1499 WRITE_NODE_FIELD(fromlist);
1500 WRITE_NODE_FIELD(quals);
1504 _outOnConflictExpr(StringInfo str, const OnConflictExpr *node)
1506 WRITE_NODE_TYPE("ONCONFLICTEXPR");
1508 WRITE_ENUM_FIELD(action, OnConflictAction);
1509 WRITE_NODE_FIELD(arbiterElems);
1510 WRITE_NODE_FIELD(arbiterWhere);
1511 WRITE_NODE_FIELD(onConflictSet);
1512 WRITE_NODE_FIELD(onConflictWhere);
1513 WRITE_OID_FIELD(constraint);
1514 WRITE_INT_FIELD(exclRelIndex);
1515 WRITE_NODE_FIELD(exclRelTlist);
1518 /*****************************************************************************
1520 * Stuff from relation.h.
1522 *****************************************************************************/
1525 * print the basic stuff of all nodes that inherit from Path
1527 * Note we do NOT print the parent, else we'd be in infinite recursion.
1528 * We can print the parent's relids for identification purposes, though.
1529 * We also do not print the whole of param_info, since it's printed by
1530 * _outRelOptInfo; it's sufficient and less cluttering to print just the
1531 * required outer relids.
1534 _outPathInfo(StringInfo str, const Path *node)
1536 WRITE_ENUM_FIELD(pathtype, NodeTag);
1537 appendStringInfoString(str, " :parent_relids ");
1539 _outBitmapset(str, node->parent->relids);
1541 _outBitmapset(str, NULL);
1542 appendStringInfoString(str, " :required_outer ");
1543 if (node->param_info)
1544 _outBitmapset(str, node->param_info->ppi_req_outer);
1546 _outBitmapset(str, NULL);
1547 WRITE_FLOAT_FIELD(rows, "%.0f");
1548 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1549 WRITE_FLOAT_FIELD(total_cost, "%.2f");
1550 WRITE_NODE_FIELD(pathkeys);
1554 * print the basic stuff of all nodes that inherit from JoinPath
1557 _outJoinPathInfo(StringInfo str, const JoinPath *node)
1559 _outPathInfo(str, (const Path *) node);
1561 WRITE_ENUM_FIELD(jointype, JoinType);
1562 WRITE_NODE_FIELD(outerjoinpath);
1563 WRITE_NODE_FIELD(innerjoinpath);
1564 WRITE_NODE_FIELD(joinrestrictinfo);
1568 _outPath(StringInfo str, const Path *node)
1570 WRITE_NODE_TYPE("PATH");
1572 _outPathInfo(str, (const Path *) node);
1576 _outIndexPath(StringInfo str, const IndexPath *node)
1578 WRITE_NODE_TYPE("INDEXPATH");
1580 _outPathInfo(str, (const Path *) node);
1582 WRITE_NODE_FIELD(indexinfo);
1583 WRITE_NODE_FIELD(indexclauses);
1584 WRITE_NODE_FIELD(indexquals);
1585 WRITE_NODE_FIELD(indexqualcols);
1586 WRITE_NODE_FIELD(indexorderbys);
1587 WRITE_NODE_FIELD(indexorderbycols);
1588 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1589 WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1590 WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1594 _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
1596 WRITE_NODE_TYPE("BITMAPHEAPPATH");
1598 _outPathInfo(str, (const Path *) node);
1600 WRITE_NODE_FIELD(bitmapqual);
1604 _outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
1606 WRITE_NODE_TYPE("BITMAPANDPATH");
1608 _outPathInfo(str, (const Path *) node);
1610 WRITE_NODE_FIELD(bitmapquals);
1611 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1615 _outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
1617 WRITE_NODE_TYPE("BITMAPORPATH");
1619 _outPathInfo(str, (const Path *) node);
1621 WRITE_NODE_FIELD(bitmapquals);
1622 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1626 _outTidPath(StringInfo str, const TidPath *node)
1628 WRITE_NODE_TYPE("TIDPATH");
1630 _outPathInfo(str, (const Path *) node);
1632 WRITE_NODE_FIELD(tidquals);
1636 _outForeignPath(StringInfo str, const ForeignPath *node)
1638 WRITE_NODE_TYPE("FOREIGNPATH");
1640 _outPathInfo(str, (const Path *) node);
1642 WRITE_NODE_FIELD(fdw_private);
1646 _outCustomPath(StringInfo str, const CustomPath *node)
1648 WRITE_NODE_TYPE("CUSTOMPATH");
1650 _outPathInfo(str, (const Path *) node);
1652 WRITE_UINT_FIELD(flags);
1653 WRITE_NODE_FIELD(custom_private);
1654 appendStringInfoString(str, " :methods ");
1655 _outToken(str, node->methods->CustomName);
1656 if (node->methods->TextOutCustomPath)
1657 node->methods->TextOutCustomPath(str, node);
1661 _outAppendPath(StringInfo str, const AppendPath *node)
1663 WRITE_NODE_TYPE("APPENDPATH");
1665 _outPathInfo(str, (const Path *) node);
1667 WRITE_NODE_FIELD(subpaths);
1671 _outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
1673 WRITE_NODE_TYPE("MERGEAPPENDPATH");
1675 _outPathInfo(str, (const Path *) node);
1677 WRITE_NODE_FIELD(subpaths);
1678 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1682 _outResultPath(StringInfo str, const ResultPath *node)
1684 WRITE_NODE_TYPE("RESULTPATH");
1686 _outPathInfo(str, (const Path *) node);
1688 WRITE_NODE_FIELD(quals);
1692 _outMaterialPath(StringInfo str, const MaterialPath *node)
1694 WRITE_NODE_TYPE("MATERIALPATH");
1696 _outPathInfo(str, (const Path *) node);
1698 WRITE_NODE_FIELD(subpath);
1702 _outUniquePath(StringInfo str, const UniquePath *node)
1704 WRITE_NODE_TYPE("UNIQUEPATH");
1706 _outPathInfo(str, (const Path *) node);
1708 WRITE_NODE_FIELD(subpath);
1709 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1710 WRITE_NODE_FIELD(in_operators);
1711 WRITE_NODE_FIELD(uniq_exprs);
1715 _outNestPath(StringInfo str, const NestPath *node)
1717 WRITE_NODE_TYPE("NESTPATH");
1719 _outJoinPathInfo(str, (const JoinPath *) node);
1723 _outMergePath(StringInfo str, const MergePath *node)
1725 WRITE_NODE_TYPE("MERGEPATH");
1727 _outJoinPathInfo(str, (const JoinPath *) node);
1729 WRITE_NODE_FIELD(path_mergeclauses);
1730 WRITE_NODE_FIELD(outersortkeys);
1731 WRITE_NODE_FIELD(innersortkeys);
1732 WRITE_BOOL_FIELD(materialize_inner);
1736 _outHashPath(StringInfo str, const HashPath *node)
1738 WRITE_NODE_TYPE("HASHPATH");
1740 _outJoinPathInfo(str, (const JoinPath *) node);
1742 WRITE_NODE_FIELD(path_hashclauses);
1743 WRITE_INT_FIELD(num_batches);
1747 _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
1749 WRITE_NODE_TYPE("PLANNERGLOBAL");
1751 /* NB: this isn't a complete set of fields */
1752 WRITE_NODE_FIELD(subplans);
1753 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
1754 WRITE_NODE_FIELD(finalrtable);
1755 WRITE_NODE_FIELD(finalrowmarks);
1756 WRITE_NODE_FIELD(resultRelations);
1757 WRITE_NODE_FIELD(relationOids);
1758 WRITE_NODE_FIELD(invalItems);
1759 WRITE_INT_FIELD(nParamExec);
1760 WRITE_UINT_FIELD(lastPHId);
1761 WRITE_UINT_FIELD(lastRowMarkId);
1762 WRITE_BOOL_FIELD(transientPlan);
1763 WRITE_BOOL_FIELD(hasRowSecurity);
1767 _outPlannerInfo(StringInfo str, const PlannerInfo *node)
1769 WRITE_NODE_TYPE("PLANNERINFO");
1771 /* NB: this isn't a complete set of fields */
1772 WRITE_NODE_FIELD(parse);
1773 WRITE_NODE_FIELD(glob);
1774 WRITE_UINT_FIELD(query_level);
1775 WRITE_NODE_FIELD(plan_params);
1776 WRITE_BITMAPSET_FIELD(all_baserels);
1777 WRITE_BITMAPSET_FIELD(nullable_baserels);
1778 WRITE_NODE_FIELD(join_rel_list);
1779 WRITE_INT_FIELD(join_cur_level);
1780 WRITE_NODE_FIELD(init_plans);
1781 WRITE_NODE_FIELD(cte_plan_ids);
1782 WRITE_NODE_FIELD(multiexpr_params);
1783 WRITE_NODE_FIELD(eq_classes);
1784 WRITE_NODE_FIELD(canon_pathkeys);
1785 WRITE_NODE_FIELD(left_join_clauses);
1786 WRITE_NODE_FIELD(right_join_clauses);
1787 WRITE_NODE_FIELD(full_join_clauses);
1788 WRITE_NODE_FIELD(join_info_list);
1789 WRITE_NODE_FIELD(lateral_info_list);
1790 WRITE_NODE_FIELD(append_rel_list);
1791 WRITE_NODE_FIELD(rowMarks);
1792 WRITE_NODE_FIELD(placeholder_list);
1793 WRITE_NODE_FIELD(query_pathkeys);
1794 WRITE_NODE_FIELD(group_pathkeys);
1795 WRITE_NODE_FIELD(window_pathkeys);
1796 WRITE_NODE_FIELD(distinct_pathkeys);
1797 WRITE_NODE_FIELD(sort_pathkeys);
1798 WRITE_NODE_FIELD(minmax_aggs);
1799 WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
1800 WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
1801 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1802 WRITE_BOOL_FIELD(hasInheritedTarget);
1803 WRITE_BOOL_FIELD(hasJoinRTEs);
1804 WRITE_BOOL_FIELD(hasLateralRTEs);
1805 WRITE_BOOL_FIELD(hasDeletedRTEs);
1806 WRITE_BOOL_FIELD(hasHavingQual);
1807 WRITE_BOOL_FIELD(hasPseudoConstantQuals);
1808 WRITE_BOOL_FIELD(hasRecursion);
1809 WRITE_INT_FIELD(wt_param_id);
1810 WRITE_BITMAPSET_FIELD(curOuterRels);
1811 WRITE_NODE_FIELD(curOuterParams);
1815 _outRelOptInfo(StringInfo str, const RelOptInfo *node)
1817 WRITE_NODE_TYPE("RELOPTINFO");
1819 /* NB: this isn't a complete set of fields */
1820 WRITE_ENUM_FIELD(reloptkind, RelOptKind);
1821 WRITE_BITMAPSET_FIELD(relids);
1822 WRITE_FLOAT_FIELD(rows, "%.0f");
1823 WRITE_INT_FIELD(width);
1824 WRITE_BOOL_FIELD(consider_startup);
1825 WRITE_NODE_FIELD(reltargetlist);
1826 WRITE_NODE_FIELD(pathlist);
1827 WRITE_NODE_FIELD(ppilist);
1828 WRITE_NODE_FIELD(cheapest_startup_path);
1829 WRITE_NODE_FIELD(cheapest_total_path);
1830 WRITE_NODE_FIELD(cheapest_unique_path);
1831 WRITE_NODE_FIELD(cheapest_parameterized_paths);
1832 WRITE_UINT_FIELD(relid);
1833 WRITE_OID_FIELD(reltablespace);
1834 WRITE_ENUM_FIELD(rtekind, RTEKind);
1835 WRITE_INT_FIELD(min_attr);
1836 WRITE_INT_FIELD(max_attr);
1837 WRITE_NODE_FIELD(lateral_vars);
1838 WRITE_BITMAPSET_FIELD(lateral_relids);
1839 WRITE_BITMAPSET_FIELD(lateral_referencers);
1840 WRITE_NODE_FIELD(indexlist);
1841 WRITE_UINT_FIELD(pages);
1842 WRITE_FLOAT_FIELD(tuples, "%.0f");
1843 WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
1844 WRITE_NODE_FIELD(subplan);
1845 WRITE_NODE_FIELD(subroot);
1846 WRITE_NODE_FIELD(subplan_params);
1847 WRITE_OID_FIELD(serverid);
1848 /* we don't try to print fdwroutine or fdw_private */
1849 WRITE_NODE_FIELD(baserestrictinfo);
1850 WRITE_NODE_FIELD(joininfo);
1851 WRITE_BOOL_FIELD(has_eclass_joins);
1855 _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
1857 WRITE_NODE_TYPE("INDEXOPTINFO");
1859 /* NB: this isn't a complete set of fields */
1860 WRITE_OID_FIELD(indexoid);
1861 /* Do NOT print rel field, else infinite recursion */
1862 WRITE_UINT_FIELD(pages);
1863 WRITE_FLOAT_FIELD(tuples, "%.0f");
1864 WRITE_INT_FIELD(tree_height);
1865 WRITE_INT_FIELD(ncolumns);
1866 /* array fields aren't really worth the trouble to print */
1867 WRITE_OID_FIELD(relam);
1868 /* indexprs is redundant since we print indextlist */
1869 WRITE_NODE_FIELD(indpred);
1870 WRITE_NODE_FIELD(indextlist);
1871 WRITE_BOOL_FIELD(predOK);
1872 WRITE_BOOL_FIELD(unique);
1873 WRITE_BOOL_FIELD(immediate);
1874 WRITE_BOOL_FIELD(hypothetical);
1875 /* we don't bother with fields copied from the pg_am entry */
1879 _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
1882 * To simplify reading, we just chase up to the topmost merged EC and
1883 * print that, without bothering to show the merge-ees separately.
1885 while (node->ec_merged)
1886 node = node->ec_merged;
1888 WRITE_NODE_TYPE("EQUIVALENCECLASS");
1890 WRITE_NODE_FIELD(ec_opfamilies);
1891 WRITE_OID_FIELD(ec_collation);
1892 WRITE_NODE_FIELD(ec_members);
1893 WRITE_NODE_FIELD(ec_sources);
1894 WRITE_NODE_FIELD(ec_derives);
1895 WRITE_BITMAPSET_FIELD(ec_relids);
1896 WRITE_BOOL_FIELD(ec_has_const);
1897 WRITE_BOOL_FIELD(ec_has_volatile);
1898 WRITE_BOOL_FIELD(ec_below_outer_join);
1899 WRITE_BOOL_FIELD(ec_broken);
1900 WRITE_UINT_FIELD(ec_sortref);
1904 _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
1906 WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
1908 WRITE_NODE_FIELD(em_expr);
1909 WRITE_BITMAPSET_FIELD(em_relids);
1910 WRITE_BITMAPSET_FIELD(em_nullable_relids);
1911 WRITE_BOOL_FIELD(em_is_const);
1912 WRITE_BOOL_FIELD(em_is_child);
1913 WRITE_OID_FIELD(em_datatype);
1917 _outPathKey(StringInfo str, const PathKey *node)
1919 WRITE_NODE_TYPE("PATHKEY");
1921 WRITE_NODE_FIELD(pk_eclass);
1922 WRITE_OID_FIELD(pk_opfamily);
1923 WRITE_INT_FIELD(pk_strategy);
1924 WRITE_BOOL_FIELD(pk_nulls_first);
1928 _outParamPathInfo(StringInfo str, const ParamPathInfo *node)
1930 WRITE_NODE_TYPE("PARAMPATHINFO");
1932 WRITE_BITMAPSET_FIELD(ppi_req_outer);
1933 WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
1934 WRITE_NODE_FIELD(ppi_clauses);
1938 _outRestrictInfo(StringInfo str, const RestrictInfo *node)
1940 WRITE_NODE_TYPE("RESTRICTINFO");
1942 /* NB: this isn't a complete set of fields */
1943 WRITE_NODE_FIELD(clause);
1944 WRITE_BOOL_FIELD(is_pushed_down);
1945 WRITE_BOOL_FIELD(outerjoin_delayed);
1946 WRITE_BOOL_FIELD(can_join);
1947 WRITE_BOOL_FIELD(pseudoconstant);
1948 WRITE_BITMAPSET_FIELD(clause_relids);
1949 WRITE_BITMAPSET_FIELD(required_relids);
1950 WRITE_BITMAPSET_FIELD(outer_relids);
1951 WRITE_BITMAPSET_FIELD(nullable_relids);
1952 WRITE_BITMAPSET_FIELD(left_relids);
1953 WRITE_BITMAPSET_FIELD(right_relids);
1954 WRITE_NODE_FIELD(orclause);
1955 /* don't write parent_ec, leads to infinite recursion in plan tree dump */
1956 WRITE_FLOAT_FIELD(norm_selec, "%.4f");
1957 WRITE_FLOAT_FIELD(outer_selec, "%.4f");
1958 WRITE_NODE_FIELD(mergeopfamilies);
1959 /* don't write left_ec, leads to infinite recursion in plan tree dump */
1960 /* don't write right_ec, leads to infinite recursion in plan tree dump */
1961 WRITE_NODE_FIELD(left_em);
1962 WRITE_NODE_FIELD(right_em);
1963 WRITE_BOOL_FIELD(outer_is_left);
1964 WRITE_OID_FIELD(hashjoinoperator);
1968 _outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node)
1970 WRITE_NODE_TYPE("PLACEHOLDERVAR");
1972 WRITE_NODE_FIELD(phexpr);
1973 WRITE_BITMAPSET_FIELD(phrels);
1974 WRITE_UINT_FIELD(phid);
1975 WRITE_UINT_FIELD(phlevelsup);
1979 _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
1981 WRITE_NODE_TYPE("SPECIALJOININFO");
1983 WRITE_BITMAPSET_FIELD(min_lefthand);
1984 WRITE_BITMAPSET_FIELD(min_righthand);
1985 WRITE_BITMAPSET_FIELD(syn_lefthand);
1986 WRITE_BITMAPSET_FIELD(syn_righthand);
1987 WRITE_ENUM_FIELD(jointype, JoinType);
1988 WRITE_BOOL_FIELD(lhs_strict);
1989 WRITE_BOOL_FIELD(delay_upper_joins);
1990 WRITE_BOOL_FIELD(semi_can_btree);
1991 WRITE_BOOL_FIELD(semi_can_hash);
1992 WRITE_NODE_FIELD(semi_operators);
1993 WRITE_NODE_FIELD(semi_rhs_exprs);
1997 _outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node)
1999 WRITE_NODE_TYPE("LATERALJOININFO");
2001 WRITE_BITMAPSET_FIELD(lateral_lhs);
2002 WRITE_BITMAPSET_FIELD(lateral_rhs);
2006 _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
2008 WRITE_NODE_TYPE("APPENDRELINFO");
2010 WRITE_UINT_FIELD(parent_relid);
2011 WRITE_UINT_FIELD(child_relid);
2012 WRITE_OID_FIELD(parent_reltype);
2013 WRITE_OID_FIELD(child_reltype);
2014 WRITE_NODE_FIELD(translated_vars);
2015 WRITE_OID_FIELD(parent_reloid);
2019 _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
2021 WRITE_NODE_TYPE("PLACEHOLDERINFO");
2023 WRITE_UINT_FIELD(phid);
2024 WRITE_NODE_FIELD(ph_var);
2025 WRITE_BITMAPSET_FIELD(ph_eval_at);
2026 WRITE_BITMAPSET_FIELD(ph_lateral);
2027 WRITE_BITMAPSET_FIELD(ph_needed);
2028 WRITE_INT_FIELD(ph_width);
2032 _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
2034 WRITE_NODE_TYPE("MINMAXAGGINFO");
2036 WRITE_OID_FIELD(aggfnoid);
2037 WRITE_OID_FIELD(aggsortop);
2038 WRITE_NODE_FIELD(target);
2039 /* We intentionally omit subroot --- too large, not interesting enough */
2040 WRITE_NODE_FIELD(path);
2041 WRITE_FLOAT_FIELD(pathcost, "%.2f");
2042 WRITE_NODE_FIELD(param);
2046 _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
2048 WRITE_NODE_TYPE("PLANNERPARAMITEM");
2050 WRITE_NODE_FIELD(item);
2051 WRITE_INT_FIELD(paramId);
2054 /*****************************************************************************
2056 * Stuff from parsenodes.h.
2058 *****************************************************************************/
2061 * print the basic stuff of all nodes that inherit from CreateStmt
2064 _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
2066 WRITE_NODE_FIELD(relation);
2067 WRITE_NODE_FIELD(tableElts);
2068 WRITE_NODE_FIELD(inhRelations);
2069 WRITE_NODE_FIELD(ofTypename);
2070 WRITE_NODE_FIELD(constraints);
2071 WRITE_NODE_FIELD(options);
2072 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
2073 WRITE_STRING_FIELD(tablespacename);
2074 WRITE_BOOL_FIELD(if_not_exists);
2078 _outCreateStmt(StringInfo str, const CreateStmt *node)
2080 WRITE_NODE_TYPE("CREATESTMT");
2082 _outCreateStmtInfo(str, (const CreateStmt *) node);
2086 _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
2088 WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
2090 _outCreateStmtInfo(str, (const CreateStmt *) node);
2092 WRITE_STRING_FIELD(servername);
2093 WRITE_NODE_FIELD(options);
2097 _outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
2099 WRITE_NODE_TYPE("IMPORTFOREIGNSCHEMASTMT");
2101 WRITE_STRING_FIELD(server_name);
2102 WRITE_STRING_FIELD(remote_schema);
2103 WRITE_STRING_FIELD(local_schema);
2104 WRITE_ENUM_FIELD(list_type, ImportForeignSchemaType);
2105 WRITE_NODE_FIELD(table_list);
2106 WRITE_NODE_FIELD(options);
2110 _outIndexStmt(StringInfo str, const IndexStmt *node)
2112 WRITE_NODE_TYPE("INDEXSTMT");
2114 WRITE_STRING_FIELD(idxname);
2115 WRITE_NODE_FIELD(relation);
2116 WRITE_STRING_FIELD(accessMethod);
2117 WRITE_STRING_FIELD(tableSpace);
2118 WRITE_NODE_FIELD(indexParams);
2119 WRITE_NODE_FIELD(options);
2120 WRITE_NODE_FIELD(whereClause);
2121 WRITE_NODE_FIELD(excludeOpNames);
2122 WRITE_STRING_FIELD(idxcomment);
2123 WRITE_OID_FIELD(indexOid);
2124 WRITE_OID_FIELD(oldNode);
2125 WRITE_BOOL_FIELD(unique);
2126 WRITE_BOOL_FIELD(primary);
2127 WRITE_BOOL_FIELD(isconstraint);
2128 WRITE_BOOL_FIELD(deferrable);
2129 WRITE_BOOL_FIELD(initdeferred);
2130 WRITE_BOOL_FIELD(transformed);
2131 WRITE_BOOL_FIELD(concurrent);
2132 WRITE_BOOL_FIELD(if_not_exists);
2136 _outNotifyStmt(StringInfo str, const NotifyStmt *node)
2138 WRITE_NODE_TYPE("NOTIFY");
2140 WRITE_STRING_FIELD(conditionname);
2141 WRITE_STRING_FIELD(payload);
2145 _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
2147 WRITE_NODE_TYPE("DECLARECURSOR");
2149 WRITE_STRING_FIELD(portalname);
2150 WRITE_INT_FIELD(options);
2151 WRITE_NODE_FIELD(query);
2155 _outSelectStmt(StringInfo str, const SelectStmt *node)
2157 WRITE_NODE_TYPE("SELECT");
2159 WRITE_NODE_FIELD(distinctClause);
2160 WRITE_NODE_FIELD(intoClause);
2161 WRITE_NODE_FIELD(targetList);
2162 WRITE_NODE_FIELD(fromClause);
2163 WRITE_NODE_FIELD(whereClause);
2164 WRITE_NODE_FIELD(groupClause);
2165 WRITE_NODE_FIELD(havingClause);
2166 WRITE_NODE_FIELD(windowClause);
2167 WRITE_NODE_FIELD(valuesLists);
2168 WRITE_NODE_FIELD(sortClause);
2169 WRITE_NODE_FIELD(limitOffset);
2170 WRITE_NODE_FIELD(limitCount);
2171 WRITE_NODE_FIELD(lockingClause);
2172 WRITE_NODE_FIELD(withClause);
2173 WRITE_ENUM_FIELD(op, SetOperation);
2174 WRITE_BOOL_FIELD(all);
2175 WRITE_NODE_FIELD(larg);
2176 WRITE_NODE_FIELD(rarg);
2180 _outFuncCall(StringInfo str, const FuncCall *node)
2182 WRITE_NODE_TYPE("FUNCCALL");
2184 WRITE_NODE_FIELD(funcname);
2185 WRITE_NODE_FIELD(args);
2186 WRITE_NODE_FIELD(agg_order);
2187 WRITE_NODE_FIELD(agg_filter);
2188 WRITE_BOOL_FIELD(agg_within_group);
2189 WRITE_BOOL_FIELD(agg_star);
2190 WRITE_BOOL_FIELD(agg_distinct);
2191 WRITE_BOOL_FIELD(func_variadic);
2192 WRITE_NODE_FIELD(over);
2193 WRITE_LOCATION_FIELD(location);
2197 _outDefElem(StringInfo str, const DefElem *node)
2199 WRITE_NODE_TYPE("DEFELEM");
2201 WRITE_STRING_FIELD(defnamespace);
2202 WRITE_STRING_FIELD(defname);
2203 WRITE_NODE_FIELD(arg);
2204 WRITE_ENUM_FIELD(defaction, DefElemAction);
2208 _outTableLikeClause(StringInfo str, const TableLikeClause *node)
2210 WRITE_NODE_TYPE("TABLELIKECLAUSE");
2212 WRITE_NODE_FIELD(relation);
2213 WRITE_UINT_FIELD(options);
2217 _outLockingClause(StringInfo str, const LockingClause *node)
2219 WRITE_NODE_TYPE("LOCKINGCLAUSE");
2221 WRITE_NODE_FIELD(lockedRels);
2222 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2223 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2227 _outXmlSerialize(StringInfo str, const XmlSerialize *node)
2229 WRITE_NODE_TYPE("XMLSERIALIZE");
2231 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
2232 WRITE_NODE_FIELD(expr);
2233 WRITE_NODE_FIELD(typeName);
2234 WRITE_LOCATION_FIELD(location);
2238 _outColumnDef(StringInfo str, const ColumnDef *node)
2240 WRITE_NODE_TYPE("COLUMNDEF");
2242 WRITE_STRING_FIELD(colname);
2243 WRITE_NODE_FIELD(typeName);
2244 WRITE_INT_FIELD(inhcount);
2245 WRITE_BOOL_FIELD(is_local);
2246 WRITE_BOOL_FIELD(is_not_null);
2247 WRITE_BOOL_FIELD(is_from_type);
2248 WRITE_CHAR_FIELD(storage);
2249 WRITE_NODE_FIELD(raw_default);
2250 WRITE_NODE_FIELD(cooked_default);
2251 WRITE_NODE_FIELD(collClause);
2252 WRITE_OID_FIELD(collOid);
2253 WRITE_NODE_FIELD(constraints);
2254 WRITE_NODE_FIELD(fdwoptions);
2255 WRITE_LOCATION_FIELD(location);
2259 _outTypeName(StringInfo str, const TypeName *node)
2261 WRITE_NODE_TYPE("TYPENAME");
2263 WRITE_NODE_FIELD(names);
2264 WRITE_OID_FIELD(typeOid);
2265 WRITE_BOOL_FIELD(setof);
2266 WRITE_BOOL_FIELD(pct_type);
2267 WRITE_NODE_FIELD(typmods);
2268 WRITE_INT_FIELD(typemod);
2269 WRITE_NODE_FIELD(arrayBounds);
2270 WRITE_LOCATION_FIELD(location);
2274 _outTypeCast(StringInfo str, const TypeCast *node)
2276 WRITE_NODE_TYPE("TYPECAST");
2278 WRITE_NODE_FIELD(arg);
2279 WRITE_NODE_FIELD(typeName);
2280 WRITE_LOCATION_FIELD(location);
2284 _outCollateClause(StringInfo str, const CollateClause *node)
2286 WRITE_NODE_TYPE("COLLATECLAUSE");
2288 WRITE_NODE_FIELD(arg);
2289 WRITE_NODE_FIELD(collname);
2290 WRITE_LOCATION_FIELD(location);
2294 _outIndexElem(StringInfo str, const IndexElem *node)
2296 WRITE_NODE_TYPE("INDEXELEM");
2298 WRITE_STRING_FIELD(name);
2299 WRITE_NODE_FIELD(expr);
2300 WRITE_STRING_FIELD(indexcolname);
2301 WRITE_NODE_FIELD(collation);
2302 WRITE_NODE_FIELD(opclass);
2303 WRITE_ENUM_FIELD(ordering, SortByDir);
2304 WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2308 _outQuery(StringInfo str, const Query *node)
2310 WRITE_NODE_TYPE("QUERY");
2312 WRITE_ENUM_FIELD(commandType, CmdType);
2313 WRITE_ENUM_FIELD(querySource, QuerySource);
2314 /* we intentionally do not print the queryId field */
2315 WRITE_BOOL_FIELD(canSetTag);
2318 * Hack to work around missing outfuncs routines for a lot of the
2319 * utility-statement node types. (The only one we actually *need* for
2320 * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2321 * for the meantime do this to avoid getting lots of warnings when running
2322 * with debug_print_parse on.
2324 if (node->utilityStmt)
2326 switch (nodeTag(node->utilityStmt))
2331 case T_DeclareCursorStmt:
2332 WRITE_NODE_FIELD(utilityStmt);
2335 appendStringInfoString(str, " :utilityStmt ?");
2340 appendStringInfoString(str, " :utilityStmt <>");
2342 WRITE_INT_FIELD(resultRelation);
2343 WRITE_BOOL_FIELD(hasAggs);
2344 WRITE_BOOL_FIELD(hasWindowFuncs);
2345 WRITE_BOOL_FIELD(hasSubLinks);
2346 WRITE_BOOL_FIELD(hasDistinctOn);
2347 WRITE_BOOL_FIELD(hasRecursive);
2348 WRITE_BOOL_FIELD(hasModifyingCTE);
2349 WRITE_BOOL_FIELD(hasForUpdate);
2350 WRITE_BOOL_FIELD(hasRowSecurity);
2351 WRITE_NODE_FIELD(cteList);
2352 WRITE_NODE_FIELD(rtable);
2353 WRITE_NODE_FIELD(jointree);
2354 WRITE_NODE_FIELD(targetList);
2355 WRITE_NODE_FIELD(withCheckOptions);
2356 WRITE_NODE_FIELD(onConflict);
2357 WRITE_NODE_FIELD(returningList);
2358 WRITE_NODE_FIELD(groupClause);
2359 WRITE_NODE_FIELD(havingQual);
2360 WRITE_NODE_FIELD(windowClause);
2361 WRITE_NODE_FIELD(distinctClause);
2362 WRITE_NODE_FIELD(sortClause);
2363 WRITE_NODE_FIELD(limitOffset);
2364 WRITE_NODE_FIELD(limitCount);
2365 WRITE_NODE_FIELD(rowMarks);
2366 WRITE_NODE_FIELD(setOperations);
2367 WRITE_NODE_FIELD(constraintDeps);
2371 _outWithCheckOption(StringInfo str, const WithCheckOption *node)
2373 WRITE_NODE_TYPE("WITHCHECKOPTION");
2375 WRITE_ENUM_FIELD(kind, WCOKind);
2376 WRITE_STRING_FIELD(relname);
2377 WRITE_NODE_FIELD(qual);
2378 WRITE_BOOL_FIELD(cascaded);
2382 _outSortGroupClause(StringInfo str, const SortGroupClause *node)
2384 WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2386 WRITE_UINT_FIELD(tleSortGroupRef);
2387 WRITE_OID_FIELD(eqop);
2388 WRITE_OID_FIELD(sortop);
2389 WRITE_BOOL_FIELD(nulls_first);
2390 WRITE_BOOL_FIELD(hashable);
2394 _outWindowClause(StringInfo str, const WindowClause *node)
2396 WRITE_NODE_TYPE("WINDOWCLAUSE");
2398 WRITE_STRING_FIELD(name);
2399 WRITE_STRING_FIELD(refname);
2400 WRITE_NODE_FIELD(partitionClause);
2401 WRITE_NODE_FIELD(orderClause);
2402 WRITE_INT_FIELD(frameOptions);
2403 WRITE_NODE_FIELD(startOffset);
2404 WRITE_NODE_FIELD(endOffset);
2405 WRITE_UINT_FIELD(winref);
2406 WRITE_BOOL_FIELD(copiedOrder);
2410 _outRowMarkClause(StringInfo str, const RowMarkClause *node)
2412 WRITE_NODE_TYPE("ROWMARKCLAUSE");
2414 WRITE_UINT_FIELD(rti);
2415 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2416 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2417 WRITE_BOOL_FIELD(pushedDown);
2421 _outWithClause(StringInfo str, const WithClause *node)
2423 WRITE_NODE_TYPE("WITHCLAUSE");
2425 WRITE_NODE_FIELD(ctes);
2426 WRITE_BOOL_FIELD(recursive);
2427 WRITE_LOCATION_FIELD(location);
2431 _outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
2433 WRITE_NODE_TYPE("COMMONTABLEEXPR");
2435 WRITE_STRING_FIELD(ctename);
2436 WRITE_NODE_FIELD(aliascolnames);
2437 WRITE_NODE_FIELD(ctequery);
2438 WRITE_LOCATION_FIELD(location);
2439 WRITE_BOOL_FIELD(cterecursive);
2440 WRITE_INT_FIELD(cterefcount);
2441 WRITE_NODE_FIELD(ctecolnames);
2442 WRITE_NODE_FIELD(ctecoltypes);
2443 WRITE_NODE_FIELD(ctecoltypmods);
2444 WRITE_NODE_FIELD(ctecolcollations);
2448 _outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
2450 WRITE_NODE_TYPE("SETOPERATIONSTMT");
2452 WRITE_ENUM_FIELD(op, SetOperation);
2453 WRITE_BOOL_FIELD(all);
2454 WRITE_NODE_FIELD(larg);
2455 WRITE_NODE_FIELD(rarg);
2456 WRITE_NODE_FIELD(colTypes);
2457 WRITE_NODE_FIELD(colTypmods);
2458 WRITE_NODE_FIELD(colCollations);
2459 WRITE_NODE_FIELD(groupClauses);
2463 _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
2465 WRITE_NODE_TYPE("RTE");
2467 /* put alias + eref first to make dump more legible */
2468 WRITE_NODE_FIELD(alias);
2469 WRITE_NODE_FIELD(eref);
2470 WRITE_ENUM_FIELD(rtekind, RTEKind);
2472 switch (node->rtekind)
2475 WRITE_OID_FIELD(relid);
2476 WRITE_CHAR_FIELD(relkind);
2479 WRITE_NODE_FIELD(subquery);
2480 WRITE_BOOL_FIELD(security_barrier);
2483 WRITE_ENUM_FIELD(jointype, JoinType);
2484 WRITE_NODE_FIELD(joinaliasvars);
2487 WRITE_NODE_FIELD(functions);
2488 WRITE_BOOL_FIELD(funcordinality);
2491 WRITE_NODE_FIELD(values_lists);
2492 WRITE_NODE_FIELD(values_collations);
2495 WRITE_STRING_FIELD(ctename);
2496 WRITE_UINT_FIELD(ctelevelsup);
2497 WRITE_BOOL_FIELD(self_reference);
2498 WRITE_NODE_FIELD(ctecoltypes);
2499 WRITE_NODE_FIELD(ctecoltypmods);
2500 WRITE_NODE_FIELD(ctecolcollations);
2503 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
2507 WRITE_BOOL_FIELD(lateral);
2508 WRITE_BOOL_FIELD(inh);
2509 WRITE_BOOL_FIELD(inFromCl);
2510 WRITE_UINT_FIELD(requiredPerms);
2511 WRITE_OID_FIELD(checkAsUser);
2512 WRITE_BITMAPSET_FIELD(selectedCols);
2513 WRITE_BITMAPSET_FIELD(insertedCols);
2514 WRITE_BITMAPSET_FIELD(updatedCols);
2515 WRITE_NODE_FIELD(securityQuals);
2519 _outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
2521 WRITE_NODE_TYPE("RANGETBLFUNCTION");
2523 WRITE_NODE_FIELD(funcexpr);
2524 WRITE_INT_FIELD(funccolcount);
2525 WRITE_NODE_FIELD(funccolnames);
2526 WRITE_NODE_FIELD(funccoltypes);
2527 WRITE_NODE_FIELD(funccoltypmods);
2528 WRITE_NODE_FIELD(funccolcollations);
2529 WRITE_BITMAPSET_FIELD(funcparams);
2533 _outAExpr(StringInfo str, const A_Expr *node)
2535 WRITE_NODE_TYPE("AEXPR");
2540 appendStringInfoChar(str, ' ');
2541 WRITE_NODE_FIELD(name);
2544 appendStringInfoChar(str, ' ');
2545 WRITE_NODE_FIELD(name);
2546 appendStringInfoString(str, " ANY ");
2549 appendStringInfoChar(str, ' ');
2550 WRITE_NODE_FIELD(name);
2551 appendStringInfoString(str, " ALL ");
2553 case AEXPR_DISTINCT:
2554 appendStringInfoString(str, " DISTINCT ");
2555 WRITE_NODE_FIELD(name);
2558 appendStringInfoString(str, " NULLIF ");
2559 WRITE_NODE_FIELD(name);
2562 appendStringInfoString(str, " OF ");
2563 WRITE_NODE_FIELD(name);
2566 appendStringInfoString(str, " IN ");
2567 WRITE_NODE_FIELD(name);
2570 appendStringInfoString(str, " LIKE ");
2571 WRITE_NODE_FIELD(name);
2574 appendStringInfoString(str, " ILIKE ");
2575 WRITE_NODE_FIELD(name);
2578 appendStringInfoString(str, " SIMILAR ");
2579 WRITE_NODE_FIELD(name);
2582 appendStringInfoString(str, " BETWEEN ");
2583 WRITE_NODE_FIELD(name);
2585 case AEXPR_NOT_BETWEEN:
2586 appendStringInfoString(str, " NOT_BETWEEN ");
2587 WRITE_NODE_FIELD(name);
2589 case AEXPR_BETWEEN_SYM:
2590 appendStringInfoString(str, " BETWEEN_SYM ");
2591 WRITE_NODE_FIELD(name);
2593 case AEXPR_NOT_BETWEEN_SYM:
2594 appendStringInfoString(str, " NOT_BETWEEN_SYM ");
2595 WRITE_NODE_FIELD(name);
2598 appendStringInfoString(str, " PAREN");
2601 appendStringInfoString(str, " ??");
2605 WRITE_NODE_FIELD(lexpr);
2606 WRITE_NODE_FIELD(rexpr);
2607 WRITE_LOCATION_FIELD(location);
2611 _outValue(StringInfo str, const Value *value)
2613 switch (value->type)
2616 appendStringInfo(str, "%ld", value->val.ival);
2621 * We assume the value is a valid numeric literal and so does not
2624 appendStringInfoString(str, value->val.str);
2629 * We use _outToken to provide escaping of the string's content,
2630 * but we don't want it to do anything with an empty string.
2632 appendStringInfoChar(str, '"');
2633 if (value->val.str[0] != '\0')
2634 _outToken(str, value->val.str);
2635 appendStringInfoChar(str, '"');
2638 /* internal representation already has leading 'b' */
2639 appendStringInfoString(str, value->val.str);
2642 /* this is seen only within A_Const, not in transformed trees */
2643 appendStringInfoString(str, "NULL");
2646 elog(ERROR, "unrecognized node type: %d", (int) value->type);
2652 _outColumnRef(StringInfo str, const ColumnRef *node)
2654 WRITE_NODE_TYPE("COLUMNREF");
2656 WRITE_NODE_FIELD(fields);
2657 WRITE_LOCATION_FIELD(location);
2661 _outParamRef(StringInfo str, const ParamRef *node)
2663 WRITE_NODE_TYPE("PARAMREF");
2665 WRITE_INT_FIELD(number);
2666 WRITE_LOCATION_FIELD(location);
2670 _outAConst(StringInfo str, const A_Const *node)
2672 WRITE_NODE_TYPE("A_CONST");
2674 appendStringInfoString(str, " :val ");
2675 _outValue(str, &(node->val));
2676 WRITE_LOCATION_FIELD(location);
2680 _outA_Star(StringInfo str, const A_Star *node)
2682 WRITE_NODE_TYPE("A_STAR");
2686 _outA_Indices(StringInfo str, const A_Indices *node)
2688 WRITE_NODE_TYPE("A_INDICES");
2690 WRITE_NODE_FIELD(lidx);
2691 WRITE_NODE_FIELD(uidx);
2695 _outA_Indirection(StringInfo str, const A_Indirection *node)
2697 WRITE_NODE_TYPE("A_INDIRECTION");
2699 WRITE_NODE_FIELD(arg);
2700 WRITE_NODE_FIELD(indirection);
2704 _outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
2706 WRITE_NODE_TYPE("A_ARRAYEXPR");
2708 WRITE_NODE_FIELD(elements);
2709 WRITE_LOCATION_FIELD(location);
2713 _outResTarget(StringInfo str, const ResTarget *node)
2715 WRITE_NODE_TYPE("RESTARGET");
2717 WRITE_STRING_FIELD(name);
2718 WRITE_NODE_FIELD(indirection);
2719 WRITE_NODE_FIELD(val);
2720 WRITE_LOCATION_FIELD(location);
2724 _outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
2726 WRITE_NODE_TYPE("MULTIASSIGNREF");
2728 WRITE_NODE_FIELD(source);
2729 WRITE_INT_FIELD(colno);
2730 WRITE_INT_FIELD(ncolumns);
2734 _outSortBy(StringInfo str, const SortBy *node)
2736 WRITE_NODE_TYPE("SORTBY");
2738 WRITE_NODE_FIELD(node);
2739 WRITE_ENUM_FIELD(sortby_dir, SortByDir);
2740 WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
2741 WRITE_NODE_FIELD(useOp);
2742 WRITE_LOCATION_FIELD(location);
2746 _outWindowDef(StringInfo str, const WindowDef *node)
2748 WRITE_NODE_TYPE("WINDOWDEF");
2750 WRITE_STRING_FIELD(name);
2751 WRITE_STRING_FIELD(refname);
2752 WRITE_NODE_FIELD(partitionClause);
2753 WRITE_NODE_FIELD(orderClause);
2754 WRITE_INT_FIELD(frameOptions);
2755 WRITE_NODE_FIELD(startOffset);
2756 WRITE_NODE_FIELD(endOffset);
2757 WRITE_LOCATION_FIELD(location);
2761 _outRangeSubselect(StringInfo str, const RangeSubselect *node)
2763 WRITE_NODE_TYPE("RANGESUBSELECT");
2765 WRITE_BOOL_FIELD(lateral);
2766 WRITE_NODE_FIELD(subquery);
2767 WRITE_NODE_FIELD(alias);
2771 _outRangeFunction(StringInfo str, const RangeFunction *node)
2773 WRITE_NODE_TYPE("RANGEFUNCTION");
2775 WRITE_BOOL_FIELD(lateral);
2776 WRITE_BOOL_FIELD(ordinality);
2777 WRITE_BOOL_FIELD(is_rowsfrom);
2778 WRITE_NODE_FIELD(functions);
2779 WRITE_NODE_FIELD(alias);
2780 WRITE_NODE_FIELD(coldeflist);
2784 _outConstraint(StringInfo str, const Constraint *node)
2786 WRITE_NODE_TYPE("CONSTRAINT");
2788 WRITE_STRING_FIELD(conname);
2789 WRITE_BOOL_FIELD(deferrable);
2790 WRITE_BOOL_FIELD(initdeferred);
2791 WRITE_LOCATION_FIELD(location);
2793 appendStringInfoString(str, " :contype ");
2794 switch (node->contype)
2797 appendStringInfoString(str, "NULL");
2800 case CONSTR_NOTNULL:
2801 appendStringInfoString(str, "NOT_NULL");
2804 case CONSTR_DEFAULT:
2805 appendStringInfoString(str, "DEFAULT");
2806 WRITE_NODE_FIELD(raw_expr);
2807 WRITE_STRING_FIELD(cooked_expr);
2811 appendStringInfoString(str, "CHECK");
2812 WRITE_BOOL_FIELD(is_no_inherit);
2813 WRITE_NODE_FIELD(raw_expr);
2814 WRITE_STRING_FIELD(cooked_expr);
2817 case CONSTR_PRIMARY:
2818 appendStringInfoString(str, "PRIMARY_KEY");
2819 WRITE_NODE_FIELD(keys);
2820 WRITE_NODE_FIELD(options);
2821 WRITE_STRING_FIELD(indexname);
2822 WRITE_STRING_FIELD(indexspace);
2823 /* access_method and where_clause not currently used */
2827 appendStringInfoString(str, "UNIQUE");
2828 WRITE_NODE_FIELD(keys);
2829 WRITE_NODE_FIELD(options);
2830 WRITE_STRING_FIELD(indexname);
2831 WRITE_STRING_FIELD(indexspace);
2832 /* access_method and where_clause not currently used */
2835 case CONSTR_EXCLUSION:
2836 appendStringInfoString(str, "EXCLUSION");
2837 WRITE_NODE_FIELD(exclusions);
2838 WRITE_NODE_FIELD(options);
2839 WRITE_STRING_FIELD(indexname);
2840 WRITE_STRING_FIELD(indexspace);
2841 WRITE_STRING_FIELD(access_method);
2842 WRITE_NODE_FIELD(where_clause);
2845 case CONSTR_FOREIGN:
2846 appendStringInfoString(str, "FOREIGN_KEY");
2847 WRITE_NODE_FIELD(pktable);
2848 WRITE_NODE_FIELD(fk_attrs);
2849 WRITE_NODE_FIELD(pk_attrs);
2850 WRITE_CHAR_FIELD(fk_matchtype);
2851 WRITE_CHAR_FIELD(fk_upd_action);
2852 WRITE_CHAR_FIELD(fk_del_action);
2853 WRITE_NODE_FIELD(old_conpfeqop);
2854 WRITE_OID_FIELD(old_pktable_oid);
2855 WRITE_BOOL_FIELD(skip_validation);
2856 WRITE_BOOL_FIELD(initially_valid);
2859 case CONSTR_ATTR_DEFERRABLE:
2860 appendStringInfoString(str, "ATTR_DEFERRABLE");
2863 case CONSTR_ATTR_NOT_DEFERRABLE:
2864 appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
2867 case CONSTR_ATTR_DEFERRED:
2868 appendStringInfoString(str, "ATTR_DEFERRED");
2871 case CONSTR_ATTR_IMMEDIATE:
2872 appendStringInfoString(str, "ATTR_IMMEDIATE");
2876 appendStringInfo(str, "<unrecognized_constraint %d>",
2877 (int) node->contype);
2885 * converts a Node into ascii string and append it to 'str'
2888 _outNode(StringInfo str, const void *obj)
2891 appendStringInfoString(str, "<>");
2892 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
2894 else if (IsA(obj, Integer) ||
2897 IsA(obj, BitString))
2899 /* nodeRead does not want to see { } around these! */
2900 _outValue(str, obj);
2904 appendStringInfoChar(str, '{');
2905 switch (nodeTag(obj))
2908 _outPlannedStmt(str, obj);
2914 _outResult(str, obj);
2917 _outModifyTable(str, obj);
2920 _outAppend(str, obj);
2923 _outMergeAppend(str, obj);
2925 case T_RecursiveUnion:
2926 _outRecursiveUnion(str, obj);
2929 _outBitmapAnd(str, obj);
2932 _outBitmapOr(str, obj);
2938 _outSeqScan(str, obj);
2941 _outIndexScan(str, obj);
2943 case T_IndexOnlyScan:
2944 _outIndexOnlyScan(str, obj);
2946 case T_BitmapIndexScan:
2947 _outBitmapIndexScan(str, obj);
2949 case T_BitmapHeapScan:
2950 _outBitmapHeapScan(str, obj);
2953 _outTidScan(str, obj);
2955 case T_SubqueryScan:
2956 _outSubqueryScan(str, obj);
2958 case T_FunctionScan:
2959 _outFunctionScan(str, obj);
2962 _outValuesScan(str, obj);
2965 _outCteScan(str, obj);
2967 case T_WorkTableScan:
2968 _outWorkTableScan(str, obj);
2971 _outForeignScan(str, obj);
2974 _outCustomScan(str, obj);
2980 _outNestLoop(str, obj);
2983 _outMergeJoin(str, obj);
2986 _outHashJoin(str, obj);
2992 _outWindowAgg(str, obj);
2995 _outGroup(str, obj);
2998 _outMaterial(str, obj);
3004 _outUnique(str, obj);
3010 _outSetOp(str, obj);
3013 _outLockRows(str, obj);
3016 _outLimit(str, obj);
3018 case T_NestLoopParam:
3019 _outNestLoopParam(str, obj);
3022 _outPlanRowMark(str, obj);
3024 case T_PlanInvalItem:
3025 _outPlanInvalItem(str, obj);
3028 _outAlias(str, obj);
3031 _outRangeVar(str, obj);
3034 _outIntoClause(str, obj);
3040 _outConst(str, obj);
3043 _outParam(str, obj);
3046 _outAggref(str, obj);
3049 _outWindowFunc(str, obj);
3052 _outArrayRef(str, obj);
3055 _outFuncExpr(str, obj);
3057 case T_NamedArgExpr:
3058 _outNamedArgExpr(str, obj);
3061 _outOpExpr(str, obj);
3063 case T_DistinctExpr:
3064 _outDistinctExpr(str, obj);
3067 _outNullIfExpr(str, obj);
3069 case T_ScalarArrayOpExpr:
3070 _outScalarArrayOpExpr(str, obj);
3073 _outBoolExpr(str, obj);
3076 _outSubLink(str, obj);
3079 _outSubPlan(str, obj);
3081 case T_AlternativeSubPlan:
3082 _outAlternativeSubPlan(str, obj);
3085 _outFieldSelect(str, obj);
3088 _outFieldStore(str, obj);
3091 _outRelabelType(str, obj);
3094 _outCoerceViaIO(str, obj);
3096 case T_ArrayCoerceExpr:
3097 _outArrayCoerceExpr(str, obj);
3099 case T_ConvertRowtypeExpr:
3100 _outConvertRowtypeExpr(str, obj);
3103 _outCollateExpr(str, obj);
3106 _outCaseExpr(str, obj);
3109 _outCaseWhen(str, obj);
3111 case T_CaseTestExpr:
3112 _outCaseTestExpr(str, obj);
3115 _outArrayExpr(str, obj);
3118 _outRowExpr(str, obj);
3120 case T_RowCompareExpr:
3121 _outRowCompareExpr(str, obj);
3123 case T_CoalesceExpr:
3124 _outCoalesceExpr(str, obj);
3127 _outMinMaxExpr(str, obj);
3130 _outXmlExpr(str, obj);
3133 _outNullTest(str, obj);
3136 _outBooleanTest(str, obj);
3138 case T_CoerceToDomain:
3139 _outCoerceToDomain(str, obj);
3141 case T_CoerceToDomainValue:
3142 _outCoerceToDomainValue(str, obj);
3144 case T_SetToDefault:
3145 _outSetToDefault(str, obj);
3147 case T_CurrentOfExpr:
3148 _outCurrentOfExpr(str, obj);
3150 case T_InferenceElem:
3151 _outInferenceElem(str, obj);
3154 _outTargetEntry(str, obj);
3157 _outRangeTblRef(str, obj);
3160 _outJoinExpr(str, obj);
3163 _outFromExpr(str, obj);
3165 case T_OnConflictExpr:
3166 _outOnConflictExpr(str, obj);
3172 _outIndexPath(str, obj);
3174 case T_BitmapHeapPath:
3175 _outBitmapHeapPath(str, obj);
3177 case T_BitmapAndPath:
3178 _outBitmapAndPath(str, obj);
3180 case T_BitmapOrPath:
3181 _outBitmapOrPath(str, obj);
3184 _outTidPath(str, obj);
3187 _outForeignPath(str, obj);
3190 _outCustomPath(str, obj);
3193 _outAppendPath(str, obj);
3195 case T_MergeAppendPath:
3196 _outMergeAppendPath(str, obj);
3199 _outResultPath(str, obj);
3201 case T_MaterialPath:
3202 _outMaterialPath(str, obj);
3205 _outUniquePath(str, obj);
3208 _outNestPath(str, obj);
3211 _outMergePath(str, obj);
3214 _outHashPath(str, obj);
3216 case T_PlannerGlobal:
3217 _outPlannerGlobal(str, obj);
3220 _outPlannerInfo(str, obj);
3223 _outRelOptInfo(str, obj);
3225 case T_IndexOptInfo:
3226 _outIndexOptInfo(str, obj);
3228 case T_EquivalenceClass:
3229 _outEquivalenceClass(str, obj);
3231 case T_EquivalenceMember:
3232 _outEquivalenceMember(str, obj);
3235 _outPathKey(str, obj);
3237 case T_ParamPathInfo:
3238 _outParamPathInfo(str, obj);
3240 case T_RestrictInfo:
3241 _outRestrictInfo(str, obj);
3243 case T_PlaceHolderVar:
3244 _outPlaceHolderVar(str, obj);
3246 case T_SpecialJoinInfo:
3247 _outSpecialJoinInfo(str, obj);
3249 case T_LateralJoinInfo:
3250 _outLateralJoinInfo(str, obj);
3252 case T_AppendRelInfo:
3253 _outAppendRelInfo(str, obj);
3255 case T_PlaceHolderInfo:
3256 _outPlaceHolderInfo(str, obj);
3258 case T_MinMaxAggInfo:
3259 _outMinMaxAggInfo(str, obj);
3261 case T_PlannerParamItem:
3262 _outPlannerParamItem(str, obj);
3266 _outCreateStmt(str, obj);
3268 case T_CreateForeignTableStmt:
3269 _outCreateForeignTableStmt(str, obj);
3271 case T_ImportForeignSchemaStmt:
3272 _outImportForeignSchemaStmt(str, obj);
3275 _outIndexStmt(str, obj);
3278 _outNotifyStmt(str, obj);
3280 case T_DeclareCursorStmt:
3281 _outDeclareCursorStmt(str, obj);
3284 _outSelectStmt(str, obj);
3287 _outColumnDef(str, obj);
3290 _outTypeName(str, obj);
3293 _outTypeCast(str, obj);
3295 case T_CollateClause:
3296 _outCollateClause(str, obj);
3299 _outIndexElem(str, obj);
3302 _outQuery(str, obj);
3304 case T_WithCheckOption:
3305 _outWithCheckOption(str, obj);
3307 case T_SortGroupClause:
3308 _outSortGroupClause(str, obj);
3310 case T_WindowClause:
3311 _outWindowClause(str, obj);
3313 case T_RowMarkClause:
3314 _outRowMarkClause(str, obj);
3317 _outWithClause(str, obj);
3319 case T_CommonTableExpr:
3320 _outCommonTableExpr(str, obj);
3322 case T_SetOperationStmt:
3323 _outSetOperationStmt(str, obj);
3325 case T_RangeTblEntry:
3326 _outRangeTblEntry(str, obj);
3328 case T_RangeTblFunction:
3329 _outRangeTblFunction(str, obj);
3332 _outAExpr(str, obj);
3335 _outColumnRef(str, obj);
3338 _outParamRef(str, obj);
3341 _outAConst(str, obj);
3344 _outA_Star(str, obj);
3347 _outA_Indices(str, obj);
3349 case T_A_Indirection:
3350 _outA_Indirection(str, obj);
3353 _outA_ArrayExpr(str, obj);
3356 _outResTarget(str, obj);
3358 case T_MultiAssignRef:
3359 _outMultiAssignRef(str, obj);
3362 _outSortBy(str, obj);
3365 _outWindowDef(str, obj);
3367 case T_RangeSubselect:
3368 _outRangeSubselect(str, obj);
3370 case T_RangeFunction:
3371 _outRangeFunction(str, obj);
3374 _outConstraint(str, obj);
3377 _outFuncCall(str, obj);
3380 _outDefElem(str, obj);
3382 case T_TableLikeClause:
3383 _outTableLikeClause(str, obj);
3385 case T_LockingClause:
3386 _outLockingClause(str, obj);
3388 case T_XmlSerialize:
3389 _outXmlSerialize(str, obj);
3395 * This should be an ERROR, but it's too useful to be able to
3396 * dump structures that _outNode only understands part of.
3398 elog(WARNING, "could not dump unrecognized node type: %d",
3399 (int) nodeTag(obj));
3402 appendStringInfoChar(str, '}');
3408 * returns the ascii representation of the Node as a palloc'd string
3411 nodeToString(const void *obj)
3415 /* see stringinfo.h for an explanation of this maneuver */
3416 initStringInfo(&str);
3417 _outNode(&str, obj);