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);
258 WRITE_BOOL_FIELD(hasRowSecurity);
262 * print the basic stuff of all nodes that inherit from Plan
265 _outPlanInfo(StringInfo str, const Plan *node)
267 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
268 WRITE_FLOAT_FIELD(total_cost, "%.2f");
269 WRITE_FLOAT_FIELD(plan_rows, "%.0f");
270 WRITE_INT_FIELD(plan_width);
271 WRITE_NODE_FIELD(targetlist);
272 WRITE_NODE_FIELD(qual);
273 WRITE_NODE_FIELD(lefttree);
274 WRITE_NODE_FIELD(righttree);
275 WRITE_NODE_FIELD(initPlan);
276 WRITE_BITMAPSET_FIELD(extParam);
277 WRITE_BITMAPSET_FIELD(allParam);
281 * print the basic stuff of all nodes that inherit from Scan
284 _outScanInfo(StringInfo str, const Scan *node)
286 _outPlanInfo(str, (const Plan *) node);
288 WRITE_UINT_FIELD(scanrelid);
292 * print the basic stuff of all nodes that inherit from Join
295 _outJoinPlanInfo(StringInfo str, const Join *node)
297 _outPlanInfo(str, (const Plan *) node);
299 WRITE_ENUM_FIELD(jointype, JoinType);
300 WRITE_NODE_FIELD(joinqual);
305 _outPlan(StringInfo str, const Plan *node)
307 WRITE_NODE_TYPE("PLAN");
309 _outPlanInfo(str, (const Plan *) node);
313 _outResult(StringInfo str, const Result *node)
315 WRITE_NODE_TYPE("RESULT");
317 _outPlanInfo(str, (const Plan *) node);
319 WRITE_NODE_FIELD(resconstantqual);
323 _outModifyTable(StringInfo str, const ModifyTable *node)
325 WRITE_NODE_TYPE("MODIFYTABLE");
327 _outPlanInfo(str, (const Plan *) node);
329 WRITE_ENUM_FIELD(operation, CmdType);
330 WRITE_BOOL_FIELD(canSetTag);
331 WRITE_UINT_FIELD(nominalRelation);
332 WRITE_NODE_FIELD(resultRelations);
333 WRITE_INT_FIELD(resultRelIndex);
334 WRITE_NODE_FIELD(plans);
335 WRITE_NODE_FIELD(withCheckOptionLists);
336 WRITE_NODE_FIELD(returningLists);
337 WRITE_NODE_FIELD(fdwPrivLists);
338 WRITE_NODE_FIELD(rowMarks);
339 WRITE_INT_FIELD(epqParam);
343 _outAppend(StringInfo str, const Append *node)
345 WRITE_NODE_TYPE("APPEND");
347 _outPlanInfo(str, (const Plan *) node);
349 WRITE_NODE_FIELD(appendplans);
353 _outMergeAppend(StringInfo str, const MergeAppend *node)
357 WRITE_NODE_TYPE("MERGEAPPEND");
359 _outPlanInfo(str, (const Plan *) node);
361 WRITE_NODE_FIELD(mergeplans);
363 WRITE_INT_FIELD(numCols);
365 appendStringInfoString(str, " :sortColIdx");
366 for (i = 0; i < node->numCols; i++)
367 appendStringInfo(str, " %d", node->sortColIdx[i]);
369 appendStringInfoString(str, " :sortOperators");
370 for (i = 0; i < node->numCols; i++)
371 appendStringInfo(str, " %u", node->sortOperators[i]);
373 appendStringInfoString(str, " :collations");
374 for (i = 0; i < node->numCols; i++)
375 appendStringInfo(str, " %u", node->collations[i]);
377 appendStringInfoString(str, " :nullsFirst");
378 for (i = 0; i < node->numCols; i++)
379 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
383 _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
387 WRITE_NODE_TYPE("RECURSIVEUNION");
389 _outPlanInfo(str, (const Plan *) node);
391 WRITE_INT_FIELD(wtParam);
392 WRITE_INT_FIELD(numCols);
394 appendStringInfoString(str, " :dupColIdx");
395 for (i = 0; i < node->numCols; i++)
396 appendStringInfo(str, " %d", node->dupColIdx[i]);
398 appendStringInfoString(str, " :dupOperators");
399 for (i = 0; i < node->numCols; i++)
400 appendStringInfo(str, " %u", node->dupOperators[i]);
402 WRITE_LONG_FIELD(numGroups);
406 _outBitmapAnd(StringInfo str, const BitmapAnd *node)
408 WRITE_NODE_TYPE("BITMAPAND");
410 _outPlanInfo(str, (const Plan *) node);
412 WRITE_NODE_FIELD(bitmapplans);
416 _outBitmapOr(StringInfo str, const BitmapOr *node)
418 WRITE_NODE_TYPE("BITMAPOR");
420 _outPlanInfo(str, (const Plan *) node);
422 WRITE_NODE_FIELD(bitmapplans);
426 _outScan(StringInfo str, const Scan *node)
428 WRITE_NODE_TYPE("SCAN");
430 _outScanInfo(str, node);
434 _outSeqScan(StringInfo str, const SeqScan *node)
436 WRITE_NODE_TYPE("SEQSCAN");
438 _outScanInfo(str, (const Scan *) node);
442 _outIndexScan(StringInfo str, const IndexScan *node)
444 WRITE_NODE_TYPE("INDEXSCAN");
446 _outScanInfo(str, (const Scan *) node);
448 WRITE_OID_FIELD(indexid);
449 WRITE_NODE_FIELD(indexqual);
450 WRITE_NODE_FIELD(indexqualorig);
451 WRITE_NODE_FIELD(indexorderby);
452 WRITE_NODE_FIELD(indexorderbyorig);
453 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
457 _outIndexOnlyScan(StringInfo str, const IndexOnlyScan *node)
459 WRITE_NODE_TYPE("INDEXONLYSCAN");
461 _outScanInfo(str, (const Scan *) node);
463 WRITE_OID_FIELD(indexid);
464 WRITE_NODE_FIELD(indexqual);
465 WRITE_NODE_FIELD(indexorderby);
466 WRITE_NODE_FIELD(indextlist);
467 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
471 _outBitmapIndexScan(StringInfo str, const BitmapIndexScan *node)
473 WRITE_NODE_TYPE("BITMAPINDEXSCAN");
475 _outScanInfo(str, (const Scan *) node);
477 WRITE_OID_FIELD(indexid);
478 WRITE_NODE_FIELD(indexqual);
479 WRITE_NODE_FIELD(indexqualorig);
483 _outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
485 WRITE_NODE_TYPE("BITMAPHEAPSCAN");
487 _outScanInfo(str, (const Scan *) node);
489 WRITE_NODE_FIELD(bitmapqualorig);
493 _outTidScan(StringInfo str, const TidScan *node)
495 WRITE_NODE_TYPE("TIDSCAN");
497 _outScanInfo(str, (const Scan *) node);
499 WRITE_NODE_FIELD(tidquals);
503 _outSubqueryScan(StringInfo str, const SubqueryScan *node)
505 WRITE_NODE_TYPE("SUBQUERYSCAN");
507 _outScanInfo(str, (const Scan *) node);
509 WRITE_NODE_FIELD(subplan);
513 _outFunctionScan(StringInfo str, const FunctionScan *node)
515 WRITE_NODE_TYPE("FUNCTIONSCAN");
517 _outScanInfo(str, (const Scan *) node);
519 WRITE_NODE_FIELD(functions);
520 WRITE_BOOL_FIELD(funcordinality);
524 _outValuesScan(StringInfo str, const ValuesScan *node)
526 WRITE_NODE_TYPE("VALUESSCAN");
528 _outScanInfo(str, (const Scan *) node);
530 WRITE_NODE_FIELD(values_lists);
534 _outCteScan(StringInfo str, const CteScan *node)
536 WRITE_NODE_TYPE("CTESCAN");
538 _outScanInfo(str, (const Scan *) node);
540 WRITE_INT_FIELD(ctePlanId);
541 WRITE_INT_FIELD(cteParam);
545 _outWorkTableScan(StringInfo str, const WorkTableScan *node)
547 WRITE_NODE_TYPE("WORKTABLESCAN");
549 _outScanInfo(str, (const Scan *) node);
551 WRITE_INT_FIELD(wtParam);
555 _outForeignScan(StringInfo str, const ForeignScan *node)
557 WRITE_NODE_TYPE("FOREIGNSCAN");
559 _outScanInfo(str, (const Scan *) node);
561 WRITE_OID_FIELD(fdw_handler);
562 WRITE_NODE_FIELD(fdw_exprs);
563 WRITE_NODE_FIELD(fdw_ps_tlist);
564 WRITE_NODE_FIELD(fdw_private);
565 WRITE_BITMAPSET_FIELD(fdw_relids);
566 WRITE_BOOL_FIELD(fsSystemCol);
570 _outCustomScan(StringInfo str, const CustomScan *node)
572 WRITE_NODE_TYPE("CUSTOMSCAN");
574 _outScanInfo(str, (const Scan *) node);
576 WRITE_UINT_FIELD(flags);
577 WRITE_NODE_FIELD(custom_exprs);
578 WRITE_NODE_FIELD(custom_ps_tlist);
579 WRITE_NODE_FIELD(custom_private);
580 WRITE_BITMAPSET_FIELD(custom_relids);
581 appendStringInfoString(str, " :methods ");
582 _outToken(str, node->methods->CustomName);
583 if (node->methods->TextOutCustomScan)
584 node->methods->TextOutCustomScan(str, node);
588 _outJoin(StringInfo str, const Join *node)
590 WRITE_NODE_TYPE("JOIN");
592 _outJoinPlanInfo(str, (const Join *) node);
596 _outNestLoop(StringInfo str, const NestLoop *node)
598 WRITE_NODE_TYPE("NESTLOOP");
600 _outJoinPlanInfo(str, (const Join *) node);
602 WRITE_NODE_FIELD(nestParams);
606 _outMergeJoin(StringInfo str, const MergeJoin *node)
611 WRITE_NODE_TYPE("MERGEJOIN");
613 _outJoinPlanInfo(str, (const Join *) node);
615 WRITE_NODE_FIELD(mergeclauses);
617 numCols = list_length(node->mergeclauses);
619 appendStringInfoString(str, " :mergeFamilies");
620 for (i = 0; i < numCols; i++)
621 appendStringInfo(str, " %u", node->mergeFamilies[i]);
623 appendStringInfoString(str, " :mergeCollations");
624 for (i = 0; i < numCols; i++)
625 appendStringInfo(str, " %u", node->mergeCollations[i]);
627 appendStringInfoString(str, " :mergeStrategies");
628 for (i = 0; i < numCols; i++)
629 appendStringInfo(str, " %d", node->mergeStrategies[i]);
631 appendStringInfoString(str, " :mergeNullsFirst");
632 for (i = 0; i < numCols; i++)
633 appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
637 _outHashJoin(StringInfo str, const HashJoin *node)
639 WRITE_NODE_TYPE("HASHJOIN");
641 _outJoinPlanInfo(str, (const Join *) node);
643 WRITE_NODE_FIELD(hashclauses);
647 _outAgg(StringInfo str, const Agg *node)
651 WRITE_NODE_TYPE("AGG");
653 _outPlanInfo(str, (const Plan *) node);
655 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
656 WRITE_INT_FIELD(numCols);
658 appendStringInfoString(str, " :grpColIdx");
659 for (i = 0; i < node->numCols; i++)
660 appendStringInfo(str, " %d", node->grpColIdx[i]);
662 appendStringInfoString(str, " :grpOperators");
663 for (i = 0; i < node->numCols; i++)
664 appendStringInfo(str, " %u", node->grpOperators[i]);
666 WRITE_LONG_FIELD(numGroups);
670 _outWindowAgg(StringInfo str, const WindowAgg *node)
674 WRITE_NODE_TYPE("WINDOWAGG");
676 _outPlanInfo(str, (const Plan *) node);
678 WRITE_UINT_FIELD(winref);
679 WRITE_INT_FIELD(partNumCols);
681 appendStringInfoString(str, " :partColIdx");
682 for (i = 0; i < node->partNumCols; i++)
683 appendStringInfo(str, " %d", node->partColIdx[i]);
685 appendStringInfoString(str, " :partOperations");
686 for (i = 0; i < node->partNumCols; i++)
687 appendStringInfo(str, " %u", node->partOperators[i]);
689 WRITE_INT_FIELD(ordNumCols);
691 appendStringInfoString(str, " :ordColIdx");
692 for (i = 0; i < node->ordNumCols; i++)
693 appendStringInfo(str, " %d", node->ordColIdx[i]);
695 appendStringInfoString(str, " :ordOperations");
696 for (i = 0; i < node->ordNumCols; i++)
697 appendStringInfo(str, " %u", node->ordOperators[i]);
699 WRITE_INT_FIELD(frameOptions);
700 WRITE_NODE_FIELD(startOffset);
701 WRITE_NODE_FIELD(endOffset);
705 _outGroup(StringInfo str, const Group *node)
709 WRITE_NODE_TYPE("GROUP");
711 _outPlanInfo(str, (const Plan *) node);
713 WRITE_INT_FIELD(numCols);
715 appendStringInfoString(str, " :grpColIdx");
716 for (i = 0; i < node->numCols; i++)
717 appendStringInfo(str, " %d", node->grpColIdx[i]);
719 appendStringInfoString(str, " :grpOperators");
720 for (i = 0; i < node->numCols; i++)
721 appendStringInfo(str, " %u", node->grpOperators[i]);
725 _outMaterial(StringInfo str, const Material *node)
727 WRITE_NODE_TYPE("MATERIAL");
729 _outPlanInfo(str, (const Plan *) node);
733 _outSort(StringInfo str, const Sort *node)
737 WRITE_NODE_TYPE("SORT");
739 _outPlanInfo(str, (const Plan *) node);
741 WRITE_INT_FIELD(numCols);
743 appendStringInfoString(str, " :sortColIdx");
744 for (i = 0; i < node->numCols; i++)
745 appendStringInfo(str, " %d", node->sortColIdx[i]);
747 appendStringInfoString(str, " :sortOperators");
748 for (i = 0; i < node->numCols; i++)
749 appendStringInfo(str, " %u", node->sortOperators[i]);
751 appendStringInfoString(str, " :collations");
752 for (i = 0; i < node->numCols; i++)
753 appendStringInfo(str, " %u", node->collations[i]);
755 appendStringInfoString(str, " :nullsFirst");
756 for (i = 0; i < node->numCols; i++)
757 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
761 _outUnique(StringInfo str, const Unique *node)
765 WRITE_NODE_TYPE("UNIQUE");
767 _outPlanInfo(str, (const Plan *) node);
769 WRITE_INT_FIELD(numCols);
771 appendStringInfoString(str, " :uniqColIdx");
772 for (i = 0; i < node->numCols; i++)
773 appendStringInfo(str, " %d", node->uniqColIdx[i]);
775 appendStringInfoString(str, " :uniqOperators");
776 for (i = 0; i < node->numCols; i++)
777 appendStringInfo(str, " %u", node->uniqOperators[i]);
781 _outHash(StringInfo str, const Hash *node)
783 WRITE_NODE_TYPE("HASH");
785 _outPlanInfo(str, (const Plan *) node);
787 WRITE_OID_FIELD(skewTable);
788 WRITE_INT_FIELD(skewColumn);
789 WRITE_BOOL_FIELD(skewInherit);
790 WRITE_OID_FIELD(skewColType);
791 WRITE_INT_FIELD(skewColTypmod);
795 _outSetOp(StringInfo str, const SetOp *node)
799 WRITE_NODE_TYPE("SETOP");
801 _outPlanInfo(str, (const Plan *) node);
803 WRITE_ENUM_FIELD(cmd, SetOpCmd);
804 WRITE_ENUM_FIELD(strategy, SetOpStrategy);
805 WRITE_INT_FIELD(numCols);
807 appendStringInfoString(str, " :dupColIdx");
808 for (i = 0; i < node->numCols; i++)
809 appendStringInfo(str, " %d", node->dupColIdx[i]);
811 appendStringInfoString(str, " :dupOperators");
812 for (i = 0; i < node->numCols; i++)
813 appendStringInfo(str, " %u", node->dupOperators[i]);
815 WRITE_INT_FIELD(flagColIdx);
816 WRITE_INT_FIELD(firstFlag);
817 WRITE_LONG_FIELD(numGroups);
821 _outLockRows(StringInfo str, const LockRows *node)
823 WRITE_NODE_TYPE("LOCKROWS");
825 _outPlanInfo(str, (const Plan *) node);
827 WRITE_NODE_FIELD(rowMarks);
828 WRITE_INT_FIELD(epqParam);
832 _outLimit(StringInfo str, const Limit *node)
834 WRITE_NODE_TYPE("LIMIT");
836 _outPlanInfo(str, (const Plan *) node);
838 WRITE_NODE_FIELD(limitOffset);
839 WRITE_NODE_FIELD(limitCount);
843 _outNestLoopParam(StringInfo str, const NestLoopParam *node)
845 WRITE_NODE_TYPE("NESTLOOPPARAM");
847 WRITE_INT_FIELD(paramno);
848 WRITE_NODE_FIELD(paramval);
852 _outPlanRowMark(StringInfo str, const PlanRowMark *node)
854 WRITE_NODE_TYPE("PLANROWMARK");
856 WRITE_UINT_FIELD(rti);
857 WRITE_UINT_FIELD(prti);
858 WRITE_UINT_FIELD(rowmarkId);
859 WRITE_ENUM_FIELD(markType, RowMarkType);
860 WRITE_INT_FIELD(allMarkTypes);
861 WRITE_ENUM_FIELD(strength, LockClauseStrength);
862 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
863 WRITE_BOOL_FIELD(isParent);
867 _outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
869 WRITE_NODE_TYPE("PLANINVALITEM");
871 WRITE_INT_FIELD(cacheId);
872 WRITE_UINT_FIELD(hashValue);
875 /*****************************************************************************
877 * Stuff from primnodes.h.
879 *****************************************************************************/
882 _outAlias(StringInfo str, const Alias *node)
884 WRITE_NODE_TYPE("ALIAS");
886 WRITE_STRING_FIELD(aliasname);
887 WRITE_NODE_FIELD(colnames);
891 _outRangeVar(StringInfo str, const RangeVar *node)
893 WRITE_NODE_TYPE("RANGEVAR");
896 * we deliberately ignore catalogname here, since it is presently not
897 * semantically meaningful
899 WRITE_STRING_FIELD(schemaname);
900 WRITE_STRING_FIELD(relname);
901 WRITE_ENUM_FIELD(inhOpt, InhOption);
902 WRITE_CHAR_FIELD(relpersistence);
903 WRITE_NODE_FIELD(alias);
904 WRITE_LOCATION_FIELD(location);
908 _outIntoClause(StringInfo str, const IntoClause *node)
910 WRITE_NODE_TYPE("INTOCLAUSE");
912 WRITE_NODE_FIELD(rel);
913 WRITE_NODE_FIELD(colNames);
914 WRITE_NODE_FIELD(options);
915 WRITE_ENUM_FIELD(onCommit, OnCommitAction);
916 WRITE_STRING_FIELD(tableSpaceName);
917 WRITE_NODE_FIELD(viewQuery);
918 WRITE_BOOL_FIELD(skipData);
922 _outVar(StringInfo str, const Var *node)
924 WRITE_NODE_TYPE("VAR");
926 WRITE_UINT_FIELD(varno);
927 WRITE_INT_FIELD(varattno);
928 WRITE_OID_FIELD(vartype);
929 WRITE_INT_FIELD(vartypmod);
930 WRITE_OID_FIELD(varcollid);
931 WRITE_UINT_FIELD(varlevelsup);
932 WRITE_UINT_FIELD(varnoold);
933 WRITE_INT_FIELD(varoattno);
934 WRITE_LOCATION_FIELD(location);
938 _outConst(StringInfo str, const Const *node)
940 WRITE_NODE_TYPE("CONST");
942 WRITE_OID_FIELD(consttype);
943 WRITE_INT_FIELD(consttypmod);
944 WRITE_OID_FIELD(constcollid);
945 WRITE_INT_FIELD(constlen);
946 WRITE_BOOL_FIELD(constbyval);
947 WRITE_BOOL_FIELD(constisnull);
948 WRITE_LOCATION_FIELD(location);
950 appendStringInfoString(str, " :constvalue ");
951 if (node->constisnull)
952 appendStringInfoString(str, "<>");
954 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
958 _outParam(StringInfo str, const Param *node)
960 WRITE_NODE_TYPE("PARAM");
962 WRITE_ENUM_FIELD(paramkind, ParamKind);
963 WRITE_INT_FIELD(paramid);
964 WRITE_OID_FIELD(paramtype);
965 WRITE_INT_FIELD(paramtypmod);
966 WRITE_OID_FIELD(paramcollid);
967 WRITE_LOCATION_FIELD(location);
971 _outAggref(StringInfo str, const Aggref *node)
973 WRITE_NODE_TYPE("AGGREF");
975 WRITE_OID_FIELD(aggfnoid);
976 WRITE_OID_FIELD(aggtype);
977 WRITE_OID_FIELD(aggcollid);
978 WRITE_OID_FIELD(inputcollid);
979 WRITE_NODE_FIELD(aggdirectargs);
980 WRITE_NODE_FIELD(args);
981 WRITE_NODE_FIELD(aggorder);
982 WRITE_NODE_FIELD(aggdistinct);
983 WRITE_NODE_FIELD(aggfilter);
984 WRITE_BOOL_FIELD(aggstar);
985 WRITE_BOOL_FIELD(aggvariadic);
986 WRITE_CHAR_FIELD(aggkind);
987 WRITE_UINT_FIELD(agglevelsup);
988 WRITE_LOCATION_FIELD(location);
992 _outWindowFunc(StringInfo str, const WindowFunc *node)
994 WRITE_NODE_TYPE("WINDOWFUNC");
996 WRITE_OID_FIELD(winfnoid);
997 WRITE_OID_FIELD(wintype);
998 WRITE_OID_FIELD(wincollid);
999 WRITE_OID_FIELD(inputcollid);
1000 WRITE_NODE_FIELD(args);
1001 WRITE_NODE_FIELD(aggfilter);
1002 WRITE_UINT_FIELD(winref);
1003 WRITE_BOOL_FIELD(winstar);
1004 WRITE_BOOL_FIELD(winagg);
1005 WRITE_LOCATION_FIELD(location);
1009 _outArrayRef(StringInfo str, const ArrayRef *node)
1011 WRITE_NODE_TYPE("ARRAYREF");
1013 WRITE_OID_FIELD(refarraytype);
1014 WRITE_OID_FIELD(refelemtype);
1015 WRITE_INT_FIELD(reftypmod);
1016 WRITE_OID_FIELD(refcollid);
1017 WRITE_NODE_FIELD(refupperindexpr);
1018 WRITE_NODE_FIELD(reflowerindexpr);
1019 WRITE_NODE_FIELD(refexpr);
1020 WRITE_NODE_FIELD(refassgnexpr);
1024 _outFuncExpr(StringInfo str, const FuncExpr *node)
1026 WRITE_NODE_TYPE("FUNCEXPR");
1028 WRITE_OID_FIELD(funcid);
1029 WRITE_OID_FIELD(funcresulttype);
1030 WRITE_BOOL_FIELD(funcretset);
1031 WRITE_BOOL_FIELD(funcvariadic);
1032 WRITE_ENUM_FIELD(funcformat, CoercionForm);
1033 WRITE_OID_FIELD(funccollid);
1034 WRITE_OID_FIELD(inputcollid);
1035 WRITE_NODE_FIELD(args);
1036 WRITE_LOCATION_FIELD(location);
1040 _outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
1042 WRITE_NODE_TYPE("NAMEDARGEXPR");
1044 WRITE_NODE_FIELD(arg);
1045 WRITE_STRING_FIELD(name);
1046 WRITE_INT_FIELD(argnumber);
1047 WRITE_LOCATION_FIELD(location);
1051 _outOpExpr(StringInfo str, const OpExpr *node)
1053 WRITE_NODE_TYPE("OPEXPR");
1055 WRITE_OID_FIELD(opno);
1056 WRITE_OID_FIELD(opfuncid);
1057 WRITE_OID_FIELD(opresulttype);
1058 WRITE_BOOL_FIELD(opretset);
1059 WRITE_OID_FIELD(opcollid);
1060 WRITE_OID_FIELD(inputcollid);
1061 WRITE_NODE_FIELD(args);
1062 WRITE_LOCATION_FIELD(location);
1066 _outDistinctExpr(StringInfo str, const DistinctExpr *node)
1068 WRITE_NODE_TYPE("DISTINCTEXPR");
1070 WRITE_OID_FIELD(opno);
1071 WRITE_OID_FIELD(opfuncid);
1072 WRITE_OID_FIELD(opresulttype);
1073 WRITE_BOOL_FIELD(opretset);
1074 WRITE_OID_FIELD(opcollid);
1075 WRITE_OID_FIELD(inputcollid);
1076 WRITE_NODE_FIELD(args);
1077 WRITE_LOCATION_FIELD(location);
1081 _outNullIfExpr(StringInfo str, const NullIfExpr *node)
1083 WRITE_NODE_TYPE("NULLIFEXPR");
1085 WRITE_OID_FIELD(opno);
1086 WRITE_OID_FIELD(opfuncid);
1087 WRITE_OID_FIELD(opresulttype);
1088 WRITE_BOOL_FIELD(opretset);
1089 WRITE_OID_FIELD(opcollid);
1090 WRITE_OID_FIELD(inputcollid);
1091 WRITE_NODE_FIELD(args);
1092 WRITE_LOCATION_FIELD(location);
1096 _outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
1098 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
1100 WRITE_OID_FIELD(opno);
1101 WRITE_OID_FIELD(opfuncid);
1102 WRITE_BOOL_FIELD(useOr);
1103 WRITE_OID_FIELD(inputcollid);
1104 WRITE_NODE_FIELD(args);
1105 WRITE_LOCATION_FIELD(location);
1109 _outBoolExpr(StringInfo str, const BoolExpr *node)
1113 WRITE_NODE_TYPE("BOOLEXPR");
1115 /* do-it-yourself enum representation */
1116 switch (node->boolop)
1128 appendStringInfoString(str, " :boolop ");
1129 _outToken(str, opstr);
1131 WRITE_NODE_FIELD(args);
1132 WRITE_LOCATION_FIELD(location);
1136 _outSubLink(StringInfo str, const SubLink *node)
1138 WRITE_NODE_TYPE("SUBLINK");
1140 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1141 WRITE_INT_FIELD(subLinkId);
1142 WRITE_NODE_FIELD(testexpr);
1143 WRITE_NODE_FIELD(operName);
1144 WRITE_NODE_FIELD(subselect);
1145 WRITE_LOCATION_FIELD(location);
1149 _outSubPlan(StringInfo str, const SubPlan *node)
1151 WRITE_NODE_TYPE("SUBPLAN");
1153 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1154 WRITE_NODE_FIELD(testexpr);
1155 WRITE_NODE_FIELD(paramIds);
1156 WRITE_INT_FIELD(plan_id);
1157 WRITE_STRING_FIELD(plan_name);
1158 WRITE_OID_FIELD(firstColType);
1159 WRITE_INT_FIELD(firstColTypmod);
1160 WRITE_OID_FIELD(firstColCollation);
1161 WRITE_BOOL_FIELD(useHashTable);
1162 WRITE_BOOL_FIELD(unknownEqFalse);
1163 WRITE_NODE_FIELD(setParam);
1164 WRITE_NODE_FIELD(parParam);
1165 WRITE_NODE_FIELD(args);
1166 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1167 WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
1171 _outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
1173 WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
1175 WRITE_NODE_FIELD(subplans);
1179 _outFieldSelect(StringInfo str, const FieldSelect *node)
1181 WRITE_NODE_TYPE("FIELDSELECT");
1183 WRITE_NODE_FIELD(arg);
1184 WRITE_INT_FIELD(fieldnum);
1185 WRITE_OID_FIELD(resulttype);
1186 WRITE_INT_FIELD(resulttypmod);
1187 WRITE_OID_FIELD(resultcollid);
1191 _outFieldStore(StringInfo str, const FieldStore *node)
1193 WRITE_NODE_TYPE("FIELDSTORE");
1195 WRITE_NODE_FIELD(arg);
1196 WRITE_NODE_FIELD(newvals);
1197 WRITE_NODE_FIELD(fieldnums);
1198 WRITE_OID_FIELD(resulttype);
1202 _outRelabelType(StringInfo str, const RelabelType *node)
1204 WRITE_NODE_TYPE("RELABELTYPE");
1206 WRITE_NODE_FIELD(arg);
1207 WRITE_OID_FIELD(resulttype);
1208 WRITE_INT_FIELD(resulttypmod);
1209 WRITE_OID_FIELD(resultcollid);
1210 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
1211 WRITE_LOCATION_FIELD(location);
1215 _outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
1217 WRITE_NODE_TYPE("COERCEVIAIO");
1219 WRITE_NODE_FIELD(arg);
1220 WRITE_OID_FIELD(resulttype);
1221 WRITE_OID_FIELD(resultcollid);
1222 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1223 WRITE_LOCATION_FIELD(location);
1227 _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
1229 WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
1231 WRITE_NODE_FIELD(arg);
1232 WRITE_OID_FIELD(elemfuncid);
1233 WRITE_OID_FIELD(resulttype);
1234 WRITE_INT_FIELD(resulttypmod);
1235 WRITE_OID_FIELD(resultcollid);
1236 WRITE_BOOL_FIELD(isExplicit);
1237 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1238 WRITE_LOCATION_FIELD(location);
1242 _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
1244 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
1246 WRITE_NODE_FIELD(arg);
1247 WRITE_OID_FIELD(resulttype);
1248 WRITE_ENUM_FIELD(convertformat, CoercionForm);
1249 WRITE_LOCATION_FIELD(location);
1253 _outCollateExpr(StringInfo str, const CollateExpr *node)
1255 WRITE_NODE_TYPE("COLLATE");
1257 WRITE_NODE_FIELD(arg);
1258 WRITE_OID_FIELD(collOid);
1259 WRITE_LOCATION_FIELD(location);
1263 _outCaseExpr(StringInfo str, const CaseExpr *node)
1265 WRITE_NODE_TYPE("CASE");
1267 WRITE_OID_FIELD(casetype);
1268 WRITE_OID_FIELD(casecollid);
1269 WRITE_NODE_FIELD(arg);
1270 WRITE_NODE_FIELD(args);
1271 WRITE_NODE_FIELD(defresult);
1272 WRITE_LOCATION_FIELD(location);
1276 _outCaseWhen(StringInfo str, const CaseWhen *node)
1278 WRITE_NODE_TYPE("WHEN");
1280 WRITE_NODE_FIELD(expr);
1281 WRITE_NODE_FIELD(result);
1282 WRITE_LOCATION_FIELD(location);
1286 _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
1288 WRITE_NODE_TYPE("CASETESTEXPR");
1290 WRITE_OID_FIELD(typeId);
1291 WRITE_INT_FIELD(typeMod);
1292 WRITE_OID_FIELD(collation);
1296 _outArrayExpr(StringInfo str, const ArrayExpr *node)
1298 WRITE_NODE_TYPE("ARRAY");
1300 WRITE_OID_FIELD(array_typeid);
1301 WRITE_OID_FIELD(array_collid);
1302 WRITE_OID_FIELD(element_typeid);
1303 WRITE_NODE_FIELD(elements);
1304 WRITE_BOOL_FIELD(multidims);
1305 WRITE_LOCATION_FIELD(location);
1309 _outRowExpr(StringInfo str, const RowExpr *node)
1311 WRITE_NODE_TYPE("ROW");
1313 WRITE_NODE_FIELD(args);
1314 WRITE_OID_FIELD(row_typeid);
1315 WRITE_ENUM_FIELD(row_format, CoercionForm);
1316 WRITE_NODE_FIELD(colnames);
1317 WRITE_LOCATION_FIELD(location);
1321 _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
1323 WRITE_NODE_TYPE("ROWCOMPARE");
1325 WRITE_ENUM_FIELD(rctype, RowCompareType);
1326 WRITE_NODE_FIELD(opnos);
1327 WRITE_NODE_FIELD(opfamilies);
1328 WRITE_NODE_FIELD(inputcollids);
1329 WRITE_NODE_FIELD(largs);
1330 WRITE_NODE_FIELD(rargs);
1334 _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
1336 WRITE_NODE_TYPE("COALESCE");
1338 WRITE_OID_FIELD(coalescetype);
1339 WRITE_OID_FIELD(coalescecollid);
1340 WRITE_NODE_FIELD(args);
1341 WRITE_LOCATION_FIELD(location);
1345 _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
1347 WRITE_NODE_TYPE("MINMAX");
1349 WRITE_OID_FIELD(minmaxtype);
1350 WRITE_OID_FIELD(minmaxcollid);
1351 WRITE_OID_FIELD(inputcollid);
1352 WRITE_ENUM_FIELD(op, MinMaxOp);
1353 WRITE_NODE_FIELD(args);
1354 WRITE_LOCATION_FIELD(location);
1358 _outXmlExpr(StringInfo str, const XmlExpr *node)
1360 WRITE_NODE_TYPE("XMLEXPR");
1362 WRITE_ENUM_FIELD(op, XmlExprOp);
1363 WRITE_STRING_FIELD(name);
1364 WRITE_NODE_FIELD(named_args);
1365 WRITE_NODE_FIELD(arg_names);
1366 WRITE_NODE_FIELD(args);
1367 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
1368 WRITE_OID_FIELD(type);
1369 WRITE_INT_FIELD(typmod);
1370 WRITE_LOCATION_FIELD(location);
1374 _outNullTest(StringInfo str, const NullTest *node)
1376 WRITE_NODE_TYPE("NULLTEST");
1378 WRITE_NODE_FIELD(arg);
1379 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
1380 WRITE_BOOL_FIELD(argisrow);
1381 WRITE_LOCATION_FIELD(location);
1385 _outBooleanTest(StringInfo str, const BooleanTest *node)
1387 WRITE_NODE_TYPE("BOOLEANTEST");
1389 WRITE_NODE_FIELD(arg);
1390 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
1391 WRITE_LOCATION_FIELD(location);
1395 _outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
1397 WRITE_NODE_TYPE("COERCETODOMAIN");
1399 WRITE_NODE_FIELD(arg);
1400 WRITE_OID_FIELD(resulttype);
1401 WRITE_INT_FIELD(resulttypmod);
1402 WRITE_OID_FIELD(resultcollid);
1403 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
1404 WRITE_LOCATION_FIELD(location);
1408 _outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
1410 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
1412 WRITE_OID_FIELD(typeId);
1413 WRITE_INT_FIELD(typeMod);
1414 WRITE_OID_FIELD(collation);
1415 WRITE_LOCATION_FIELD(location);
1419 _outSetToDefault(StringInfo str, const SetToDefault *node)
1421 WRITE_NODE_TYPE("SETTODEFAULT");
1423 WRITE_OID_FIELD(typeId);
1424 WRITE_INT_FIELD(typeMod);
1425 WRITE_OID_FIELD(collation);
1426 WRITE_LOCATION_FIELD(location);
1430 _outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
1432 WRITE_NODE_TYPE("CURRENTOFEXPR");
1434 WRITE_UINT_FIELD(cvarno);
1435 WRITE_STRING_FIELD(cursor_name);
1436 WRITE_INT_FIELD(cursor_param);
1440 _outTargetEntry(StringInfo str, const TargetEntry *node)
1442 WRITE_NODE_TYPE("TARGETENTRY");
1444 WRITE_NODE_FIELD(expr);
1445 WRITE_INT_FIELD(resno);
1446 WRITE_STRING_FIELD(resname);
1447 WRITE_UINT_FIELD(ressortgroupref);
1448 WRITE_OID_FIELD(resorigtbl);
1449 WRITE_INT_FIELD(resorigcol);
1450 WRITE_BOOL_FIELD(resjunk);
1454 _outRangeTblRef(StringInfo str, const RangeTblRef *node)
1456 WRITE_NODE_TYPE("RANGETBLREF");
1458 WRITE_INT_FIELD(rtindex);
1462 _outJoinExpr(StringInfo str, const JoinExpr *node)
1464 WRITE_NODE_TYPE("JOINEXPR");
1466 WRITE_ENUM_FIELD(jointype, JoinType);
1467 WRITE_BOOL_FIELD(isNatural);
1468 WRITE_NODE_FIELD(larg);
1469 WRITE_NODE_FIELD(rarg);
1470 WRITE_NODE_FIELD(usingClause);
1471 WRITE_NODE_FIELD(quals);
1472 WRITE_NODE_FIELD(alias);
1473 WRITE_INT_FIELD(rtindex);
1477 _outFromExpr(StringInfo str, const FromExpr *node)
1479 WRITE_NODE_TYPE("FROMEXPR");
1481 WRITE_NODE_FIELD(fromlist);
1482 WRITE_NODE_FIELD(quals);
1485 /*****************************************************************************
1487 * Stuff from relation.h.
1489 *****************************************************************************/
1492 * print the basic stuff of all nodes that inherit from Path
1494 * Note we do NOT print the parent, else we'd be in infinite recursion.
1495 * We can print the parent's relids for identification purposes, though.
1496 * We also do not print the whole of param_info, since it's printed by
1497 * _outRelOptInfo; it's sufficient and less cluttering to print just the
1498 * required outer relids.
1501 _outPathInfo(StringInfo str, const Path *node)
1503 WRITE_ENUM_FIELD(pathtype, NodeTag);
1504 appendStringInfoString(str, " :parent_relids ");
1506 _outBitmapset(str, node->parent->relids);
1508 _outBitmapset(str, NULL);
1509 appendStringInfoString(str, " :required_outer ");
1510 if (node->param_info)
1511 _outBitmapset(str, node->param_info->ppi_req_outer);
1513 _outBitmapset(str, NULL);
1514 WRITE_FLOAT_FIELD(rows, "%.0f");
1515 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1516 WRITE_FLOAT_FIELD(total_cost, "%.2f");
1517 WRITE_NODE_FIELD(pathkeys);
1521 * print the basic stuff of all nodes that inherit from JoinPath
1524 _outJoinPathInfo(StringInfo str, const JoinPath *node)
1526 _outPathInfo(str, (const Path *) node);
1528 WRITE_ENUM_FIELD(jointype, JoinType);
1529 WRITE_NODE_FIELD(outerjoinpath);
1530 WRITE_NODE_FIELD(innerjoinpath);
1531 WRITE_NODE_FIELD(joinrestrictinfo);
1535 _outPath(StringInfo str, const Path *node)
1537 WRITE_NODE_TYPE("PATH");
1539 _outPathInfo(str, (const Path *) node);
1543 _outIndexPath(StringInfo str, const IndexPath *node)
1545 WRITE_NODE_TYPE("INDEXPATH");
1547 _outPathInfo(str, (const Path *) node);
1549 WRITE_NODE_FIELD(indexinfo);
1550 WRITE_NODE_FIELD(indexclauses);
1551 WRITE_NODE_FIELD(indexquals);
1552 WRITE_NODE_FIELD(indexqualcols);
1553 WRITE_NODE_FIELD(indexorderbys);
1554 WRITE_NODE_FIELD(indexorderbycols);
1555 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1556 WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1557 WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1561 _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
1563 WRITE_NODE_TYPE("BITMAPHEAPPATH");
1565 _outPathInfo(str, (const Path *) node);
1567 WRITE_NODE_FIELD(bitmapqual);
1571 _outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
1573 WRITE_NODE_TYPE("BITMAPANDPATH");
1575 _outPathInfo(str, (const Path *) node);
1577 WRITE_NODE_FIELD(bitmapquals);
1578 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1582 _outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
1584 WRITE_NODE_TYPE("BITMAPORPATH");
1586 _outPathInfo(str, (const Path *) node);
1588 WRITE_NODE_FIELD(bitmapquals);
1589 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1593 _outTidPath(StringInfo str, const TidPath *node)
1595 WRITE_NODE_TYPE("TIDPATH");
1597 _outPathInfo(str, (const Path *) node);
1599 WRITE_NODE_FIELD(tidquals);
1603 _outForeignPath(StringInfo str, const ForeignPath *node)
1605 WRITE_NODE_TYPE("FOREIGNPATH");
1607 _outPathInfo(str, (const Path *) node);
1609 WRITE_NODE_FIELD(fdw_private);
1613 _outCustomPath(StringInfo str, const CustomPath *node)
1615 WRITE_NODE_TYPE("CUSTOMPATH");
1617 _outPathInfo(str, (const Path *) node);
1619 WRITE_UINT_FIELD(flags);
1620 WRITE_NODE_FIELD(custom_private);
1621 appendStringInfoString(str, " :methods ");
1622 _outToken(str, node->methods->CustomName);
1623 if (node->methods->TextOutCustomPath)
1624 node->methods->TextOutCustomPath(str, node);
1628 _outAppendPath(StringInfo str, const AppendPath *node)
1630 WRITE_NODE_TYPE("APPENDPATH");
1632 _outPathInfo(str, (const Path *) node);
1634 WRITE_NODE_FIELD(subpaths);
1638 _outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
1640 WRITE_NODE_TYPE("MERGEAPPENDPATH");
1642 _outPathInfo(str, (const Path *) node);
1644 WRITE_NODE_FIELD(subpaths);
1645 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1649 _outResultPath(StringInfo str, const ResultPath *node)
1651 WRITE_NODE_TYPE("RESULTPATH");
1653 _outPathInfo(str, (const Path *) node);
1655 WRITE_NODE_FIELD(quals);
1659 _outMaterialPath(StringInfo str, const MaterialPath *node)
1661 WRITE_NODE_TYPE("MATERIALPATH");
1663 _outPathInfo(str, (const Path *) node);
1665 WRITE_NODE_FIELD(subpath);
1669 _outUniquePath(StringInfo str, const UniquePath *node)
1671 WRITE_NODE_TYPE("UNIQUEPATH");
1673 _outPathInfo(str, (const Path *) node);
1675 WRITE_NODE_FIELD(subpath);
1676 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1677 WRITE_NODE_FIELD(in_operators);
1678 WRITE_NODE_FIELD(uniq_exprs);
1682 _outNestPath(StringInfo str, const NestPath *node)
1684 WRITE_NODE_TYPE("NESTPATH");
1686 _outJoinPathInfo(str, (const JoinPath *) node);
1690 _outMergePath(StringInfo str, const MergePath *node)
1692 WRITE_NODE_TYPE("MERGEPATH");
1694 _outJoinPathInfo(str, (const JoinPath *) node);
1696 WRITE_NODE_FIELD(path_mergeclauses);
1697 WRITE_NODE_FIELD(outersortkeys);
1698 WRITE_NODE_FIELD(innersortkeys);
1699 WRITE_BOOL_FIELD(materialize_inner);
1703 _outHashPath(StringInfo str, const HashPath *node)
1705 WRITE_NODE_TYPE("HASHPATH");
1707 _outJoinPathInfo(str, (const JoinPath *) node);
1709 WRITE_NODE_FIELD(path_hashclauses);
1710 WRITE_INT_FIELD(num_batches);
1714 _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
1716 WRITE_NODE_TYPE("PLANNERGLOBAL");
1718 /* NB: this isn't a complete set of fields */
1719 WRITE_NODE_FIELD(subplans);
1720 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
1721 WRITE_NODE_FIELD(finalrtable);
1722 WRITE_NODE_FIELD(finalrowmarks);
1723 WRITE_NODE_FIELD(resultRelations);
1724 WRITE_NODE_FIELD(relationOids);
1725 WRITE_NODE_FIELD(invalItems);
1726 WRITE_INT_FIELD(nParamExec);
1727 WRITE_UINT_FIELD(lastPHId);
1728 WRITE_UINT_FIELD(lastRowMarkId);
1729 WRITE_BOOL_FIELD(transientPlan);
1730 WRITE_BOOL_FIELD(hasRowSecurity);
1734 _outPlannerInfo(StringInfo str, const PlannerInfo *node)
1736 WRITE_NODE_TYPE("PLANNERINFO");
1738 /* NB: this isn't a complete set of fields */
1739 WRITE_NODE_FIELD(parse);
1740 WRITE_NODE_FIELD(glob);
1741 WRITE_UINT_FIELD(query_level);
1742 WRITE_NODE_FIELD(plan_params);
1743 WRITE_BITMAPSET_FIELD(all_baserels);
1744 WRITE_BITMAPSET_FIELD(nullable_baserels);
1745 WRITE_NODE_FIELD(join_rel_list);
1746 WRITE_INT_FIELD(join_cur_level);
1747 WRITE_NODE_FIELD(init_plans);
1748 WRITE_NODE_FIELD(cte_plan_ids);
1749 WRITE_NODE_FIELD(multiexpr_params);
1750 WRITE_NODE_FIELD(eq_classes);
1751 WRITE_NODE_FIELD(canon_pathkeys);
1752 WRITE_NODE_FIELD(left_join_clauses);
1753 WRITE_NODE_FIELD(right_join_clauses);
1754 WRITE_NODE_FIELD(full_join_clauses);
1755 WRITE_NODE_FIELD(join_info_list);
1756 WRITE_NODE_FIELD(lateral_info_list);
1757 WRITE_NODE_FIELD(append_rel_list);
1758 WRITE_NODE_FIELD(rowMarks);
1759 WRITE_NODE_FIELD(placeholder_list);
1760 WRITE_NODE_FIELD(query_pathkeys);
1761 WRITE_NODE_FIELD(group_pathkeys);
1762 WRITE_NODE_FIELD(window_pathkeys);
1763 WRITE_NODE_FIELD(distinct_pathkeys);
1764 WRITE_NODE_FIELD(sort_pathkeys);
1765 WRITE_NODE_FIELD(minmax_aggs);
1766 WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
1767 WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
1768 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1769 WRITE_BOOL_FIELD(hasInheritedTarget);
1770 WRITE_BOOL_FIELD(hasJoinRTEs);
1771 WRITE_BOOL_FIELD(hasLateralRTEs);
1772 WRITE_BOOL_FIELD(hasDeletedRTEs);
1773 WRITE_BOOL_FIELD(hasHavingQual);
1774 WRITE_BOOL_FIELD(hasPseudoConstantQuals);
1775 WRITE_BOOL_FIELD(hasRecursion);
1776 WRITE_INT_FIELD(wt_param_id);
1777 WRITE_BITMAPSET_FIELD(curOuterRels);
1778 WRITE_NODE_FIELD(curOuterParams);
1782 _outRelOptInfo(StringInfo str, const RelOptInfo *node)
1784 WRITE_NODE_TYPE("RELOPTINFO");
1786 /* NB: this isn't a complete set of fields */
1787 WRITE_ENUM_FIELD(reloptkind, RelOptKind);
1788 WRITE_BITMAPSET_FIELD(relids);
1789 WRITE_FLOAT_FIELD(rows, "%.0f");
1790 WRITE_INT_FIELD(width);
1791 WRITE_BOOL_FIELD(consider_startup);
1792 WRITE_NODE_FIELD(reltargetlist);
1793 WRITE_NODE_FIELD(pathlist);
1794 WRITE_NODE_FIELD(ppilist);
1795 WRITE_NODE_FIELD(cheapest_startup_path);
1796 WRITE_NODE_FIELD(cheapest_total_path);
1797 WRITE_NODE_FIELD(cheapest_unique_path);
1798 WRITE_NODE_FIELD(cheapest_parameterized_paths);
1799 WRITE_UINT_FIELD(relid);
1800 WRITE_OID_FIELD(reltablespace);
1801 WRITE_ENUM_FIELD(rtekind, RTEKind);
1802 WRITE_INT_FIELD(min_attr);
1803 WRITE_INT_FIELD(max_attr);
1804 WRITE_NODE_FIELD(lateral_vars);
1805 WRITE_BITMAPSET_FIELD(lateral_relids);
1806 WRITE_BITMAPSET_FIELD(lateral_referencers);
1807 WRITE_NODE_FIELD(indexlist);
1808 WRITE_UINT_FIELD(pages);
1809 WRITE_FLOAT_FIELD(tuples, "%.0f");
1810 WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
1811 WRITE_NODE_FIELD(subplan);
1812 WRITE_NODE_FIELD(subroot);
1813 WRITE_NODE_FIELD(subplan_params);
1814 /* we don't try to print fdwroutine or fdw_private */
1815 WRITE_NODE_FIELD(baserestrictinfo);
1816 WRITE_NODE_FIELD(joininfo);
1817 WRITE_BOOL_FIELD(has_eclass_joins);
1821 _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
1823 WRITE_NODE_TYPE("INDEXOPTINFO");
1825 /* NB: this isn't a complete set of fields */
1826 WRITE_OID_FIELD(indexoid);
1827 /* Do NOT print rel field, else infinite recursion */
1828 WRITE_UINT_FIELD(pages);
1829 WRITE_FLOAT_FIELD(tuples, "%.0f");
1830 WRITE_INT_FIELD(tree_height);
1831 WRITE_INT_FIELD(ncolumns);
1832 /* array fields aren't really worth the trouble to print */
1833 WRITE_OID_FIELD(relam);
1834 /* indexprs is redundant since we print indextlist */
1835 WRITE_NODE_FIELD(indpred);
1836 WRITE_NODE_FIELD(indextlist);
1837 WRITE_BOOL_FIELD(predOK);
1838 WRITE_BOOL_FIELD(unique);
1839 WRITE_BOOL_FIELD(immediate);
1840 WRITE_BOOL_FIELD(hypothetical);
1841 /* we don't bother with fields copied from the pg_am entry */
1845 _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
1848 * To simplify reading, we just chase up to the topmost merged EC and
1849 * print that, without bothering to show the merge-ees separately.
1851 while (node->ec_merged)
1852 node = node->ec_merged;
1854 WRITE_NODE_TYPE("EQUIVALENCECLASS");
1856 WRITE_NODE_FIELD(ec_opfamilies);
1857 WRITE_OID_FIELD(ec_collation);
1858 WRITE_NODE_FIELD(ec_members);
1859 WRITE_NODE_FIELD(ec_sources);
1860 WRITE_NODE_FIELD(ec_derives);
1861 WRITE_BITMAPSET_FIELD(ec_relids);
1862 WRITE_BOOL_FIELD(ec_has_const);
1863 WRITE_BOOL_FIELD(ec_has_volatile);
1864 WRITE_BOOL_FIELD(ec_below_outer_join);
1865 WRITE_BOOL_FIELD(ec_broken);
1866 WRITE_UINT_FIELD(ec_sortref);
1870 _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
1872 WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
1874 WRITE_NODE_FIELD(em_expr);
1875 WRITE_BITMAPSET_FIELD(em_relids);
1876 WRITE_BITMAPSET_FIELD(em_nullable_relids);
1877 WRITE_BOOL_FIELD(em_is_const);
1878 WRITE_BOOL_FIELD(em_is_child);
1879 WRITE_OID_FIELD(em_datatype);
1883 _outPathKey(StringInfo str, const PathKey *node)
1885 WRITE_NODE_TYPE("PATHKEY");
1887 WRITE_NODE_FIELD(pk_eclass);
1888 WRITE_OID_FIELD(pk_opfamily);
1889 WRITE_INT_FIELD(pk_strategy);
1890 WRITE_BOOL_FIELD(pk_nulls_first);
1894 _outParamPathInfo(StringInfo str, const ParamPathInfo *node)
1896 WRITE_NODE_TYPE("PARAMPATHINFO");
1898 WRITE_BITMAPSET_FIELD(ppi_req_outer);
1899 WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
1900 WRITE_NODE_FIELD(ppi_clauses);
1904 _outRestrictInfo(StringInfo str, const RestrictInfo *node)
1906 WRITE_NODE_TYPE("RESTRICTINFO");
1908 /* NB: this isn't a complete set of fields */
1909 WRITE_NODE_FIELD(clause);
1910 WRITE_BOOL_FIELD(is_pushed_down);
1911 WRITE_BOOL_FIELD(outerjoin_delayed);
1912 WRITE_BOOL_FIELD(can_join);
1913 WRITE_BOOL_FIELD(pseudoconstant);
1914 WRITE_BITMAPSET_FIELD(clause_relids);
1915 WRITE_BITMAPSET_FIELD(required_relids);
1916 WRITE_BITMAPSET_FIELD(outer_relids);
1917 WRITE_BITMAPSET_FIELD(nullable_relids);
1918 WRITE_BITMAPSET_FIELD(left_relids);
1919 WRITE_BITMAPSET_FIELD(right_relids);
1920 WRITE_NODE_FIELD(orclause);
1921 /* don't write parent_ec, leads to infinite recursion in plan tree dump */
1922 WRITE_FLOAT_FIELD(norm_selec, "%.4f");
1923 WRITE_FLOAT_FIELD(outer_selec, "%.4f");
1924 WRITE_NODE_FIELD(mergeopfamilies);
1925 /* don't write left_ec, leads to infinite recursion in plan tree dump */
1926 /* don't write right_ec, leads to infinite recursion in plan tree dump */
1927 WRITE_NODE_FIELD(left_em);
1928 WRITE_NODE_FIELD(right_em);
1929 WRITE_BOOL_FIELD(outer_is_left);
1930 WRITE_OID_FIELD(hashjoinoperator);
1934 _outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node)
1936 WRITE_NODE_TYPE("PLACEHOLDERVAR");
1938 WRITE_NODE_FIELD(phexpr);
1939 WRITE_BITMAPSET_FIELD(phrels);
1940 WRITE_UINT_FIELD(phid);
1941 WRITE_UINT_FIELD(phlevelsup);
1945 _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
1947 WRITE_NODE_TYPE("SPECIALJOININFO");
1949 WRITE_BITMAPSET_FIELD(min_lefthand);
1950 WRITE_BITMAPSET_FIELD(min_righthand);
1951 WRITE_BITMAPSET_FIELD(syn_lefthand);
1952 WRITE_BITMAPSET_FIELD(syn_righthand);
1953 WRITE_ENUM_FIELD(jointype, JoinType);
1954 WRITE_BOOL_FIELD(lhs_strict);
1955 WRITE_BOOL_FIELD(delay_upper_joins);
1956 WRITE_BOOL_FIELD(semi_can_btree);
1957 WRITE_BOOL_FIELD(semi_can_hash);
1958 WRITE_NODE_FIELD(semi_operators);
1959 WRITE_NODE_FIELD(semi_rhs_exprs);
1963 _outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node)
1965 WRITE_NODE_TYPE("LATERALJOININFO");
1967 WRITE_BITMAPSET_FIELD(lateral_lhs);
1968 WRITE_BITMAPSET_FIELD(lateral_rhs);
1972 _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
1974 WRITE_NODE_TYPE("APPENDRELINFO");
1976 WRITE_UINT_FIELD(parent_relid);
1977 WRITE_UINT_FIELD(child_relid);
1978 WRITE_OID_FIELD(parent_reltype);
1979 WRITE_OID_FIELD(child_reltype);
1980 WRITE_NODE_FIELD(translated_vars);
1981 WRITE_OID_FIELD(parent_reloid);
1985 _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
1987 WRITE_NODE_TYPE("PLACEHOLDERINFO");
1989 WRITE_UINT_FIELD(phid);
1990 WRITE_NODE_FIELD(ph_var);
1991 WRITE_BITMAPSET_FIELD(ph_eval_at);
1992 WRITE_BITMAPSET_FIELD(ph_lateral);
1993 WRITE_BITMAPSET_FIELD(ph_needed);
1994 WRITE_INT_FIELD(ph_width);
1998 _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
2000 WRITE_NODE_TYPE("MINMAXAGGINFO");
2002 WRITE_OID_FIELD(aggfnoid);
2003 WRITE_OID_FIELD(aggsortop);
2004 WRITE_NODE_FIELD(target);
2005 /* We intentionally omit subroot --- too large, not interesting enough */
2006 WRITE_NODE_FIELD(path);
2007 WRITE_FLOAT_FIELD(pathcost, "%.2f");
2008 WRITE_NODE_FIELD(param);
2012 _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
2014 WRITE_NODE_TYPE("PLANNERPARAMITEM");
2016 WRITE_NODE_FIELD(item);
2017 WRITE_INT_FIELD(paramId);
2020 /*****************************************************************************
2022 * Stuff from parsenodes.h.
2024 *****************************************************************************/
2027 * print the basic stuff of all nodes that inherit from CreateStmt
2030 _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
2032 WRITE_NODE_FIELD(relation);
2033 WRITE_NODE_FIELD(tableElts);
2034 WRITE_NODE_FIELD(inhRelations);
2035 WRITE_NODE_FIELD(ofTypename);
2036 WRITE_NODE_FIELD(constraints);
2037 WRITE_NODE_FIELD(options);
2038 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
2039 WRITE_STRING_FIELD(tablespacename);
2040 WRITE_BOOL_FIELD(if_not_exists);
2044 _outCreateStmt(StringInfo str, const CreateStmt *node)
2046 WRITE_NODE_TYPE("CREATESTMT");
2048 _outCreateStmtInfo(str, (const CreateStmt *) node);
2052 _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
2054 WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
2056 _outCreateStmtInfo(str, (const CreateStmt *) node);
2058 WRITE_STRING_FIELD(servername);
2059 WRITE_NODE_FIELD(options);
2063 _outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
2065 WRITE_NODE_TYPE("IMPORTFOREIGNSCHEMASTMT");
2067 WRITE_STRING_FIELD(server_name);
2068 WRITE_STRING_FIELD(remote_schema);
2069 WRITE_STRING_FIELD(local_schema);
2070 WRITE_ENUM_FIELD(list_type, ImportForeignSchemaType);
2071 WRITE_NODE_FIELD(table_list);
2072 WRITE_NODE_FIELD(options);
2076 _outIndexStmt(StringInfo str, const IndexStmt *node)
2078 WRITE_NODE_TYPE("INDEXSTMT");
2080 WRITE_STRING_FIELD(idxname);
2081 WRITE_NODE_FIELD(relation);
2082 WRITE_STRING_FIELD(accessMethod);
2083 WRITE_STRING_FIELD(tableSpace);
2084 WRITE_NODE_FIELD(indexParams);
2085 WRITE_NODE_FIELD(options);
2086 WRITE_NODE_FIELD(whereClause);
2087 WRITE_NODE_FIELD(excludeOpNames);
2088 WRITE_STRING_FIELD(idxcomment);
2089 WRITE_OID_FIELD(indexOid);
2090 WRITE_OID_FIELD(oldNode);
2091 WRITE_BOOL_FIELD(unique);
2092 WRITE_BOOL_FIELD(primary);
2093 WRITE_BOOL_FIELD(isconstraint);
2094 WRITE_BOOL_FIELD(deferrable);
2095 WRITE_BOOL_FIELD(initdeferred);
2096 WRITE_BOOL_FIELD(transformed);
2097 WRITE_BOOL_FIELD(concurrent);
2098 WRITE_BOOL_FIELD(if_not_exists);
2102 _outNotifyStmt(StringInfo str, const NotifyStmt *node)
2104 WRITE_NODE_TYPE("NOTIFY");
2106 WRITE_STRING_FIELD(conditionname);
2107 WRITE_STRING_FIELD(payload);
2111 _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
2113 WRITE_NODE_TYPE("DECLARECURSOR");
2115 WRITE_STRING_FIELD(portalname);
2116 WRITE_INT_FIELD(options);
2117 WRITE_NODE_FIELD(query);
2121 _outSelectStmt(StringInfo str, const SelectStmt *node)
2123 WRITE_NODE_TYPE("SELECT");
2125 WRITE_NODE_FIELD(distinctClause);
2126 WRITE_NODE_FIELD(intoClause);
2127 WRITE_NODE_FIELD(targetList);
2128 WRITE_NODE_FIELD(fromClause);
2129 WRITE_NODE_FIELD(whereClause);
2130 WRITE_NODE_FIELD(groupClause);
2131 WRITE_NODE_FIELD(havingClause);
2132 WRITE_NODE_FIELD(windowClause);
2133 WRITE_NODE_FIELD(valuesLists);
2134 WRITE_NODE_FIELD(sortClause);
2135 WRITE_NODE_FIELD(limitOffset);
2136 WRITE_NODE_FIELD(limitCount);
2137 WRITE_NODE_FIELD(lockingClause);
2138 WRITE_NODE_FIELD(withClause);
2139 WRITE_ENUM_FIELD(op, SetOperation);
2140 WRITE_BOOL_FIELD(all);
2141 WRITE_NODE_FIELD(larg);
2142 WRITE_NODE_FIELD(rarg);
2146 _outFuncCall(StringInfo str, const FuncCall *node)
2148 WRITE_NODE_TYPE("FUNCCALL");
2150 WRITE_NODE_FIELD(funcname);
2151 WRITE_NODE_FIELD(args);
2152 WRITE_NODE_FIELD(agg_order);
2153 WRITE_NODE_FIELD(agg_filter);
2154 WRITE_BOOL_FIELD(agg_within_group);
2155 WRITE_BOOL_FIELD(agg_star);
2156 WRITE_BOOL_FIELD(agg_distinct);
2157 WRITE_BOOL_FIELD(func_variadic);
2158 WRITE_NODE_FIELD(over);
2159 WRITE_LOCATION_FIELD(location);
2163 _outDefElem(StringInfo str, const DefElem *node)
2165 WRITE_NODE_TYPE("DEFELEM");
2167 WRITE_STRING_FIELD(defnamespace);
2168 WRITE_STRING_FIELD(defname);
2169 WRITE_NODE_FIELD(arg);
2170 WRITE_ENUM_FIELD(defaction, DefElemAction);
2174 _outTableLikeClause(StringInfo str, const TableLikeClause *node)
2176 WRITE_NODE_TYPE("TABLELIKECLAUSE");
2178 WRITE_NODE_FIELD(relation);
2179 WRITE_UINT_FIELD(options);
2183 _outLockingClause(StringInfo str, const LockingClause *node)
2185 WRITE_NODE_TYPE("LOCKINGCLAUSE");
2187 WRITE_NODE_FIELD(lockedRels);
2188 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2189 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2193 _outXmlSerialize(StringInfo str, const XmlSerialize *node)
2195 WRITE_NODE_TYPE("XMLSERIALIZE");
2197 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
2198 WRITE_NODE_FIELD(expr);
2199 WRITE_NODE_FIELD(typeName);
2200 WRITE_LOCATION_FIELD(location);
2204 _outColumnDef(StringInfo str, const ColumnDef *node)
2206 WRITE_NODE_TYPE("COLUMNDEF");
2208 WRITE_STRING_FIELD(colname);
2209 WRITE_NODE_FIELD(typeName);
2210 WRITE_INT_FIELD(inhcount);
2211 WRITE_BOOL_FIELD(is_local);
2212 WRITE_BOOL_FIELD(is_not_null);
2213 WRITE_BOOL_FIELD(is_from_type);
2214 WRITE_CHAR_FIELD(storage);
2215 WRITE_NODE_FIELD(raw_default);
2216 WRITE_NODE_FIELD(cooked_default);
2217 WRITE_NODE_FIELD(collClause);
2218 WRITE_OID_FIELD(collOid);
2219 WRITE_NODE_FIELD(constraints);
2220 WRITE_NODE_FIELD(fdwoptions);
2221 WRITE_LOCATION_FIELD(location);
2225 _outTypeName(StringInfo str, const TypeName *node)
2227 WRITE_NODE_TYPE("TYPENAME");
2229 WRITE_NODE_FIELD(names);
2230 WRITE_OID_FIELD(typeOid);
2231 WRITE_BOOL_FIELD(setof);
2232 WRITE_BOOL_FIELD(pct_type);
2233 WRITE_NODE_FIELD(typmods);
2234 WRITE_INT_FIELD(typemod);
2235 WRITE_NODE_FIELD(arrayBounds);
2236 WRITE_LOCATION_FIELD(location);
2240 _outTypeCast(StringInfo str, const TypeCast *node)
2242 WRITE_NODE_TYPE("TYPECAST");
2244 WRITE_NODE_FIELD(arg);
2245 WRITE_NODE_FIELD(typeName);
2246 WRITE_LOCATION_FIELD(location);
2250 _outCollateClause(StringInfo str, const CollateClause *node)
2252 WRITE_NODE_TYPE("COLLATECLAUSE");
2254 WRITE_NODE_FIELD(arg);
2255 WRITE_NODE_FIELD(collname);
2256 WRITE_LOCATION_FIELD(location);
2260 _outIndexElem(StringInfo str, const IndexElem *node)
2262 WRITE_NODE_TYPE("INDEXELEM");
2264 WRITE_STRING_FIELD(name);
2265 WRITE_NODE_FIELD(expr);
2266 WRITE_STRING_FIELD(indexcolname);
2267 WRITE_NODE_FIELD(collation);
2268 WRITE_NODE_FIELD(opclass);
2269 WRITE_ENUM_FIELD(ordering, SortByDir);
2270 WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2274 _outQuery(StringInfo str, const Query *node)
2276 WRITE_NODE_TYPE("QUERY");
2278 WRITE_ENUM_FIELD(commandType, CmdType);
2279 WRITE_ENUM_FIELD(querySource, QuerySource);
2280 /* we intentionally do not print the queryId field */
2281 WRITE_BOOL_FIELD(canSetTag);
2284 * Hack to work around missing outfuncs routines for a lot of the
2285 * utility-statement node types. (The only one we actually *need* for
2286 * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2287 * for the meantime do this to avoid getting lots of warnings when running
2288 * with debug_print_parse on.
2290 if (node->utilityStmt)
2292 switch (nodeTag(node->utilityStmt))
2297 case T_DeclareCursorStmt:
2298 WRITE_NODE_FIELD(utilityStmt);
2301 appendStringInfoString(str, " :utilityStmt ?");
2306 appendStringInfoString(str, " :utilityStmt <>");
2308 WRITE_INT_FIELD(resultRelation);
2309 WRITE_BOOL_FIELD(hasAggs);
2310 WRITE_BOOL_FIELD(hasWindowFuncs);
2311 WRITE_BOOL_FIELD(hasSubLinks);
2312 WRITE_BOOL_FIELD(hasDistinctOn);
2313 WRITE_BOOL_FIELD(hasRecursive);
2314 WRITE_BOOL_FIELD(hasModifyingCTE);
2315 WRITE_BOOL_FIELD(hasForUpdate);
2316 WRITE_BOOL_FIELD(hasRowSecurity);
2317 WRITE_NODE_FIELD(cteList);
2318 WRITE_NODE_FIELD(rtable);
2319 WRITE_NODE_FIELD(jointree);
2320 WRITE_NODE_FIELD(targetList);
2321 WRITE_NODE_FIELD(withCheckOptions);
2322 WRITE_NODE_FIELD(returningList);
2323 WRITE_NODE_FIELD(groupClause);
2324 WRITE_NODE_FIELD(havingQual);
2325 WRITE_NODE_FIELD(windowClause);
2326 WRITE_NODE_FIELD(distinctClause);
2327 WRITE_NODE_FIELD(sortClause);
2328 WRITE_NODE_FIELD(limitOffset);
2329 WRITE_NODE_FIELD(limitCount);
2330 WRITE_NODE_FIELD(rowMarks);
2331 WRITE_NODE_FIELD(setOperations);
2332 WRITE_NODE_FIELD(constraintDeps);
2336 _outWithCheckOption(StringInfo str, const WithCheckOption *node)
2338 WRITE_NODE_TYPE("WITHCHECKOPTION");
2340 WRITE_ENUM_FIELD(kind, WCOKind);
2341 WRITE_STRING_FIELD(relname);
2342 WRITE_NODE_FIELD(qual);
2343 WRITE_BOOL_FIELD(cascaded);
2347 _outSortGroupClause(StringInfo str, const SortGroupClause *node)
2349 WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2351 WRITE_UINT_FIELD(tleSortGroupRef);
2352 WRITE_OID_FIELD(eqop);
2353 WRITE_OID_FIELD(sortop);
2354 WRITE_BOOL_FIELD(nulls_first);
2355 WRITE_BOOL_FIELD(hashable);
2359 _outWindowClause(StringInfo str, const WindowClause *node)
2361 WRITE_NODE_TYPE("WINDOWCLAUSE");
2363 WRITE_STRING_FIELD(name);
2364 WRITE_STRING_FIELD(refname);
2365 WRITE_NODE_FIELD(partitionClause);
2366 WRITE_NODE_FIELD(orderClause);
2367 WRITE_INT_FIELD(frameOptions);
2368 WRITE_NODE_FIELD(startOffset);
2369 WRITE_NODE_FIELD(endOffset);
2370 WRITE_UINT_FIELD(winref);
2371 WRITE_BOOL_FIELD(copiedOrder);
2375 _outRowMarkClause(StringInfo str, const RowMarkClause *node)
2377 WRITE_NODE_TYPE("ROWMARKCLAUSE");
2379 WRITE_UINT_FIELD(rti);
2380 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2381 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2382 WRITE_BOOL_FIELD(pushedDown);
2386 _outWithClause(StringInfo str, const WithClause *node)
2388 WRITE_NODE_TYPE("WITHCLAUSE");
2390 WRITE_NODE_FIELD(ctes);
2391 WRITE_BOOL_FIELD(recursive);
2392 WRITE_LOCATION_FIELD(location);
2396 _outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
2398 WRITE_NODE_TYPE("COMMONTABLEEXPR");
2400 WRITE_STRING_FIELD(ctename);
2401 WRITE_NODE_FIELD(aliascolnames);
2402 WRITE_NODE_FIELD(ctequery);
2403 WRITE_LOCATION_FIELD(location);
2404 WRITE_BOOL_FIELD(cterecursive);
2405 WRITE_INT_FIELD(cterefcount);
2406 WRITE_NODE_FIELD(ctecolnames);
2407 WRITE_NODE_FIELD(ctecoltypes);
2408 WRITE_NODE_FIELD(ctecoltypmods);
2409 WRITE_NODE_FIELD(ctecolcollations);
2413 _outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
2415 WRITE_NODE_TYPE("SETOPERATIONSTMT");
2417 WRITE_ENUM_FIELD(op, SetOperation);
2418 WRITE_BOOL_FIELD(all);
2419 WRITE_NODE_FIELD(larg);
2420 WRITE_NODE_FIELD(rarg);
2421 WRITE_NODE_FIELD(colTypes);
2422 WRITE_NODE_FIELD(colTypmods);
2423 WRITE_NODE_FIELD(colCollations);
2424 WRITE_NODE_FIELD(groupClauses);
2428 _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
2430 WRITE_NODE_TYPE("RTE");
2432 /* put alias + eref first to make dump more legible */
2433 WRITE_NODE_FIELD(alias);
2434 WRITE_NODE_FIELD(eref);
2435 WRITE_ENUM_FIELD(rtekind, RTEKind);
2437 switch (node->rtekind)
2440 WRITE_OID_FIELD(relid);
2441 WRITE_CHAR_FIELD(relkind);
2444 WRITE_NODE_FIELD(subquery);
2445 WRITE_BOOL_FIELD(security_barrier);
2448 WRITE_ENUM_FIELD(jointype, JoinType);
2449 WRITE_NODE_FIELD(joinaliasvars);
2452 WRITE_NODE_FIELD(functions);
2453 WRITE_BOOL_FIELD(funcordinality);
2456 WRITE_NODE_FIELD(values_lists);
2457 WRITE_NODE_FIELD(values_collations);
2460 WRITE_STRING_FIELD(ctename);
2461 WRITE_UINT_FIELD(ctelevelsup);
2462 WRITE_BOOL_FIELD(self_reference);
2463 WRITE_NODE_FIELD(ctecoltypes);
2464 WRITE_NODE_FIELD(ctecoltypmods);
2465 WRITE_NODE_FIELD(ctecolcollations);
2468 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
2472 WRITE_BOOL_FIELD(lateral);
2473 WRITE_BOOL_FIELD(inh);
2474 WRITE_BOOL_FIELD(inFromCl);
2475 WRITE_UINT_FIELD(requiredPerms);
2476 WRITE_OID_FIELD(checkAsUser);
2477 WRITE_BITMAPSET_FIELD(selectedCols);
2478 WRITE_BITMAPSET_FIELD(modifiedCols);
2479 WRITE_NODE_FIELD(securityQuals);
2483 _outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
2485 WRITE_NODE_TYPE("RANGETBLFUNCTION");
2487 WRITE_NODE_FIELD(funcexpr);
2488 WRITE_INT_FIELD(funccolcount);
2489 WRITE_NODE_FIELD(funccolnames);
2490 WRITE_NODE_FIELD(funccoltypes);
2491 WRITE_NODE_FIELD(funccoltypmods);
2492 WRITE_NODE_FIELD(funccolcollations);
2493 WRITE_BITMAPSET_FIELD(funcparams);
2497 _outAExpr(StringInfo str, const A_Expr *node)
2499 WRITE_NODE_TYPE("AEXPR");
2504 appendStringInfoChar(str, ' ');
2505 WRITE_NODE_FIELD(name);
2508 appendStringInfoChar(str, ' ');
2509 WRITE_NODE_FIELD(name);
2510 appendStringInfoString(str, " ANY ");
2513 appendStringInfoChar(str, ' ');
2514 WRITE_NODE_FIELD(name);
2515 appendStringInfoString(str, " ALL ");
2517 case AEXPR_DISTINCT:
2518 appendStringInfoString(str, " DISTINCT ");
2519 WRITE_NODE_FIELD(name);
2522 appendStringInfoString(str, " NULLIF ");
2523 WRITE_NODE_FIELD(name);
2526 appendStringInfoString(str, " OF ");
2527 WRITE_NODE_FIELD(name);
2530 appendStringInfoString(str, " IN ");
2531 WRITE_NODE_FIELD(name);
2534 appendStringInfoString(str, " LIKE ");
2535 WRITE_NODE_FIELD(name);
2538 appendStringInfoString(str, " ILIKE ");
2539 WRITE_NODE_FIELD(name);
2542 appendStringInfoString(str, " SIMILAR ");
2543 WRITE_NODE_FIELD(name);
2546 appendStringInfoString(str, " BETWEEN ");
2547 WRITE_NODE_FIELD(name);
2549 case AEXPR_NOT_BETWEEN:
2550 appendStringInfoString(str, " NOT_BETWEEN ");
2551 WRITE_NODE_FIELD(name);
2553 case AEXPR_BETWEEN_SYM:
2554 appendStringInfoString(str, " BETWEEN_SYM ");
2555 WRITE_NODE_FIELD(name);
2557 case AEXPR_NOT_BETWEEN_SYM:
2558 appendStringInfoString(str, " NOT_BETWEEN_SYM ");
2559 WRITE_NODE_FIELD(name);
2562 appendStringInfoString(str, " PAREN");
2565 appendStringInfoString(str, " ??");
2569 WRITE_NODE_FIELD(lexpr);
2570 WRITE_NODE_FIELD(rexpr);
2571 WRITE_LOCATION_FIELD(location);
2575 _outValue(StringInfo str, const Value *value)
2577 switch (value->type)
2580 appendStringInfo(str, "%ld", value->val.ival);
2585 * We assume the value is a valid numeric literal and so does not
2588 appendStringInfoString(str, value->val.str);
2593 * We use _outToken to provide escaping of the string's content,
2594 * but we don't want it to do anything with an empty string.
2596 appendStringInfoChar(str, '"');
2597 if (value->val.str[0] != '\0')
2598 _outToken(str, value->val.str);
2599 appendStringInfoChar(str, '"');
2602 /* internal representation already has leading 'b' */
2603 appendStringInfoString(str, value->val.str);
2606 /* this is seen only within A_Const, not in transformed trees */
2607 appendStringInfoString(str, "NULL");
2610 elog(ERROR, "unrecognized node type: %d", (int) value->type);
2616 _outColumnRef(StringInfo str, const ColumnRef *node)
2618 WRITE_NODE_TYPE("COLUMNREF");
2620 WRITE_NODE_FIELD(fields);
2621 WRITE_LOCATION_FIELD(location);
2625 _outParamRef(StringInfo str, const ParamRef *node)
2627 WRITE_NODE_TYPE("PARAMREF");
2629 WRITE_INT_FIELD(number);
2630 WRITE_LOCATION_FIELD(location);
2634 _outAConst(StringInfo str, const A_Const *node)
2636 WRITE_NODE_TYPE("A_CONST");
2638 appendStringInfoString(str, " :val ");
2639 _outValue(str, &(node->val));
2640 WRITE_LOCATION_FIELD(location);
2644 _outA_Star(StringInfo str, const A_Star *node)
2646 WRITE_NODE_TYPE("A_STAR");
2650 _outA_Indices(StringInfo str, const A_Indices *node)
2652 WRITE_NODE_TYPE("A_INDICES");
2654 WRITE_NODE_FIELD(lidx);
2655 WRITE_NODE_FIELD(uidx);
2659 _outA_Indirection(StringInfo str, const A_Indirection *node)
2661 WRITE_NODE_TYPE("A_INDIRECTION");
2663 WRITE_NODE_FIELD(arg);
2664 WRITE_NODE_FIELD(indirection);
2668 _outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
2670 WRITE_NODE_TYPE("A_ARRAYEXPR");
2672 WRITE_NODE_FIELD(elements);
2673 WRITE_LOCATION_FIELD(location);
2677 _outResTarget(StringInfo str, const ResTarget *node)
2679 WRITE_NODE_TYPE("RESTARGET");
2681 WRITE_STRING_FIELD(name);
2682 WRITE_NODE_FIELD(indirection);
2683 WRITE_NODE_FIELD(val);
2684 WRITE_LOCATION_FIELD(location);
2688 _outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
2690 WRITE_NODE_TYPE("MULTIASSIGNREF");
2692 WRITE_NODE_FIELD(source);
2693 WRITE_INT_FIELD(colno);
2694 WRITE_INT_FIELD(ncolumns);
2698 _outSortBy(StringInfo str, const SortBy *node)
2700 WRITE_NODE_TYPE("SORTBY");
2702 WRITE_NODE_FIELD(node);
2703 WRITE_ENUM_FIELD(sortby_dir, SortByDir);
2704 WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
2705 WRITE_NODE_FIELD(useOp);
2706 WRITE_LOCATION_FIELD(location);
2710 _outWindowDef(StringInfo str, const WindowDef *node)
2712 WRITE_NODE_TYPE("WINDOWDEF");
2714 WRITE_STRING_FIELD(name);
2715 WRITE_STRING_FIELD(refname);
2716 WRITE_NODE_FIELD(partitionClause);
2717 WRITE_NODE_FIELD(orderClause);
2718 WRITE_INT_FIELD(frameOptions);
2719 WRITE_NODE_FIELD(startOffset);
2720 WRITE_NODE_FIELD(endOffset);
2721 WRITE_LOCATION_FIELD(location);
2725 _outRangeSubselect(StringInfo str, const RangeSubselect *node)
2727 WRITE_NODE_TYPE("RANGESUBSELECT");
2729 WRITE_BOOL_FIELD(lateral);
2730 WRITE_NODE_FIELD(subquery);
2731 WRITE_NODE_FIELD(alias);
2735 _outRangeFunction(StringInfo str, const RangeFunction *node)
2737 WRITE_NODE_TYPE("RANGEFUNCTION");
2739 WRITE_BOOL_FIELD(lateral);
2740 WRITE_BOOL_FIELD(ordinality);
2741 WRITE_BOOL_FIELD(is_rowsfrom);
2742 WRITE_NODE_FIELD(functions);
2743 WRITE_NODE_FIELD(alias);
2744 WRITE_NODE_FIELD(coldeflist);
2748 _outConstraint(StringInfo str, const Constraint *node)
2750 WRITE_NODE_TYPE("CONSTRAINT");
2752 WRITE_STRING_FIELD(conname);
2753 WRITE_BOOL_FIELD(deferrable);
2754 WRITE_BOOL_FIELD(initdeferred);
2755 WRITE_LOCATION_FIELD(location);
2757 appendStringInfoString(str, " :contype ");
2758 switch (node->contype)
2761 appendStringInfoString(str, "NULL");
2764 case CONSTR_NOTNULL:
2765 appendStringInfoString(str, "NOT_NULL");
2768 case CONSTR_DEFAULT:
2769 appendStringInfoString(str, "DEFAULT");
2770 WRITE_NODE_FIELD(raw_expr);
2771 WRITE_STRING_FIELD(cooked_expr);
2775 appendStringInfoString(str, "CHECK");
2776 WRITE_BOOL_FIELD(is_no_inherit);
2777 WRITE_NODE_FIELD(raw_expr);
2778 WRITE_STRING_FIELD(cooked_expr);
2781 case CONSTR_PRIMARY:
2782 appendStringInfoString(str, "PRIMARY_KEY");
2783 WRITE_NODE_FIELD(keys);
2784 WRITE_NODE_FIELD(options);
2785 WRITE_STRING_FIELD(indexname);
2786 WRITE_STRING_FIELD(indexspace);
2787 /* access_method and where_clause not currently used */
2791 appendStringInfoString(str, "UNIQUE");
2792 WRITE_NODE_FIELD(keys);
2793 WRITE_NODE_FIELD(options);
2794 WRITE_STRING_FIELD(indexname);
2795 WRITE_STRING_FIELD(indexspace);
2796 /* access_method and where_clause not currently used */
2799 case CONSTR_EXCLUSION:
2800 appendStringInfoString(str, "EXCLUSION");
2801 WRITE_NODE_FIELD(exclusions);
2802 WRITE_NODE_FIELD(options);
2803 WRITE_STRING_FIELD(indexname);
2804 WRITE_STRING_FIELD(indexspace);
2805 WRITE_STRING_FIELD(access_method);
2806 WRITE_NODE_FIELD(where_clause);
2809 case CONSTR_FOREIGN:
2810 appendStringInfoString(str, "FOREIGN_KEY");
2811 WRITE_NODE_FIELD(pktable);
2812 WRITE_NODE_FIELD(fk_attrs);
2813 WRITE_NODE_FIELD(pk_attrs);
2814 WRITE_CHAR_FIELD(fk_matchtype);
2815 WRITE_CHAR_FIELD(fk_upd_action);
2816 WRITE_CHAR_FIELD(fk_del_action);
2817 WRITE_NODE_FIELD(old_conpfeqop);
2818 WRITE_OID_FIELD(old_pktable_oid);
2819 WRITE_BOOL_FIELD(skip_validation);
2820 WRITE_BOOL_FIELD(initially_valid);
2823 case CONSTR_ATTR_DEFERRABLE:
2824 appendStringInfoString(str, "ATTR_DEFERRABLE");
2827 case CONSTR_ATTR_NOT_DEFERRABLE:
2828 appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
2831 case CONSTR_ATTR_DEFERRED:
2832 appendStringInfoString(str, "ATTR_DEFERRED");
2835 case CONSTR_ATTR_IMMEDIATE:
2836 appendStringInfoString(str, "ATTR_IMMEDIATE");
2840 appendStringInfo(str, "<unrecognized_constraint %d>",
2841 (int) node->contype);
2849 * converts a Node into ascii string and append it to 'str'
2852 _outNode(StringInfo str, const void *obj)
2855 appendStringInfoString(str, "<>");
2856 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
2858 else if (IsA(obj, Integer) ||
2861 IsA(obj, BitString))
2863 /* nodeRead does not want to see { } around these! */
2864 _outValue(str, obj);
2868 appendStringInfoChar(str, '{');
2869 switch (nodeTag(obj))
2872 _outPlannedStmt(str, obj);
2878 _outResult(str, obj);
2881 _outModifyTable(str, obj);
2884 _outAppend(str, obj);
2887 _outMergeAppend(str, obj);
2889 case T_RecursiveUnion:
2890 _outRecursiveUnion(str, obj);
2893 _outBitmapAnd(str, obj);
2896 _outBitmapOr(str, obj);
2902 _outSeqScan(str, obj);
2905 _outIndexScan(str, obj);
2907 case T_IndexOnlyScan:
2908 _outIndexOnlyScan(str, obj);
2910 case T_BitmapIndexScan:
2911 _outBitmapIndexScan(str, obj);
2913 case T_BitmapHeapScan:
2914 _outBitmapHeapScan(str, obj);
2917 _outTidScan(str, obj);
2919 case T_SubqueryScan:
2920 _outSubqueryScan(str, obj);
2922 case T_FunctionScan:
2923 _outFunctionScan(str, obj);
2926 _outValuesScan(str, obj);
2929 _outCteScan(str, obj);
2931 case T_WorkTableScan:
2932 _outWorkTableScan(str, obj);
2935 _outForeignScan(str, obj);
2938 _outCustomScan(str, obj);
2944 _outNestLoop(str, obj);
2947 _outMergeJoin(str, obj);
2950 _outHashJoin(str, obj);
2956 _outWindowAgg(str, obj);
2959 _outGroup(str, obj);
2962 _outMaterial(str, obj);
2968 _outUnique(str, obj);
2974 _outSetOp(str, obj);
2977 _outLockRows(str, obj);
2980 _outLimit(str, obj);
2982 case T_NestLoopParam:
2983 _outNestLoopParam(str, obj);
2986 _outPlanRowMark(str, obj);
2988 case T_PlanInvalItem:
2989 _outPlanInvalItem(str, obj);
2992 _outAlias(str, obj);
2995 _outRangeVar(str, obj);
2998 _outIntoClause(str, obj);
3004 _outConst(str, obj);
3007 _outParam(str, obj);
3010 _outAggref(str, obj);
3013 _outWindowFunc(str, obj);
3016 _outArrayRef(str, obj);
3019 _outFuncExpr(str, obj);
3021 case T_NamedArgExpr:
3022 _outNamedArgExpr(str, obj);
3025 _outOpExpr(str, obj);
3027 case T_DistinctExpr:
3028 _outDistinctExpr(str, obj);
3031 _outNullIfExpr(str, obj);
3033 case T_ScalarArrayOpExpr:
3034 _outScalarArrayOpExpr(str, obj);
3037 _outBoolExpr(str, obj);
3040 _outSubLink(str, obj);
3043 _outSubPlan(str, obj);
3045 case T_AlternativeSubPlan:
3046 _outAlternativeSubPlan(str, obj);
3049 _outFieldSelect(str, obj);
3052 _outFieldStore(str, obj);
3055 _outRelabelType(str, obj);
3058 _outCoerceViaIO(str, obj);
3060 case T_ArrayCoerceExpr:
3061 _outArrayCoerceExpr(str, obj);
3063 case T_ConvertRowtypeExpr:
3064 _outConvertRowtypeExpr(str, obj);
3067 _outCollateExpr(str, obj);
3070 _outCaseExpr(str, obj);
3073 _outCaseWhen(str, obj);
3075 case T_CaseTestExpr:
3076 _outCaseTestExpr(str, obj);
3079 _outArrayExpr(str, obj);
3082 _outRowExpr(str, obj);
3084 case T_RowCompareExpr:
3085 _outRowCompareExpr(str, obj);
3087 case T_CoalesceExpr:
3088 _outCoalesceExpr(str, obj);
3091 _outMinMaxExpr(str, obj);
3094 _outXmlExpr(str, obj);
3097 _outNullTest(str, obj);
3100 _outBooleanTest(str, obj);
3102 case T_CoerceToDomain:
3103 _outCoerceToDomain(str, obj);
3105 case T_CoerceToDomainValue:
3106 _outCoerceToDomainValue(str, obj);
3108 case T_SetToDefault:
3109 _outSetToDefault(str, obj);
3111 case T_CurrentOfExpr:
3112 _outCurrentOfExpr(str, obj);
3115 _outTargetEntry(str, obj);
3118 _outRangeTblRef(str, obj);
3121 _outJoinExpr(str, obj);
3124 _outFromExpr(str, obj);
3131 _outIndexPath(str, obj);
3133 case T_BitmapHeapPath:
3134 _outBitmapHeapPath(str, obj);
3136 case T_BitmapAndPath:
3137 _outBitmapAndPath(str, obj);
3139 case T_BitmapOrPath:
3140 _outBitmapOrPath(str, obj);
3143 _outTidPath(str, obj);
3146 _outForeignPath(str, obj);
3149 _outCustomPath(str, obj);
3152 _outAppendPath(str, obj);
3154 case T_MergeAppendPath:
3155 _outMergeAppendPath(str, obj);
3158 _outResultPath(str, obj);
3160 case T_MaterialPath:
3161 _outMaterialPath(str, obj);
3164 _outUniquePath(str, obj);
3167 _outNestPath(str, obj);
3170 _outMergePath(str, obj);
3173 _outHashPath(str, obj);
3175 case T_PlannerGlobal:
3176 _outPlannerGlobal(str, obj);
3179 _outPlannerInfo(str, obj);
3182 _outRelOptInfo(str, obj);
3184 case T_IndexOptInfo:
3185 _outIndexOptInfo(str, obj);
3187 case T_EquivalenceClass:
3188 _outEquivalenceClass(str, obj);
3190 case T_EquivalenceMember:
3191 _outEquivalenceMember(str, obj);
3194 _outPathKey(str, obj);
3196 case T_ParamPathInfo:
3197 _outParamPathInfo(str, obj);
3199 case T_RestrictInfo:
3200 _outRestrictInfo(str, obj);
3202 case T_PlaceHolderVar:
3203 _outPlaceHolderVar(str, obj);
3205 case T_SpecialJoinInfo:
3206 _outSpecialJoinInfo(str, obj);
3208 case T_LateralJoinInfo:
3209 _outLateralJoinInfo(str, obj);
3211 case T_AppendRelInfo:
3212 _outAppendRelInfo(str, obj);
3214 case T_PlaceHolderInfo:
3215 _outPlaceHolderInfo(str, obj);
3217 case T_MinMaxAggInfo:
3218 _outMinMaxAggInfo(str, obj);
3220 case T_PlannerParamItem:
3221 _outPlannerParamItem(str, obj);
3225 _outCreateStmt(str, obj);
3227 case T_CreateForeignTableStmt:
3228 _outCreateForeignTableStmt(str, obj);
3230 case T_ImportForeignSchemaStmt:
3231 _outImportForeignSchemaStmt(str, obj);
3234 _outIndexStmt(str, obj);
3237 _outNotifyStmt(str, obj);
3239 case T_DeclareCursorStmt:
3240 _outDeclareCursorStmt(str, obj);
3243 _outSelectStmt(str, obj);
3246 _outColumnDef(str, obj);
3249 _outTypeName(str, obj);
3252 _outTypeCast(str, obj);
3254 case T_CollateClause:
3255 _outCollateClause(str, obj);
3258 _outIndexElem(str, obj);
3261 _outQuery(str, obj);
3263 case T_WithCheckOption:
3264 _outWithCheckOption(str, obj);
3266 case T_SortGroupClause:
3267 _outSortGroupClause(str, obj);
3269 case T_WindowClause:
3270 _outWindowClause(str, obj);
3272 case T_RowMarkClause:
3273 _outRowMarkClause(str, obj);
3276 _outWithClause(str, obj);
3278 case T_CommonTableExpr:
3279 _outCommonTableExpr(str, obj);
3281 case T_SetOperationStmt:
3282 _outSetOperationStmt(str, obj);
3284 case T_RangeTblEntry:
3285 _outRangeTblEntry(str, obj);
3287 case T_RangeTblFunction:
3288 _outRangeTblFunction(str, obj);
3291 _outAExpr(str, obj);
3294 _outColumnRef(str, obj);
3297 _outParamRef(str, obj);
3300 _outAConst(str, obj);
3303 _outA_Star(str, obj);
3306 _outA_Indices(str, obj);
3308 case T_A_Indirection:
3309 _outA_Indirection(str, obj);
3312 _outA_ArrayExpr(str, obj);
3315 _outResTarget(str, obj);
3317 case T_MultiAssignRef:
3318 _outMultiAssignRef(str, obj);
3321 _outSortBy(str, obj);
3324 _outWindowDef(str, obj);
3326 case T_RangeSubselect:
3327 _outRangeSubselect(str, obj);
3329 case T_RangeFunction:
3330 _outRangeFunction(str, obj);
3333 _outConstraint(str, obj);
3336 _outFuncCall(str, obj);
3339 _outDefElem(str, obj);
3341 case T_TableLikeClause:
3342 _outTableLikeClause(str, obj);
3344 case T_LockingClause:
3345 _outLockingClause(str, obj);
3347 case T_XmlSerialize:
3348 _outXmlSerialize(str, obj);
3354 * This should be an ERROR, but it's too useful to be able to
3355 * dump structures that _outNode only understands part of.
3357 elog(WARNING, "could not dump unrecognized node type: %d",
3358 (int) nodeTag(obj));
3361 appendStringInfoChar(str, '}');
3367 * returns the ascii representation of the Node as a palloc'd string
3370 nodeToString(const void *obj)
3374 /* see stringinfo.h for an explanation of this maneuver */
3375 initStringInfo(&str);
3376 _outNode(&str, obj);