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_NODE_FIELD(fdw_exprs);
562 WRITE_NODE_FIELD(fdw_private);
563 WRITE_BOOL_FIELD(fsSystemCol);
567 _outCustomScan(StringInfo str, const CustomScan *node)
569 WRITE_NODE_TYPE("CUSTOMSCAN");
571 _outScanInfo(str, (const Scan *) node);
573 WRITE_UINT_FIELD(flags);
574 WRITE_NODE_FIELD(custom_exprs);
575 WRITE_NODE_FIELD(custom_private);
576 appendStringInfoString(str, " :methods ");
577 _outToken(str, node->methods->CustomName);
578 if (node->methods->TextOutCustomScan)
579 node->methods->TextOutCustomScan(str, node);
583 _outJoin(StringInfo str, const Join *node)
585 WRITE_NODE_TYPE("JOIN");
587 _outJoinPlanInfo(str, (const Join *) node);
591 _outNestLoop(StringInfo str, const NestLoop *node)
593 WRITE_NODE_TYPE("NESTLOOP");
595 _outJoinPlanInfo(str, (const Join *) node);
597 WRITE_NODE_FIELD(nestParams);
601 _outMergeJoin(StringInfo str, const MergeJoin *node)
606 WRITE_NODE_TYPE("MERGEJOIN");
608 _outJoinPlanInfo(str, (const Join *) node);
610 WRITE_NODE_FIELD(mergeclauses);
612 numCols = list_length(node->mergeclauses);
614 appendStringInfoString(str, " :mergeFamilies");
615 for (i = 0; i < numCols; i++)
616 appendStringInfo(str, " %u", node->mergeFamilies[i]);
618 appendStringInfoString(str, " :mergeCollations");
619 for (i = 0; i < numCols; i++)
620 appendStringInfo(str, " %u", node->mergeCollations[i]);
622 appendStringInfoString(str, " :mergeStrategies");
623 for (i = 0; i < numCols; i++)
624 appendStringInfo(str, " %d", node->mergeStrategies[i]);
626 appendStringInfoString(str, " :mergeNullsFirst");
627 for (i = 0; i < numCols; i++)
628 appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
632 _outHashJoin(StringInfo str, const HashJoin *node)
634 WRITE_NODE_TYPE("HASHJOIN");
636 _outJoinPlanInfo(str, (const Join *) node);
638 WRITE_NODE_FIELD(hashclauses);
642 _outAgg(StringInfo str, const Agg *node)
646 WRITE_NODE_TYPE("AGG");
648 _outPlanInfo(str, (const Plan *) node);
650 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
651 WRITE_INT_FIELD(numCols);
653 appendStringInfoString(str, " :grpColIdx");
654 for (i = 0; i < node->numCols; i++)
655 appendStringInfo(str, " %d", node->grpColIdx[i]);
657 appendStringInfoString(str, " :grpOperators");
658 for (i = 0; i < node->numCols; i++)
659 appendStringInfo(str, " %u", node->grpOperators[i]);
661 WRITE_LONG_FIELD(numGroups);
665 _outWindowAgg(StringInfo str, const WindowAgg *node)
669 WRITE_NODE_TYPE("WINDOWAGG");
671 _outPlanInfo(str, (const Plan *) node);
673 WRITE_UINT_FIELD(winref);
674 WRITE_INT_FIELD(partNumCols);
676 appendStringInfoString(str, " :partColIdx");
677 for (i = 0; i < node->partNumCols; i++)
678 appendStringInfo(str, " %d", node->partColIdx[i]);
680 appendStringInfoString(str, " :partOperations");
681 for (i = 0; i < node->partNumCols; i++)
682 appendStringInfo(str, " %u", node->partOperators[i]);
684 WRITE_INT_FIELD(ordNumCols);
686 appendStringInfoString(str, " :ordColIdx");
687 for (i = 0; i < node->ordNumCols; i++)
688 appendStringInfo(str, " %d", node->ordColIdx[i]);
690 appendStringInfoString(str, " :ordOperations");
691 for (i = 0; i < node->ordNumCols; i++)
692 appendStringInfo(str, " %u", node->ordOperators[i]);
694 WRITE_INT_FIELD(frameOptions);
695 WRITE_NODE_FIELD(startOffset);
696 WRITE_NODE_FIELD(endOffset);
700 _outGroup(StringInfo str, const Group *node)
704 WRITE_NODE_TYPE("GROUP");
706 _outPlanInfo(str, (const Plan *) node);
708 WRITE_INT_FIELD(numCols);
710 appendStringInfoString(str, " :grpColIdx");
711 for (i = 0; i < node->numCols; i++)
712 appendStringInfo(str, " %d", node->grpColIdx[i]);
714 appendStringInfoString(str, " :grpOperators");
715 for (i = 0; i < node->numCols; i++)
716 appendStringInfo(str, " %u", node->grpOperators[i]);
720 _outMaterial(StringInfo str, const Material *node)
722 WRITE_NODE_TYPE("MATERIAL");
724 _outPlanInfo(str, (const Plan *) node);
728 _outSort(StringInfo str, const Sort *node)
732 WRITE_NODE_TYPE("SORT");
734 _outPlanInfo(str, (const Plan *) node);
736 WRITE_INT_FIELD(numCols);
738 appendStringInfoString(str, " :sortColIdx");
739 for (i = 0; i < node->numCols; i++)
740 appendStringInfo(str, " %d", node->sortColIdx[i]);
742 appendStringInfoString(str, " :sortOperators");
743 for (i = 0; i < node->numCols; i++)
744 appendStringInfo(str, " %u", node->sortOperators[i]);
746 appendStringInfoString(str, " :collations");
747 for (i = 0; i < node->numCols; i++)
748 appendStringInfo(str, " %u", node->collations[i]);
750 appendStringInfoString(str, " :nullsFirst");
751 for (i = 0; i < node->numCols; i++)
752 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
756 _outUnique(StringInfo str, const Unique *node)
760 WRITE_NODE_TYPE("UNIQUE");
762 _outPlanInfo(str, (const Plan *) node);
764 WRITE_INT_FIELD(numCols);
766 appendStringInfoString(str, " :uniqColIdx");
767 for (i = 0; i < node->numCols; i++)
768 appendStringInfo(str, " %d", node->uniqColIdx[i]);
770 appendStringInfoString(str, " :uniqOperators");
771 for (i = 0; i < node->numCols; i++)
772 appendStringInfo(str, " %u", node->uniqOperators[i]);
776 _outHash(StringInfo str, const Hash *node)
778 WRITE_NODE_TYPE("HASH");
780 _outPlanInfo(str, (const Plan *) node);
782 WRITE_OID_FIELD(skewTable);
783 WRITE_INT_FIELD(skewColumn);
784 WRITE_BOOL_FIELD(skewInherit);
785 WRITE_OID_FIELD(skewColType);
786 WRITE_INT_FIELD(skewColTypmod);
790 _outSetOp(StringInfo str, const SetOp *node)
794 WRITE_NODE_TYPE("SETOP");
796 _outPlanInfo(str, (const Plan *) node);
798 WRITE_ENUM_FIELD(cmd, SetOpCmd);
799 WRITE_ENUM_FIELD(strategy, SetOpStrategy);
800 WRITE_INT_FIELD(numCols);
802 appendStringInfoString(str, " :dupColIdx");
803 for (i = 0; i < node->numCols; i++)
804 appendStringInfo(str, " %d", node->dupColIdx[i]);
806 appendStringInfoString(str, " :dupOperators");
807 for (i = 0; i < node->numCols; i++)
808 appendStringInfo(str, " %u", node->dupOperators[i]);
810 WRITE_INT_FIELD(flagColIdx);
811 WRITE_INT_FIELD(firstFlag);
812 WRITE_LONG_FIELD(numGroups);
816 _outLockRows(StringInfo str, const LockRows *node)
818 WRITE_NODE_TYPE("LOCKROWS");
820 _outPlanInfo(str, (const Plan *) node);
822 WRITE_NODE_FIELD(rowMarks);
823 WRITE_INT_FIELD(epqParam);
827 _outLimit(StringInfo str, const Limit *node)
829 WRITE_NODE_TYPE("LIMIT");
831 _outPlanInfo(str, (const Plan *) node);
833 WRITE_NODE_FIELD(limitOffset);
834 WRITE_NODE_FIELD(limitCount);
838 _outNestLoopParam(StringInfo str, const NestLoopParam *node)
840 WRITE_NODE_TYPE("NESTLOOPPARAM");
842 WRITE_INT_FIELD(paramno);
843 WRITE_NODE_FIELD(paramval);
847 _outPlanRowMark(StringInfo str, const PlanRowMark *node)
849 WRITE_NODE_TYPE("PLANROWMARK");
851 WRITE_UINT_FIELD(rti);
852 WRITE_UINT_FIELD(prti);
853 WRITE_UINT_FIELD(rowmarkId);
854 WRITE_ENUM_FIELD(markType, RowMarkType);
855 WRITE_BOOL_FIELD(waitPolicy);
856 WRITE_BOOL_FIELD(isParent);
860 _outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
862 WRITE_NODE_TYPE("PLANINVALITEM");
864 WRITE_INT_FIELD(cacheId);
865 WRITE_UINT_FIELD(hashValue);
868 /*****************************************************************************
870 * Stuff from primnodes.h.
872 *****************************************************************************/
875 _outAlias(StringInfo str, const Alias *node)
877 WRITE_NODE_TYPE("ALIAS");
879 WRITE_STRING_FIELD(aliasname);
880 WRITE_NODE_FIELD(colnames);
884 _outRangeVar(StringInfo str, const RangeVar *node)
886 WRITE_NODE_TYPE("RANGEVAR");
889 * we deliberately ignore catalogname here, since it is presently not
890 * semantically meaningful
892 WRITE_STRING_FIELD(schemaname);
893 WRITE_STRING_FIELD(relname);
894 WRITE_ENUM_FIELD(inhOpt, InhOption);
895 WRITE_CHAR_FIELD(relpersistence);
896 WRITE_NODE_FIELD(alias);
897 WRITE_LOCATION_FIELD(location);
901 _outIntoClause(StringInfo str, const IntoClause *node)
903 WRITE_NODE_TYPE("INTOCLAUSE");
905 WRITE_NODE_FIELD(rel);
906 WRITE_NODE_FIELD(colNames);
907 WRITE_NODE_FIELD(options);
908 WRITE_ENUM_FIELD(onCommit, OnCommitAction);
909 WRITE_STRING_FIELD(tableSpaceName);
910 WRITE_NODE_FIELD(viewQuery);
911 WRITE_BOOL_FIELD(skipData);
915 _outVar(StringInfo str, const Var *node)
917 WRITE_NODE_TYPE("VAR");
919 WRITE_UINT_FIELD(varno);
920 WRITE_INT_FIELD(varattno);
921 WRITE_OID_FIELD(vartype);
922 WRITE_INT_FIELD(vartypmod);
923 WRITE_OID_FIELD(varcollid);
924 WRITE_UINT_FIELD(varlevelsup);
925 WRITE_UINT_FIELD(varnoold);
926 WRITE_INT_FIELD(varoattno);
927 WRITE_LOCATION_FIELD(location);
931 _outConst(StringInfo str, const Const *node)
933 WRITE_NODE_TYPE("CONST");
935 WRITE_OID_FIELD(consttype);
936 WRITE_INT_FIELD(consttypmod);
937 WRITE_OID_FIELD(constcollid);
938 WRITE_INT_FIELD(constlen);
939 WRITE_BOOL_FIELD(constbyval);
940 WRITE_BOOL_FIELD(constisnull);
941 WRITE_LOCATION_FIELD(location);
943 appendStringInfoString(str, " :constvalue ");
944 if (node->constisnull)
945 appendStringInfoString(str, "<>");
947 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
951 _outParam(StringInfo str, const Param *node)
953 WRITE_NODE_TYPE("PARAM");
955 WRITE_ENUM_FIELD(paramkind, ParamKind);
956 WRITE_INT_FIELD(paramid);
957 WRITE_OID_FIELD(paramtype);
958 WRITE_INT_FIELD(paramtypmod);
959 WRITE_OID_FIELD(paramcollid);
960 WRITE_LOCATION_FIELD(location);
964 _outAggref(StringInfo str, const Aggref *node)
966 WRITE_NODE_TYPE("AGGREF");
968 WRITE_OID_FIELD(aggfnoid);
969 WRITE_OID_FIELD(aggtype);
970 WRITE_OID_FIELD(aggcollid);
971 WRITE_OID_FIELD(inputcollid);
972 WRITE_NODE_FIELD(aggdirectargs);
973 WRITE_NODE_FIELD(args);
974 WRITE_NODE_FIELD(aggorder);
975 WRITE_NODE_FIELD(aggdistinct);
976 WRITE_NODE_FIELD(aggfilter);
977 WRITE_BOOL_FIELD(aggstar);
978 WRITE_BOOL_FIELD(aggvariadic);
979 WRITE_CHAR_FIELD(aggkind);
980 WRITE_UINT_FIELD(agglevelsup);
981 WRITE_LOCATION_FIELD(location);
985 _outWindowFunc(StringInfo str, const WindowFunc *node)
987 WRITE_NODE_TYPE("WINDOWFUNC");
989 WRITE_OID_FIELD(winfnoid);
990 WRITE_OID_FIELD(wintype);
991 WRITE_OID_FIELD(wincollid);
992 WRITE_OID_FIELD(inputcollid);
993 WRITE_NODE_FIELD(args);
994 WRITE_NODE_FIELD(aggfilter);
995 WRITE_UINT_FIELD(winref);
996 WRITE_BOOL_FIELD(winstar);
997 WRITE_BOOL_FIELD(winagg);
998 WRITE_LOCATION_FIELD(location);
1002 _outArrayRef(StringInfo str, const ArrayRef *node)
1004 WRITE_NODE_TYPE("ARRAYREF");
1006 WRITE_OID_FIELD(refarraytype);
1007 WRITE_OID_FIELD(refelemtype);
1008 WRITE_INT_FIELD(reftypmod);
1009 WRITE_OID_FIELD(refcollid);
1010 WRITE_NODE_FIELD(refupperindexpr);
1011 WRITE_NODE_FIELD(reflowerindexpr);
1012 WRITE_NODE_FIELD(refexpr);
1013 WRITE_NODE_FIELD(refassgnexpr);
1017 _outFuncExpr(StringInfo str, const FuncExpr *node)
1019 WRITE_NODE_TYPE("FUNCEXPR");
1021 WRITE_OID_FIELD(funcid);
1022 WRITE_OID_FIELD(funcresulttype);
1023 WRITE_BOOL_FIELD(funcretset);
1024 WRITE_BOOL_FIELD(funcvariadic);
1025 WRITE_ENUM_FIELD(funcformat, CoercionForm);
1026 WRITE_OID_FIELD(funccollid);
1027 WRITE_OID_FIELD(inputcollid);
1028 WRITE_NODE_FIELD(args);
1029 WRITE_LOCATION_FIELD(location);
1033 _outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
1035 WRITE_NODE_TYPE("NAMEDARGEXPR");
1037 WRITE_NODE_FIELD(arg);
1038 WRITE_STRING_FIELD(name);
1039 WRITE_INT_FIELD(argnumber);
1040 WRITE_LOCATION_FIELD(location);
1044 _outOpExpr(StringInfo str, const OpExpr *node)
1046 WRITE_NODE_TYPE("OPEXPR");
1048 WRITE_OID_FIELD(opno);
1049 WRITE_OID_FIELD(opfuncid);
1050 WRITE_OID_FIELD(opresulttype);
1051 WRITE_BOOL_FIELD(opretset);
1052 WRITE_OID_FIELD(opcollid);
1053 WRITE_OID_FIELD(inputcollid);
1054 WRITE_NODE_FIELD(args);
1055 WRITE_LOCATION_FIELD(location);
1059 _outDistinctExpr(StringInfo str, const DistinctExpr *node)
1061 WRITE_NODE_TYPE("DISTINCTEXPR");
1063 WRITE_OID_FIELD(opno);
1064 WRITE_OID_FIELD(opfuncid);
1065 WRITE_OID_FIELD(opresulttype);
1066 WRITE_BOOL_FIELD(opretset);
1067 WRITE_OID_FIELD(opcollid);
1068 WRITE_OID_FIELD(inputcollid);
1069 WRITE_NODE_FIELD(args);
1070 WRITE_LOCATION_FIELD(location);
1074 _outNullIfExpr(StringInfo str, const NullIfExpr *node)
1076 WRITE_NODE_TYPE("NULLIFEXPR");
1078 WRITE_OID_FIELD(opno);
1079 WRITE_OID_FIELD(opfuncid);
1080 WRITE_OID_FIELD(opresulttype);
1081 WRITE_BOOL_FIELD(opretset);
1082 WRITE_OID_FIELD(opcollid);
1083 WRITE_OID_FIELD(inputcollid);
1084 WRITE_NODE_FIELD(args);
1085 WRITE_LOCATION_FIELD(location);
1089 _outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
1091 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
1093 WRITE_OID_FIELD(opno);
1094 WRITE_OID_FIELD(opfuncid);
1095 WRITE_BOOL_FIELD(useOr);
1096 WRITE_OID_FIELD(inputcollid);
1097 WRITE_NODE_FIELD(args);
1098 WRITE_LOCATION_FIELD(location);
1102 _outBoolExpr(StringInfo str, const BoolExpr *node)
1106 WRITE_NODE_TYPE("BOOLEXPR");
1108 /* do-it-yourself enum representation */
1109 switch (node->boolop)
1121 appendStringInfoString(str, " :boolop ");
1122 _outToken(str, opstr);
1124 WRITE_NODE_FIELD(args);
1125 WRITE_LOCATION_FIELD(location);
1129 _outSubLink(StringInfo str, const SubLink *node)
1131 WRITE_NODE_TYPE("SUBLINK");
1133 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1134 WRITE_INT_FIELD(subLinkId);
1135 WRITE_NODE_FIELD(testexpr);
1136 WRITE_NODE_FIELD(operName);
1137 WRITE_NODE_FIELD(subselect);
1138 WRITE_LOCATION_FIELD(location);
1142 _outSubPlan(StringInfo str, const SubPlan *node)
1144 WRITE_NODE_TYPE("SUBPLAN");
1146 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1147 WRITE_NODE_FIELD(testexpr);
1148 WRITE_NODE_FIELD(paramIds);
1149 WRITE_INT_FIELD(plan_id);
1150 WRITE_STRING_FIELD(plan_name);
1151 WRITE_OID_FIELD(firstColType);
1152 WRITE_INT_FIELD(firstColTypmod);
1153 WRITE_OID_FIELD(firstColCollation);
1154 WRITE_BOOL_FIELD(useHashTable);
1155 WRITE_BOOL_FIELD(unknownEqFalse);
1156 WRITE_NODE_FIELD(setParam);
1157 WRITE_NODE_FIELD(parParam);
1158 WRITE_NODE_FIELD(args);
1159 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1160 WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
1164 _outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
1166 WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
1168 WRITE_NODE_FIELD(subplans);
1172 _outFieldSelect(StringInfo str, const FieldSelect *node)
1174 WRITE_NODE_TYPE("FIELDSELECT");
1176 WRITE_NODE_FIELD(arg);
1177 WRITE_INT_FIELD(fieldnum);
1178 WRITE_OID_FIELD(resulttype);
1179 WRITE_INT_FIELD(resulttypmod);
1180 WRITE_OID_FIELD(resultcollid);
1184 _outFieldStore(StringInfo str, const FieldStore *node)
1186 WRITE_NODE_TYPE("FIELDSTORE");
1188 WRITE_NODE_FIELD(arg);
1189 WRITE_NODE_FIELD(newvals);
1190 WRITE_NODE_FIELD(fieldnums);
1191 WRITE_OID_FIELD(resulttype);
1195 _outRelabelType(StringInfo str, const RelabelType *node)
1197 WRITE_NODE_TYPE("RELABELTYPE");
1199 WRITE_NODE_FIELD(arg);
1200 WRITE_OID_FIELD(resulttype);
1201 WRITE_INT_FIELD(resulttypmod);
1202 WRITE_OID_FIELD(resultcollid);
1203 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
1204 WRITE_LOCATION_FIELD(location);
1208 _outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
1210 WRITE_NODE_TYPE("COERCEVIAIO");
1212 WRITE_NODE_FIELD(arg);
1213 WRITE_OID_FIELD(resulttype);
1214 WRITE_OID_FIELD(resultcollid);
1215 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1216 WRITE_LOCATION_FIELD(location);
1220 _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
1222 WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
1224 WRITE_NODE_FIELD(arg);
1225 WRITE_OID_FIELD(elemfuncid);
1226 WRITE_OID_FIELD(resulttype);
1227 WRITE_INT_FIELD(resulttypmod);
1228 WRITE_OID_FIELD(resultcollid);
1229 WRITE_BOOL_FIELD(isExplicit);
1230 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1231 WRITE_LOCATION_FIELD(location);
1235 _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
1237 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
1239 WRITE_NODE_FIELD(arg);
1240 WRITE_OID_FIELD(resulttype);
1241 WRITE_ENUM_FIELD(convertformat, CoercionForm);
1242 WRITE_LOCATION_FIELD(location);
1246 _outCollateExpr(StringInfo str, const CollateExpr *node)
1248 WRITE_NODE_TYPE("COLLATE");
1250 WRITE_NODE_FIELD(arg);
1251 WRITE_OID_FIELD(collOid);
1252 WRITE_LOCATION_FIELD(location);
1256 _outCaseExpr(StringInfo str, const CaseExpr *node)
1258 WRITE_NODE_TYPE("CASE");
1260 WRITE_OID_FIELD(casetype);
1261 WRITE_OID_FIELD(casecollid);
1262 WRITE_NODE_FIELD(arg);
1263 WRITE_NODE_FIELD(args);
1264 WRITE_NODE_FIELD(defresult);
1265 WRITE_LOCATION_FIELD(location);
1269 _outCaseWhen(StringInfo str, const CaseWhen *node)
1271 WRITE_NODE_TYPE("WHEN");
1273 WRITE_NODE_FIELD(expr);
1274 WRITE_NODE_FIELD(result);
1275 WRITE_LOCATION_FIELD(location);
1279 _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
1281 WRITE_NODE_TYPE("CASETESTEXPR");
1283 WRITE_OID_FIELD(typeId);
1284 WRITE_INT_FIELD(typeMod);
1285 WRITE_OID_FIELD(collation);
1289 _outArrayExpr(StringInfo str, const ArrayExpr *node)
1291 WRITE_NODE_TYPE("ARRAY");
1293 WRITE_OID_FIELD(array_typeid);
1294 WRITE_OID_FIELD(array_collid);
1295 WRITE_OID_FIELD(element_typeid);
1296 WRITE_NODE_FIELD(elements);
1297 WRITE_BOOL_FIELD(multidims);
1298 WRITE_LOCATION_FIELD(location);
1302 _outRowExpr(StringInfo str, const RowExpr *node)
1304 WRITE_NODE_TYPE("ROW");
1306 WRITE_NODE_FIELD(args);
1307 WRITE_OID_FIELD(row_typeid);
1308 WRITE_ENUM_FIELD(row_format, CoercionForm);
1309 WRITE_NODE_FIELD(colnames);
1310 WRITE_LOCATION_FIELD(location);
1314 _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
1316 WRITE_NODE_TYPE("ROWCOMPARE");
1318 WRITE_ENUM_FIELD(rctype, RowCompareType);
1319 WRITE_NODE_FIELD(opnos);
1320 WRITE_NODE_FIELD(opfamilies);
1321 WRITE_NODE_FIELD(inputcollids);
1322 WRITE_NODE_FIELD(largs);
1323 WRITE_NODE_FIELD(rargs);
1327 _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
1329 WRITE_NODE_TYPE("COALESCE");
1331 WRITE_OID_FIELD(coalescetype);
1332 WRITE_OID_FIELD(coalescecollid);
1333 WRITE_NODE_FIELD(args);
1334 WRITE_LOCATION_FIELD(location);
1338 _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
1340 WRITE_NODE_TYPE("MINMAX");
1342 WRITE_OID_FIELD(minmaxtype);
1343 WRITE_OID_FIELD(minmaxcollid);
1344 WRITE_OID_FIELD(inputcollid);
1345 WRITE_ENUM_FIELD(op, MinMaxOp);
1346 WRITE_NODE_FIELD(args);
1347 WRITE_LOCATION_FIELD(location);
1351 _outXmlExpr(StringInfo str, const XmlExpr *node)
1353 WRITE_NODE_TYPE("XMLEXPR");
1355 WRITE_ENUM_FIELD(op, XmlExprOp);
1356 WRITE_STRING_FIELD(name);
1357 WRITE_NODE_FIELD(named_args);
1358 WRITE_NODE_FIELD(arg_names);
1359 WRITE_NODE_FIELD(args);
1360 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
1361 WRITE_OID_FIELD(type);
1362 WRITE_INT_FIELD(typmod);
1363 WRITE_LOCATION_FIELD(location);
1367 _outNullTest(StringInfo str, const NullTest *node)
1369 WRITE_NODE_TYPE("NULLTEST");
1371 WRITE_NODE_FIELD(arg);
1372 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
1373 WRITE_BOOL_FIELD(argisrow);
1374 WRITE_LOCATION_FIELD(location);
1378 _outBooleanTest(StringInfo str, const BooleanTest *node)
1380 WRITE_NODE_TYPE("BOOLEANTEST");
1382 WRITE_NODE_FIELD(arg);
1383 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
1384 WRITE_LOCATION_FIELD(location);
1388 _outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
1390 WRITE_NODE_TYPE("COERCETODOMAIN");
1392 WRITE_NODE_FIELD(arg);
1393 WRITE_OID_FIELD(resulttype);
1394 WRITE_INT_FIELD(resulttypmod);
1395 WRITE_OID_FIELD(resultcollid);
1396 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
1397 WRITE_LOCATION_FIELD(location);
1401 _outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
1403 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
1405 WRITE_OID_FIELD(typeId);
1406 WRITE_INT_FIELD(typeMod);
1407 WRITE_OID_FIELD(collation);
1408 WRITE_LOCATION_FIELD(location);
1412 _outSetToDefault(StringInfo str, const SetToDefault *node)
1414 WRITE_NODE_TYPE("SETTODEFAULT");
1416 WRITE_OID_FIELD(typeId);
1417 WRITE_INT_FIELD(typeMod);
1418 WRITE_OID_FIELD(collation);
1419 WRITE_LOCATION_FIELD(location);
1423 _outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
1425 WRITE_NODE_TYPE("CURRENTOFEXPR");
1427 WRITE_UINT_FIELD(cvarno);
1428 WRITE_STRING_FIELD(cursor_name);
1429 WRITE_INT_FIELD(cursor_param);
1433 _outTargetEntry(StringInfo str, const TargetEntry *node)
1435 WRITE_NODE_TYPE("TARGETENTRY");
1437 WRITE_NODE_FIELD(expr);
1438 WRITE_INT_FIELD(resno);
1439 WRITE_STRING_FIELD(resname);
1440 WRITE_UINT_FIELD(ressortgroupref);
1441 WRITE_OID_FIELD(resorigtbl);
1442 WRITE_INT_FIELD(resorigcol);
1443 WRITE_BOOL_FIELD(resjunk);
1447 _outRangeTblRef(StringInfo str, const RangeTblRef *node)
1449 WRITE_NODE_TYPE("RANGETBLREF");
1451 WRITE_INT_FIELD(rtindex);
1455 _outJoinExpr(StringInfo str, const JoinExpr *node)
1457 WRITE_NODE_TYPE("JOINEXPR");
1459 WRITE_ENUM_FIELD(jointype, JoinType);
1460 WRITE_BOOL_FIELD(isNatural);
1461 WRITE_NODE_FIELD(larg);
1462 WRITE_NODE_FIELD(rarg);
1463 WRITE_NODE_FIELD(usingClause);
1464 WRITE_NODE_FIELD(quals);
1465 WRITE_NODE_FIELD(alias);
1466 WRITE_INT_FIELD(rtindex);
1470 _outFromExpr(StringInfo str, const FromExpr *node)
1472 WRITE_NODE_TYPE("FROMEXPR");
1474 WRITE_NODE_FIELD(fromlist);
1475 WRITE_NODE_FIELD(quals);
1478 /*****************************************************************************
1480 * Stuff from relation.h.
1482 *****************************************************************************/
1485 * print the basic stuff of all nodes that inherit from Path
1487 * Note we do NOT print the parent, else we'd be in infinite recursion.
1488 * We can print the parent's relids for identification purposes, though.
1489 * We also do not print the whole of param_info, since it's printed by
1490 * _outRelOptInfo; it's sufficient and less cluttering to print just the
1491 * required outer relids.
1494 _outPathInfo(StringInfo str, const Path *node)
1496 WRITE_ENUM_FIELD(pathtype, NodeTag);
1497 appendStringInfoString(str, " :parent_relids ");
1499 _outBitmapset(str, node->parent->relids);
1501 _outBitmapset(str, NULL);
1502 appendStringInfoString(str, " :required_outer ");
1503 if (node->param_info)
1504 _outBitmapset(str, node->param_info->ppi_req_outer);
1506 _outBitmapset(str, NULL);
1507 WRITE_FLOAT_FIELD(rows, "%.0f");
1508 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1509 WRITE_FLOAT_FIELD(total_cost, "%.2f");
1510 WRITE_NODE_FIELD(pathkeys);
1514 * print the basic stuff of all nodes that inherit from JoinPath
1517 _outJoinPathInfo(StringInfo str, const JoinPath *node)
1519 _outPathInfo(str, (const Path *) node);
1521 WRITE_ENUM_FIELD(jointype, JoinType);
1522 WRITE_NODE_FIELD(outerjoinpath);
1523 WRITE_NODE_FIELD(innerjoinpath);
1524 WRITE_NODE_FIELD(joinrestrictinfo);
1528 _outPath(StringInfo str, const Path *node)
1530 WRITE_NODE_TYPE("PATH");
1532 _outPathInfo(str, (const Path *) node);
1536 _outIndexPath(StringInfo str, const IndexPath *node)
1538 WRITE_NODE_TYPE("INDEXPATH");
1540 _outPathInfo(str, (const Path *) node);
1542 WRITE_NODE_FIELD(indexinfo);
1543 WRITE_NODE_FIELD(indexclauses);
1544 WRITE_NODE_FIELD(indexquals);
1545 WRITE_NODE_FIELD(indexqualcols);
1546 WRITE_NODE_FIELD(indexorderbys);
1547 WRITE_NODE_FIELD(indexorderbycols);
1548 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1549 WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1550 WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1554 _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
1556 WRITE_NODE_TYPE("BITMAPHEAPPATH");
1558 _outPathInfo(str, (const Path *) node);
1560 WRITE_NODE_FIELD(bitmapqual);
1564 _outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
1566 WRITE_NODE_TYPE("BITMAPANDPATH");
1568 _outPathInfo(str, (const Path *) node);
1570 WRITE_NODE_FIELD(bitmapquals);
1571 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1575 _outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
1577 WRITE_NODE_TYPE("BITMAPORPATH");
1579 _outPathInfo(str, (const Path *) node);
1581 WRITE_NODE_FIELD(bitmapquals);
1582 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1586 _outTidPath(StringInfo str, const TidPath *node)
1588 WRITE_NODE_TYPE("TIDPATH");
1590 _outPathInfo(str, (const Path *) node);
1592 WRITE_NODE_FIELD(tidquals);
1596 _outForeignPath(StringInfo str, const ForeignPath *node)
1598 WRITE_NODE_TYPE("FOREIGNPATH");
1600 _outPathInfo(str, (const Path *) node);
1602 WRITE_NODE_FIELD(fdw_private);
1606 _outCustomPath(StringInfo str, const CustomPath *node)
1608 WRITE_NODE_TYPE("CUSTOMPATH");
1610 _outPathInfo(str, (const Path *) node);
1612 WRITE_UINT_FIELD(flags);
1613 WRITE_NODE_FIELD(custom_private);
1614 appendStringInfoString(str, " :methods ");
1615 _outToken(str, node->methods->CustomName);
1616 if (node->methods->TextOutCustomPath)
1617 node->methods->TextOutCustomPath(str, node);
1621 _outAppendPath(StringInfo str, const AppendPath *node)
1623 WRITE_NODE_TYPE("APPENDPATH");
1625 _outPathInfo(str, (const Path *) node);
1627 WRITE_NODE_FIELD(subpaths);
1631 _outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
1633 WRITE_NODE_TYPE("MERGEAPPENDPATH");
1635 _outPathInfo(str, (const Path *) node);
1637 WRITE_NODE_FIELD(subpaths);
1638 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1642 _outResultPath(StringInfo str, const ResultPath *node)
1644 WRITE_NODE_TYPE("RESULTPATH");
1646 _outPathInfo(str, (const Path *) node);
1648 WRITE_NODE_FIELD(quals);
1652 _outMaterialPath(StringInfo str, const MaterialPath *node)
1654 WRITE_NODE_TYPE("MATERIALPATH");
1656 _outPathInfo(str, (const Path *) node);
1658 WRITE_NODE_FIELD(subpath);
1662 _outUniquePath(StringInfo str, const UniquePath *node)
1664 WRITE_NODE_TYPE("UNIQUEPATH");
1666 _outPathInfo(str, (const Path *) node);
1668 WRITE_NODE_FIELD(subpath);
1669 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1670 WRITE_NODE_FIELD(in_operators);
1671 WRITE_NODE_FIELD(uniq_exprs);
1675 _outNestPath(StringInfo str, const NestPath *node)
1677 WRITE_NODE_TYPE("NESTPATH");
1679 _outJoinPathInfo(str, (const JoinPath *) node);
1683 _outMergePath(StringInfo str, const MergePath *node)
1685 WRITE_NODE_TYPE("MERGEPATH");
1687 _outJoinPathInfo(str, (const JoinPath *) node);
1689 WRITE_NODE_FIELD(path_mergeclauses);
1690 WRITE_NODE_FIELD(outersortkeys);
1691 WRITE_NODE_FIELD(innersortkeys);
1692 WRITE_BOOL_FIELD(materialize_inner);
1696 _outHashPath(StringInfo str, const HashPath *node)
1698 WRITE_NODE_TYPE("HASHPATH");
1700 _outJoinPathInfo(str, (const JoinPath *) node);
1702 WRITE_NODE_FIELD(path_hashclauses);
1703 WRITE_INT_FIELD(num_batches);
1707 _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
1709 WRITE_NODE_TYPE("PLANNERGLOBAL");
1711 /* NB: this isn't a complete set of fields */
1712 WRITE_NODE_FIELD(subplans);
1713 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
1714 WRITE_NODE_FIELD(finalrtable);
1715 WRITE_NODE_FIELD(finalrowmarks);
1716 WRITE_NODE_FIELD(resultRelations);
1717 WRITE_NODE_FIELD(relationOids);
1718 WRITE_NODE_FIELD(invalItems);
1719 WRITE_INT_FIELD(nParamExec);
1720 WRITE_UINT_FIELD(lastPHId);
1721 WRITE_UINT_FIELD(lastRowMarkId);
1722 WRITE_BOOL_FIELD(transientPlan);
1723 WRITE_BOOL_FIELD(hasRowSecurity);
1727 _outPlannerInfo(StringInfo str, const PlannerInfo *node)
1729 WRITE_NODE_TYPE("PLANNERINFO");
1731 /* NB: this isn't a complete set of fields */
1732 WRITE_NODE_FIELD(parse);
1733 WRITE_NODE_FIELD(glob);
1734 WRITE_UINT_FIELD(query_level);
1735 WRITE_NODE_FIELD(plan_params);
1736 WRITE_BITMAPSET_FIELD(all_baserels);
1737 WRITE_BITMAPSET_FIELD(nullable_baserels);
1738 WRITE_NODE_FIELD(join_rel_list);
1739 WRITE_INT_FIELD(join_cur_level);
1740 WRITE_NODE_FIELD(init_plans);
1741 WRITE_NODE_FIELD(cte_plan_ids);
1742 WRITE_NODE_FIELD(multiexpr_params);
1743 WRITE_NODE_FIELD(eq_classes);
1744 WRITE_NODE_FIELD(canon_pathkeys);
1745 WRITE_NODE_FIELD(left_join_clauses);
1746 WRITE_NODE_FIELD(right_join_clauses);
1747 WRITE_NODE_FIELD(full_join_clauses);
1748 WRITE_NODE_FIELD(join_info_list);
1749 WRITE_NODE_FIELD(lateral_info_list);
1750 WRITE_NODE_FIELD(append_rel_list);
1751 WRITE_NODE_FIELD(rowMarks);
1752 WRITE_NODE_FIELD(placeholder_list);
1753 WRITE_NODE_FIELD(query_pathkeys);
1754 WRITE_NODE_FIELD(group_pathkeys);
1755 WRITE_NODE_FIELD(window_pathkeys);
1756 WRITE_NODE_FIELD(distinct_pathkeys);
1757 WRITE_NODE_FIELD(sort_pathkeys);
1758 WRITE_NODE_FIELD(minmax_aggs);
1759 WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
1760 WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
1761 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1762 WRITE_BOOL_FIELD(hasInheritedTarget);
1763 WRITE_BOOL_FIELD(hasJoinRTEs);
1764 WRITE_BOOL_FIELD(hasLateralRTEs);
1765 WRITE_BOOL_FIELD(hasHavingQual);
1766 WRITE_BOOL_FIELD(hasPseudoConstantQuals);
1767 WRITE_BOOL_FIELD(hasRecursion);
1768 WRITE_INT_FIELD(wt_param_id);
1769 WRITE_BITMAPSET_FIELD(curOuterRels);
1770 WRITE_NODE_FIELD(curOuterParams);
1774 _outRelOptInfo(StringInfo str, const RelOptInfo *node)
1776 WRITE_NODE_TYPE("RELOPTINFO");
1778 /* NB: this isn't a complete set of fields */
1779 WRITE_ENUM_FIELD(reloptkind, RelOptKind);
1780 WRITE_BITMAPSET_FIELD(relids);
1781 WRITE_FLOAT_FIELD(rows, "%.0f");
1782 WRITE_INT_FIELD(width);
1783 WRITE_BOOL_FIELD(consider_startup);
1784 WRITE_NODE_FIELD(reltargetlist);
1785 WRITE_NODE_FIELD(pathlist);
1786 WRITE_NODE_FIELD(ppilist);
1787 WRITE_NODE_FIELD(cheapest_startup_path);
1788 WRITE_NODE_FIELD(cheapest_total_path);
1789 WRITE_NODE_FIELD(cheapest_unique_path);
1790 WRITE_NODE_FIELD(cheapest_parameterized_paths);
1791 WRITE_UINT_FIELD(relid);
1792 WRITE_OID_FIELD(reltablespace);
1793 WRITE_ENUM_FIELD(rtekind, RTEKind);
1794 WRITE_INT_FIELD(min_attr);
1795 WRITE_INT_FIELD(max_attr);
1796 WRITE_NODE_FIELD(lateral_vars);
1797 WRITE_BITMAPSET_FIELD(lateral_relids);
1798 WRITE_BITMAPSET_FIELD(lateral_referencers);
1799 WRITE_NODE_FIELD(indexlist);
1800 WRITE_UINT_FIELD(pages);
1801 WRITE_FLOAT_FIELD(tuples, "%.0f");
1802 WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
1803 WRITE_NODE_FIELD(subplan);
1804 WRITE_NODE_FIELD(subroot);
1805 WRITE_NODE_FIELD(subplan_params);
1806 /* we don't try to print fdwroutine or fdw_private */
1807 WRITE_NODE_FIELD(baserestrictinfo);
1808 WRITE_NODE_FIELD(joininfo);
1809 WRITE_BOOL_FIELD(has_eclass_joins);
1813 _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
1815 WRITE_NODE_TYPE("INDEXOPTINFO");
1817 /* NB: this isn't a complete set of fields */
1818 WRITE_OID_FIELD(indexoid);
1819 /* Do NOT print rel field, else infinite recursion */
1820 WRITE_UINT_FIELD(pages);
1821 WRITE_FLOAT_FIELD(tuples, "%.0f");
1822 WRITE_INT_FIELD(tree_height);
1823 WRITE_INT_FIELD(ncolumns);
1824 /* array fields aren't really worth the trouble to print */
1825 WRITE_OID_FIELD(relam);
1826 /* indexprs is redundant since we print indextlist */
1827 WRITE_NODE_FIELD(indpred);
1828 WRITE_NODE_FIELD(indextlist);
1829 WRITE_BOOL_FIELD(predOK);
1830 WRITE_BOOL_FIELD(unique);
1831 WRITE_BOOL_FIELD(immediate);
1832 WRITE_BOOL_FIELD(hypothetical);
1833 /* we don't bother with fields copied from the pg_am entry */
1837 _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
1840 * To simplify reading, we just chase up to the topmost merged EC and
1841 * print that, without bothering to show the merge-ees separately.
1843 while (node->ec_merged)
1844 node = node->ec_merged;
1846 WRITE_NODE_TYPE("EQUIVALENCECLASS");
1848 WRITE_NODE_FIELD(ec_opfamilies);
1849 WRITE_OID_FIELD(ec_collation);
1850 WRITE_NODE_FIELD(ec_members);
1851 WRITE_NODE_FIELD(ec_sources);
1852 WRITE_NODE_FIELD(ec_derives);
1853 WRITE_BITMAPSET_FIELD(ec_relids);
1854 WRITE_BOOL_FIELD(ec_has_const);
1855 WRITE_BOOL_FIELD(ec_has_volatile);
1856 WRITE_BOOL_FIELD(ec_below_outer_join);
1857 WRITE_BOOL_FIELD(ec_broken);
1858 WRITE_UINT_FIELD(ec_sortref);
1862 _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
1864 WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
1866 WRITE_NODE_FIELD(em_expr);
1867 WRITE_BITMAPSET_FIELD(em_relids);
1868 WRITE_BITMAPSET_FIELD(em_nullable_relids);
1869 WRITE_BOOL_FIELD(em_is_const);
1870 WRITE_BOOL_FIELD(em_is_child);
1871 WRITE_OID_FIELD(em_datatype);
1875 _outPathKey(StringInfo str, const PathKey *node)
1877 WRITE_NODE_TYPE("PATHKEY");
1879 WRITE_NODE_FIELD(pk_eclass);
1880 WRITE_OID_FIELD(pk_opfamily);
1881 WRITE_INT_FIELD(pk_strategy);
1882 WRITE_BOOL_FIELD(pk_nulls_first);
1886 _outParamPathInfo(StringInfo str, const ParamPathInfo *node)
1888 WRITE_NODE_TYPE("PARAMPATHINFO");
1890 WRITE_BITMAPSET_FIELD(ppi_req_outer);
1891 WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
1892 WRITE_NODE_FIELD(ppi_clauses);
1896 _outRestrictInfo(StringInfo str, const RestrictInfo *node)
1898 WRITE_NODE_TYPE("RESTRICTINFO");
1900 /* NB: this isn't a complete set of fields */
1901 WRITE_NODE_FIELD(clause);
1902 WRITE_BOOL_FIELD(is_pushed_down);
1903 WRITE_BOOL_FIELD(outerjoin_delayed);
1904 WRITE_BOOL_FIELD(can_join);
1905 WRITE_BOOL_FIELD(pseudoconstant);
1906 WRITE_BITMAPSET_FIELD(clause_relids);
1907 WRITE_BITMAPSET_FIELD(required_relids);
1908 WRITE_BITMAPSET_FIELD(outer_relids);
1909 WRITE_BITMAPSET_FIELD(nullable_relids);
1910 WRITE_BITMAPSET_FIELD(left_relids);
1911 WRITE_BITMAPSET_FIELD(right_relids);
1912 WRITE_NODE_FIELD(orclause);
1913 /* don't write parent_ec, leads to infinite recursion in plan tree dump */
1914 WRITE_FLOAT_FIELD(norm_selec, "%.4f");
1915 WRITE_FLOAT_FIELD(outer_selec, "%.4f");
1916 WRITE_NODE_FIELD(mergeopfamilies);
1917 /* don't write left_ec, leads to infinite recursion in plan tree dump */
1918 /* don't write right_ec, leads to infinite recursion in plan tree dump */
1919 WRITE_NODE_FIELD(left_em);
1920 WRITE_NODE_FIELD(right_em);
1921 WRITE_BOOL_FIELD(outer_is_left);
1922 WRITE_OID_FIELD(hashjoinoperator);
1926 _outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node)
1928 WRITE_NODE_TYPE("PLACEHOLDERVAR");
1930 WRITE_NODE_FIELD(phexpr);
1931 WRITE_BITMAPSET_FIELD(phrels);
1932 WRITE_UINT_FIELD(phid);
1933 WRITE_UINT_FIELD(phlevelsup);
1937 _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
1939 WRITE_NODE_TYPE("SPECIALJOININFO");
1941 WRITE_BITMAPSET_FIELD(min_lefthand);
1942 WRITE_BITMAPSET_FIELD(min_righthand);
1943 WRITE_BITMAPSET_FIELD(syn_lefthand);
1944 WRITE_BITMAPSET_FIELD(syn_righthand);
1945 WRITE_ENUM_FIELD(jointype, JoinType);
1946 WRITE_BOOL_FIELD(lhs_strict);
1947 WRITE_BOOL_FIELD(delay_upper_joins);
1948 WRITE_NODE_FIELD(join_quals);
1952 _outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node)
1954 WRITE_NODE_TYPE("LATERALJOININFO");
1956 WRITE_BITMAPSET_FIELD(lateral_lhs);
1957 WRITE_BITMAPSET_FIELD(lateral_rhs);
1961 _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
1963 WRITE_NODE_TYPE("APPENDRELINFO");
1965 WRITE_UINT_FIELD(parent_relid);
1966 WRITE_UINT_FIELD(child_relid);
1967 WRITE_OID_FIELD(parent_reltype);
1968 WRITE_OID_FIELD(child_reltype);
1969 WRITE_NODE_FIELD(translated_vars);
1970 WRITE_OID_FIELD(parent_reloid);
1974 _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
1976 WRITE_NODE_TYPE("PLACEHOLDERINFO");
1978 WRITE_UINT_FIELD(phid);
1979 WRITE_NODE_FIELD(ph_var);
1980 WRITE_BITMAPSET_FIELD(ph_eval_at);
1981 WRITE_BITMAPSET_FIELD(ph_lateral);
1982 WRITE_BITMAPSET_FIELD(ph_needed);
1983 WRITE_INT_FIELD(ph_width);
1987 _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
1989 WRITE_NODE_TYPE("MINMAXAGGINFO");
1991 WRITE_OID_FIELD(aggfnoid);
1992 WRITE_OID_FIELD(aggsortop);
1993 WRITE_NODE_FIELD(target);
1994 /* We intentionally omit subroot --- too large, not interesting enough */
1995 WRITE_NODE_FIELD(path);
1996 WRITE_FLOAT_FIELD(pathcost, "%.2f");
1997 WRITE_NODE_FIELD(param);
2001 _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
2003 WRITE_NODE_TYPE("PLANNERPARAMITEM");
2005 WRITE_NODE_FIELD(item);
2006 WRITE_INT_FIELD(paramId);
2009 /*****************************************************************************
2011 * Stuff from parsenodes.h.
2013 *****************************************************************************/
2016 * print the basic stuff of all nodes that inherit from CreateStmt
2019 _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
2021 WRITE_NODE_FIELD(relation);
2022 WRITE_NODE_FIELD(tableElts);
2023 WRITE_NODE_FIELD(inhRelations);
2024 WRITE_NODE_FIELD(ofTypename);
2025 WRITE_NODE_FIELD(constraints);
2026 WRITE_NODE_FIELD(options);
2027 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
2028 WRITE_STRING_FIELD(tablespacename);
2029 WRITE_BOOL_FIELD(if_not_exists);
2033 _outCreateStmt(StringInfo str, const CreateStmt *node)
2035 WRITE_NODE_TYPE("CREATESTMT");
2037 _outCreateStmtInfo(str, (const CreateStmt *) node);
2041 _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
2043 WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
2045 _outCreateStmtInfo(str, (const CreateStmt *) node);
2047 WRITE_STRING_FIELD(servername);
2048 WRITE_NODE_FIELD(options);
2052 _outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
2054 WRITE_NODE_TYPE("IMPORTFOREIGNSCHEMASTMT");
2056 WRITE_STRING_FIELD(server_name);
2057 WRITE_STRING_FIELD(remote_schema);
2058 WRITE_STRING_FIELD(local_schema);
2059 WRITE_ENUM_FIELD(list_type, ImportForeignSchemaType);
2060 WRITE_NODE_FIELD(table_list);
2061 WRITE_NODE_FIELD(options);
2065 _outIndexStmt(StringInfo str, const IndexStmt *node)
2067 WRITE_NODE_TYPE("INDEXSTMT");
2069 WRITE_STRING_FIELD(idxname);
2070 WRITE_NODE_FIELD(relation);
2071 WRITE_STRING_FIELD(accessMethod);
2072 WRITE_STRING_FIELD(tableSpace);
2073 WRITE_NODE_FIELD(indexParams);
2074 WRITE_NODE_FIELD(options);
2075 WRITE_NODE_FIELD(whereClause);
2076 WRITE_NODE_FIELD(excludeOpNames);
2077 WRITE_STRING_FIELD(idxcomment);
2078 WRITE_OID_FIELD(indexOid);
2079 WRITE_OID_FIELD(oldNode);
2080 WRITE_BOOL_FIELD(unique);
2081 WRITE_BOOL_FIELD(primary);
2082 WRITE_BOOL_FIELD(isconstraint);
2083 WRITE_BOOL_FIELD(deferrable);
2084 WRITE_BOOL_FIELD(initdeferred);
2085 WRITE_BOOL_FIELD(transformed);
2086 WRITE_BOOL_FIELD(concurrent);
2087 WRITE_BOOL_FIELD(if_not_exists);
2091 _outNotifyStmt(StringInfo str, const NotifyStmt *node)
2093 WRITE_NODE_TYPE("NOTIFY");
2095 WRITE_STRING_FIELD(conditionname);
2096 WRITE_STRING_FIELD(payload);
2100 _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
2102 WRITE_NODE_TYPE("DECLARECURSOR");
2104 WRITE_STRING_FIELD(portalname);
2105 WRITE_INT_FIELD(options);
2106 WRITE_NODE_FIELD(query);
2110 _outSelectStmt(StringInfo str, const SelectStmt *node)
2112 WRITE_NODE_TYPE("SELECT");
2114 WRITE_NODE_FIELD(distinctClause);
2115 WRITE_NODE_FIELD(intoClause);
2116 WRITE_NODE_FIELD(targetList);
2117 WRITE_NODE_FIELD(fromClause);
2118 WRITE_NODE_FIELD(whereClause);
2119 WRITE_NODE_FIELD(groupClause);
2120 WRITE_NODE_FIELD(havingClause);
2121 WRITE_NODE_FIELD(windowClause);
2122 WRITE_NODE_FIELD(valuesLists);
2123 WRITE_NODE_FIELD(sortClause);
2124 WRITE_NODE_FIELD(limitOffset);
2125 WRITE_NODE_FIELD(limitCount);
2126 WRITE_NODE_FIELD(lockingClause);
2127 WRITE_NODE_FIELD(withClause);
2128 WRITE_ENUM_FIELD(op, SetOperation);
2129 WRITE_BOOL_FIELD(all);
2130 WRITE_NODE_FIELD(larg);
2131 WRITE_NODE_FIELD(rarg);
2135 _outFuncCall(StringInfo str, const FuncCall *node)
2137 WRITE_NODE_TYPE("FUNCCALL");
2139 WRITE_NODE_FIELD(funcname);
2140 WRITE_NODE_FIELD(args);
2141 WRITE_NODE_FIELD(agg_order);
2142 WRITE_NODE_FIELD(agg_filter);
2143 WRITE_BOOL_FIELD(agg_within_group);
2144 WRITE_BOOL_FIELD(agg_star);
2145 WRITE_BOOL_FIELD(agg_distinct);
2146 WRITE_BOOL_FIELD(func_variadic);
2147 WRITE_NODE_FIELD(over);
2148 WRITE_LOCATION_FIELD(location);
2152 _outDefElem(StringInfo str, const DefElem *node)
2154 WRITE_NODE_TYPE("DEFELEM");
2156 WRITE_STRING_FIELD(defnamespace);
2157 WRITE_STRING_FIELD(defname);
2158 WRITE_NODE_FIELD(arg);
2159 WRITE_ENUM_FIELD(defaction, DefElemAction);
2163 _outTableLikeClause(StringInfo str, const TableLikeClause *node)
2165 WRITE_NODE_TYPE("TABLELIKECLAUSE");
2167 WRITE_NODE_FIELD(relation);
2168 WRITE_UINT_FIELD(options);
2172 _outLockingClause(StringInfo str, const LockingClause *node)
2174 WRITE_NODE_TYPE("LOCKINGCLAUSE");
2176 WRITE_NODE_FIELD(lockedRels);
2177 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2178 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2182 _outXmlSerialize(StringInfo str, const XmlSerialize *node)
2184 WRITE_NODE_TYPE("XMLSERIALIZE");
2186 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
2187 WRITE_NODE_FIELD(expr);
2188 WRITE_NODE_FIELD(typeName);
2189 WRITE_LOCATION_FIELD(location);
2193 _outColumnDef(StringInfo str, const ColumnDef *node)
2195 WRITE_NODE_TYPE("COLUMNDEF");
2197 WRITE_STRING_FIELD(colname);
2198 WRITE_NODE_FIELD(typeName);
2199 WRITE_INT_FIELD(inhcount);
2200 WRITE_BOOL_FIELD(is_local);
2201 WRITE_BOOL_FIELD(is_not_null);
2202 WRITE_BOOL_FIELD(is_from_type);
2203 WRITE_CHAR_FIELD(storage);
2204 WRITE_NODE_FIELD(raw_default);
2205 WRITE_NODE_FIELD(cooked_default);
2206 WRITE_NODE_FIELD(collClause);
2207 WRITE_OID_FIELD(collOid);
2208 WRITE_NODE_FIELD(constraints);
2209 WRITE_NODE_FIELD(fdwoptions);
2210 WRITE_LOCATION_FIELD(location);
2214 _outTypeName(StringInfo str, const TypeName *node)
2216 WRITE_NODE_TYPE("TYPENAME");
2218 WRITE_NODE_FIELD(names);
2219 WRITE_OID_FIELD(typeOid);
2220 WRITE_BOOL_FIELD(setof);
2221 WRITE_BOOL_FIELD(pct_type);
2222 WRITE_NODE_FIELD(typmods);
2223 WRITE_INT_FIELD(typemod);
2224 WRITE_NODE_FIELD(arrayBounds);
2225 WRITE_LOCATION_FIELD(location);
2229 _outTypeCast(StringInfo str, const TypeCast *node)
2231 WRITE_NODE_TYPE("TYPECAST");
2233 WRITE_NODE_FIELD(arg);
2234 WRITE_NODE_FIELD(typeName);
2235 WRITE_LOCATION_FIELD(location);
2239 _outCollateClause(StringInfo str, const CollateClause *node)
2241 WRITE_NODE_TYPE("COLLATECLAUSE");
2243 WRITE_NODE_FIELD(arg);
2244 WRITE_NODE_FIELD(collname);
2245 WRITE_LOCATION_FIELD(location);
2249 _outIndexElem(StringInfo str, const IndexElem *node)
2251 WRITE_NODE_TYPE("INDEXELEM");
2253 WRITE_STRING_FIELD(name);
2254 WRITE_NODE_FIELD(expr);
2255 WRITE_STRING_FIELD(indexcolname);
2256 WRITE_NODE_FIELD(collation);
2257 WRITE_NODE_FIELD(opclass);
2258 WRITE_ENUM_FIELD(ordering, SortByDir);
2259 WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2263 _outQuery(StringInfo str, const Query *node)
2265 WRITE_NODE_TYPE("QUERY");
2267 WRITE_ENUM_FIELD(commandType, CmdType);
2268 WRITE_ENUM_FIELD(querySource, QuerySource);
2269 /* we intentionally do not print the queryId field */
2270 WRITE_BOOL_FIELD(canSetTag);
2273 * Hack to work around missing outfuncs routines for a lot of the
2274 * utility-statement node types. (The only one we actually *need* for
2275 * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2276 * for the meantime do this to avoid getting lots of warnings when running
2277 * with debug_print_parse on.
2279 if (node->utilityStmt)
2281 switch (nodeTag(node->utilityStmt))
2286 case T_DeclareCursorStmt:
2287 WRITE_NODE_FIELD(utilityStmt);
2290 appendStringInfoString(str, " :utilityStmt ?");
2295 appendStringInfoString(str, " :utilityStmt <>");
2297 WRITE_INT_FIELD(resultRelation);
2298 WRITE_BOOL_FIELD(hasAggs);
2299 WRITE_BOOL_FIELD(hasWindowFuncs);
2300 WRITE_BOOL_FIELD(hasSubLinks);
2301 WRITE_BOOL_FIELD(hasDistinctOn);
2302 WRITE_BOOL_FIELD(hasRecursive);
2303 WRITE_BOOL_FIELD(hasModifyingCTE);
2304 WRITE_BOOL_FIELD(hasForUpdate);
2305 WRITE_BOOL_FIELD(hasRowSecurity);
2306 WRITE_NODE_FIELD(cteList);
2307 WRITE_NODE_FIELD(rtable);
2308 WRITE_NODE_FIELD(jointree);
2309 WRITE_NODE_FIELD(targetList);
2310 WRITE_NODE_FIELD(withCheckOptions);
2311 WRITE_NODE_FIELD(returningList);
2312 WRITE_NODE_FIELD(groupClause);
2313 WRITE_NODE_FIELD(havingQual);
2314 WRITE_NODE_FIELD(windowClause);
2315 WRITE_NODE_FIELD(distinctClause);
2316 WRITE_NODE_FIELD(sortClause);
2317 WRITE_NODE_FIELD(limitOffset);
2318 WRITE_NODE_FIELD(limitCount);
2319 WRITE_NODE_FIELD(rowMarks);
2320 WRITE_NODE_FIELD(setOperations);
2321 WRITE_NODE_FIELD(constraintDeps);
2325 _outWithCheckOption(StringInfo str, const WithCheckOption *node)
2327 WRITE_NODE_TYPE("WITHCHECKOPTION");
2329 WRITE_STRING_FIELD(viewname);
2330 WRITE_NODE_FIELD(qual);
2331 WRITE_BOOL_FIELD(cascaded);
2335 _outSortGroupClause(StringInfo str, const SortGroupClause *node)
2337 WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2339 WRITE_UINT_FIELD(tleSortGroupRef);
2340 WRITE_OID_FIELD(eqop);
2341 WRITE_OID_FIELD(sortop);
2342 WRITE_BOOL_FIELD(nulls_first);
2343 WRITE_BOOL_FIELD(hashable);
2347 _outWindowClause(StringInfo str, const WindowClause *node)
2349 WRITE_NODE_TYPE("WINDOWCLAUSE");
2351 WRITE_STRING_FIELD(name);
2352 WRITE_STRING_FIELD(refname);
2353 WRITE_NODE_FIELD(partitionClause);
2354 WRITE_NODE_FIELD(orderClause);
2355 WRITE_INT_FIELD(frameOptions);
2356 WRITE_NODE_FIELD(startOffset);
2357 WRITE_NODE_FIELD(endOffset);
2358 WRITE_UINT_FIELD(winref);
2359 WRITE_BOOL_FIELD(copiedOrder);
2363 _outRowMarkClause(StringInfo str, const RowMarkClause *node)
2365 WRITE_NODE_TYPE("ROWMARKCLAUSE");
2367 WRITE_UINT_FIELD(rti);
2368 WRITE_ENUM_FIELD(strength, LockClauseStrength);
2369 WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2370 WRITE_BOOL_FIELD(pushedDown);
2374 _outWithClause(StringInfo str, const WithClause *node)
2376 WRITE_NODE_TYPE("WITHCLAUSE");
2378 WRITE_NODE_FIELD(ctes);
2379 WRITE_BOOL_FIELD(recursive);
2380 WRITE_LOCATION_FIELD(location);
2384 _outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
2386 WRITE_NODE_TYPE("COMMONTABLEEXPR");
2388 WRITE_STRING_FIELD(ctename);
2389 WRITE_NODE_FIELD(aliascolnames);
2390 WRITE_NODE_FIELD(ctequery);
2391 WRITE_LOCATION_FIELD(location);
2392 WRITE_BOOL_FIELD(cterecursive);
2393 WRITE_INT_FIELD(cterefcount);
2394 WRITE_NODE_FIELD(ctecolnames);
2395 WRITE_NODE_FIELD(ctecoltypes);
2396 WRITE_NODE_FIELD(ctecoltypmods);
2397 WRITE_NODE_FIELD(ctecolcollations);
2401 _outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
2403 WRITE_NODE_TYPE("SETOPERATIONSTMT");
2405 WRITE_ENUM_FIELD(op, SetOperation);
2406 WRITE_BOOL_FIELD(all);
2407 WRITE_NODE_FIELD(larg);
2408 WRITE_NODE_FIELD(rarg);
2409 WRITE_NODE_FIELD(colTypes);
2410 WRITE_NODE_FIELD(colTypmods);
2411 WRITE_NODE_FIELD(colCollations);
2412 WRITE_NODE_FIELD(groupClauses);
2416 _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
2418 WRITE_NODE_TYPE("RTE");
2420 /* put alias + eref first to make dump more legible */
2421 WRITE_NODE_FIELD(alias);
2422 WRITE_NODE_FIELD(eref);
2423 WRITE_ENUM_FIELD(rtekind, RTEKind);
2425 switch (node->rtekind)
2428 WRITE_OID_FIELD(relid);
2429 WRITE_CHAR_FIELD(relkind);
2432 WRITE_NODE_FIELD(subquery);
2433 WRITE_BOOL_FIELD(security_barrier);
2436 WRITE_ENUM_FIELD(jointype, JoinType);
2437 WRITE_NODE_FIELD(joinaliasvars);
2440 WRITE_NODE_FIELD(functions);
2441 WRITE_BOOL_FIELD(funcordinality);
2444 WRITE_NODE_FIELD(values_lists);
2445 WRITE_NODE_FIELD(values_collations);
2448 WRITE_STRING_FIELD(ctename);
2449 WRITE_UINT_FIELD(ctelevelsup);
2450 WRITE_BOOL_FIELD(self_reference);
2451 WRITE_NODE_FIELD(ctecoltypes);
2452 WRITE_NODE_FIELD(ctecoltypmods);
2453 WRITE_NODE_FIELD(ctecolcollations);
2456 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
2460 WRITE_BOOL_FIELD(lateral);
2461 WRITE_BOOL_FIELD(inh);
2462 WRITE_BOOL_FIELD(inFromCl);
2463 WRITE_UINT_FIELD(requiredPerms);
2464 WRITE_OID_FIELD(checkAsUser);
2465 WRITE_BITMAPSET_FIELD(selectedCols);
2466 WRITE_BITMAPSET_FIELD(modifiedCols);
2467 WRITE_NODE_FIELD(securityQuals);
2471 _outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
2473 WRITE_NODE_TYPE("RANGETBLFUNCTION");
2475 WRITE_NODE_FIELD(funcexpr);
2476 WRITE_INT_FIELD(funccolcount);
2477 WRITE_NODE_FIELD(funccolnames);
2478 WRITE_NODE_FIELD(funccoltypes);
2479 WRITE_NODE_FIELD(funccoltypmods);
2480 WRITE_NODE_FIELD(funccolcollations);
2481 WRITE_BITMAPSET_FIELD(funcparams);
2485 _outAExpr(StringInfo str, const A_Expr *node)
2487 WRITE_NODE_TYPE("AEXPR");
2492 appendStringInfoChar(str, ' ');
2493 WRITE_NODE_FIELD(name);
2496 appendStringInfoChar(str, ' ');
2497 WRITE_NODE_FIELD(name);
2498 appendStringInfoString(str, " ANY ");
2501 appendStringInfoChar(str, ' ');
2502 WRITE_NODE_FIELD(name);
2503 appendStringInfoString(str, " ALL ");
2505 case AEXPR_DISTINCT:
2506 appendStringInfoString(str, " DISTINCT ");
2507 WRITE_NODE_FIELD(name);
2510 appendStringInfoString(str, " NULLIF ");
2511 WRITE_NODE_FIELD(name);
2514 appendStringInfoString(str, " OF ");
2515 WRITE_NODE_FIELD(name);
2518 appendStringInfoString(str, " IN ");
2519 WRITE_NODE_FIELD(name);
2522 appendStringInfoString(str, " LIKE ");
2523 WRITE_NODE_FIELD(name);
2526 appendStringInfoString(str, " ILIKE ");
2527 WRITE_NODE_FIELD(name);
2530 appendStringInfoString(str, " SIMILAR ");
2531 WRITE_NODE_FIELD(name);
2534 appendStringInfoString(str, " BETWEEN ");
2535 WRITE_NODE_FIELD(name);
2537 case AEXPR_NOT_BETWEEN:
2538 appendStringInfoString(str, " NOT_BETWEEN ");
2539 WRITE_NODE_FIELD(name);
2541 case AEXPR_BETWEEN_SYM:
2542 appendStringInfoString(str, " BETWEEN_SYM ");
2543 WRITE_NODE_FIELD(name);
2545 case AEXPR_NOT_BETWEEN_SYM:
2546 appendStringInfoString(str, " NOT_BETWEEN_SYM ");
2547 WRITE_NODE_FIELD(name);
2550 appendStringInfoString(str, " PAREN");
2553 appendStringInfoString(str, " ??");
2557 WRITE_NODE_FIELD(lexpr);
2558 WRITE_NODE_FIELD(rexpr);
2559 WRITE_LOCATION_FIELD(location);
2563 _outValue(StringInfo str, const Value *value)
2565 switch (value->type)
2568 appendStringInfo(str, "%ld", value->val.ival);
2573 * We assume the value is a valid numeric literal and so does not
2576 appendStringInfoString(str, value->val.str);
2581 * We use _outToken to provide escaping of the string's content,
2582 * but we don't want it to do anything with an empty string.
2584 appendStringInfoChar(str, '"');
2585 if (value->val.str[0] != '\0')
2586 _outToken(str, value->val.str);
2587 appendStringInfoChar(str, '"');
2590 /* internal representation already has leading 'b' */
2591 appendStringInfoString(str, value->val.str);
2594 /* this is seen only within A_Const, not in transformed trees */
2595 appendStringInfoString(str, "NULL");
2598 elog(ERROR, "unrecognized node type: %d", (int) value->type);
2604 _outColumnRef(StringInfo str, const ColumnRef *node)
2606 WRITE_NODE_TYPE("COLUMNREF");
2608 WRITE_NODE_FIELD(fields);
2609 WRITE_LOCATION_FIELD(location);
2613 _outParamRef(StringInfo str, const ParamRef *node)
2615 WRITE_NODE_TYPE("PARAMREF");
2617 WRITE_INT_FIELD(number);
2618 WRITE_LOCATION_FIELD(location);
2622 _outAConst(StringInfo str, const A_Const *node)
2624 WRITE_NODE_TYPE("A_CONST");
2626 appendStringInfoString(str, " :val ");
2627 _outValue(str, &(node->val));
2628 WRITE_LOCATION_FIELD(location);
2632 _outA_Star(StringInfo str, const A_Star *node)
2634 WRITE_NODE_TYPE("A_STAR");
2638 _outA_Indices(StringInfo str, const A_Indices *node)
2640 WRITE_NODE_TYPE("A_INDICES");
2642 WRITE_NODE_FIELD(lidx);
2643 WRITE_NODE_FIELD(uidx);
2647 _outA_Indirection(StringInfo str, const A_Indirection *node)
2649 WRITE_NODE_TYPE("A_INDIRECTION");
2651 WRITE_NODE_FIELD(arg);
2652 WRITE_NODE_FIELD(indirection);
2656 _outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
2658 WRITE_NODE_TYPE("A_ARRAYEXPR");
2660 WRITE_NODE_FIELD(elements);
2661 WRITE_LOCATION_FIELD(location);
2665 _outResTarget(StringInfo str, const ResTarget *node)
2667 WRITE_NODE_TYPE("RESTARGET");
2669 WRITE_STRING_FIELD(name);
2670 WRITE_NODE_FIELD(indirection);
2671 WRITE_NODE_FIELD(val);
2672 WRITE_LOCATION_FIELD(location);
2676 _outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
2678 WRITE_NODE_TYPE("MULTIASSIGNREF");
2680 WRITE_NODE_FIELD(source);
2681 WRITE_INT_FIELD(colno);
2682 WRITE_INT_FIELD(ncolumns);
2686 _outSortBy(StringInfo str, const SortBy *node)
2688 WRITE_NODE_TYPE("SORTBY");
2690 WRITE_NODE_FIELD(node);
2691 WRITE_ENUM_FIELD(sortby_dir, SortByDir);
2692 WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
2693 WRITE_NODE_FIELD(useOp);
2694 WRITE_LOCATION_FIELD(location);
2698 _outWindowDef(StringInfo str, const WindowDef *node)
2700 WRITE_NODE_TYPE("WINDOWDEF");
2702 WRITE_STRING_FIELD(name);
2703 WRITE_STRING_FIELD(refname);
2704 WRITE_NODE_FIELD(partitionClause);
2705 WRITE_NODE_FIELD(orderClause);
2706 WRITE_INT_FIELD(frameOptions);
2707 WRITE_NODE_FIELD(startOffset);
2708 WRITE_NODE_FIELD(endOffset);
2709 WRITE_LOCATION_FIELD(location);
2713 _outRangeSubselect(StringInfo str, const RangeSubselect *node)
2715 WRITE_NODE_TYPE("RANGESUBSELECT");
2717 WRITE_BOOL_FIELD(lateral);
2718 WRITE_NODE_FIELD(subquery);
2719 WRITE_NODE_FIELD(alias);
2723 _outRangeFunction(StringInfo str, const RangeFunction *node)
2725 WRITE_NODE_TYPE("RANGEFUNCTION");
2727 WRITE_BOOL_FIELD(lateral);
2728 WRITE_BOOL_FIELD(ordinality);
2729 WRITE_BOOL_FIELD(is_rowsfrom);
2730 WRITE_NODE_FIELD(functions);
2731 WRITE_NODE_FIELD(alias);
2732 WRITE_NODE_FIELD(coldeflist);
2736 _outConstraint(StringInfo str, const Constraint *node)
2738 WRITE_NODE_TYPE("CONSTRAINT");
2740 WRITE_STRING_FIELD(conname);
2741 WRITE_BOOL_FIELD(deferrable);
2742 WRITE_BOOL_FIELD(initdeferred);
2743 WRITE_LOCATION_FIELD(location);
2745 appendStringInfoString(str, " :contype ");
2746 switch (node->contype)
2749 appendStringInfoString(str, "NULL");
2752 case CONSTR_NOTNULL:
2753 appendStringInfoString(str, "NOT_NULL");
2756 case CONSTR_DEFAULT:
2757 appendStringInfoString(str, "DEFAULT");
2758 WRITE_NODE_FIELD(raw_expr);
2759 WRITE_STRING_FIELD(cooked_expr);
2763 appendStringInfoString(str, "CHECK");
2764 WRITE_BOOL_FIELD(is_no_inherit);
2765 WRITE_NODE_FIELD(raw_expr);
2766 WRITE_STRING_FIELD(cooked_expr);
2769 case CONSTR_PRIMARY:
2770 appendStringInfoString(str, "PRIMARY_KEY");
2771 WRITE_NODE_FIELD(keys);
2772 WRITE_NODE_FIELD(options);
2773 WRITE_STRING_FIELD(indexname);
2774 WRITE_STRING_FIELD(indexspace);
2775 /* access_method and where_clause not currently used */
2779 appendStringInfoString(str, "UNIQUE");
2780 WRITE_NODE_FIELD(keys);
2781 WRITE_NODE_FIELD(options);
2782 WRITE_STRING_FIELD(indexname);
2783 WRITE_STRING_FIELD(indexspace);
2784 /* access_method and where_clause not currently used */
2787 case CONSTR_EXCLUSION:
2788 appendStringInfoString(str, "EXCLUSION");
2789 WRITE_NODE_FIELD(exclusions);
2790 WRITE_NODE_FIELD(options);
2791 WRITE_STRING_FIELD(indexname);
2792 WRITE_STRING_FIELD(indexspace);
2793 WRITE_STRING_FIELD(access_method);
2794 WRITE_NODE_FIELD(where_clause);
2797 case CONSTR_FOREIGN:
2798 appendStringInfoString(str, "FOREIGN_KEY");
2799 WRITE_NODE_FIELD(pktable);
2800 WRITE_NODE_FIELD(fk_attrs);
2801 WRITE_NODE_FIELD(pk_attrs);
2802 WRITE_CHAR_FIELD(fk_matchtype);
2803 WRITE_CHAR_FIELD(fk_upd_action);
2804 WRITE_CHAR_FIELD(fk_del_action);
2805 WRITE_NODE_FIELD(old_conpfeqop);
2806 WRITE_OID_FIELD(old_pktable_oid);
2807 WRITE_BOOL_FIELD(skip_validation);
2808 WRITE_BOOL_FIELD(initially_valid);
2811 case CONSTR_ATTR_DEFERRABLE:
2812 appendStringInfoString(str, "ATTR_DEFERRABLE");
2815 case CONSTR_ATTR_NOT_DEFERRABLE:
2816 appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
2819 case CONSTR_ATTR_DEFERRED:
2820 appendStringInfoString(str, "ATTR_DEFERRED");
2823 case CONSTR_ATTR_IMMEDIATE:
2824 appendStringInfoString(str, "ATTR_IMMEDIATE");
2828 appendStringInfo(str, "<unrecognized_constraint %d>",
2829 (int) node->contype);
2837 * converts a Node into ascii string and append it to 'str'
2840 _outNode(StringInfo str, const void *obj)
2843 appendStringInfoString(str, "<>");
2844 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
2846 else if (IsA(obj, Integer) ||
2849 IsA(obj, BitString))
2851 /* nodeRead does not want to see { } around these! */
2852 _outValue(str, obj);
2856 appendStringInfoChar(str, '{');
2857 switch (nodeTag(obj))
2860 _outPlannedStmt(str, obj);
2866 _outResult(str, obj);
2869 _outModifyTable(str, obj);
2872 _outAppend(str, obj);
2875 _outMergeAppend(str, obj);
2877 case T_RecursiveUnion:
2878 _outRecursiveUnion(str, obj);
2881 _outBitmapAnd(str, obj);
2884 _outBitmapOr(str, obj);
2890 _outSeqScan(str, obj);
2893 _outIndexScan(str, obj);
2895 case T_IndexOnlyScan:
2896 _outIndexOnlyScan(str, obj);
2898 case T_BitmapIndexScan:
2899 _outBitmapIndexScan(str, obj);
2901 case T_BitmapHeapScan:
2902 _outBitmapHeapScan(str, obj);
2905 _outTidScan(str, obj);
2907 case T_SubqueryScan:
2908 _outSubqueryScan(str, obj);
2910 case T_FunctionScan:
2911 _outFunctionScan(str, obj);
2914 _outValuesScan(str, obj);
2917 _outCteScan(str, obj);
2919 case T_WorkTableScan:
2920 _outWorkTableScan(str, obj);
2923 _outForeignScan(str, obj);
2926 _outCustomScan(str, obj);
2932 _outNestLoop(str, obj);
2935 _outMergeJoin(str, obj);
2938 _outHashJoin(str, obj);
2944 _outWindowAgg(str, obj);
2947 _outGroup(str, obj);
2950 _outMaterial(str, obj);
2956 _outUnique(str, obj);
2962 _outSetOp(str, obj);
2965 _outLockRows(str, obj);
2968 _outLimit(str, obj);
2970 case T_NestLoopParam:
2971 _outNestLoopParam(str, obj);
2974 _outPlanRowMark(str, obj);
2976 case T_PlanInvalItem:
2977 _outPlanInvalItem(str, obj);
2980 _outAlias(str, obj);
2983 _outRangeVar(str, obj);
2986 _outIntoClause(str, obj);
2992 _outConst(str, obj);
2995 _outParam(str, obj);
2998 _outAggref(str, obj);
3001 _outWindowFunc(str, obj);
3004 _outArrayRef(str, obj);
3007 _outFuncExpr(str, obj);
3009 case T_NamedArgExpr:
3010 _outNamedArgExpr(str, obj);
3013 _outOpExpr(str, obj);
3015 case T_DistinctExpr:
3016 _outDistinctExpr(str, obj);
3019 _outNullIfExpr(str, obj);
3021 case T_ScalarArrayOpExpr:
3022 _outScalarArrayOpExpr(str, obj);
3025 _outBoolExpr(str, obj);
3028 _outSubLink(str, obj);
3031 _outSubPlan(str, obj);
3033 case T_AlternativeSubPlan:
3034 _outAlternativeSubPlan(str, obj);
3037 _outFieldSelect(str, obj);
3040 _outFieldStore(str, obj);
3043 _outRelabelType(str, obj);
3046 _outCoerceViaIO(str, obj);
3048 case T_ArrayCoerceExpr:
3049 _outArrayCoerceExpr(str, obj);
3051 case T_ConvertRowtypeExpr:
3052 _outConvertRowtypeExpr(str, obj);
3055 _outCollateExpr(str, obj);
3058 _outCaseExpr(str, obj);
3061 _outCaseWhen(str, obj);
3063 case T_CaseTestExpr:
3064 _outCaseTestExpr(str, obj);
3067 _outArrayExpr(str, obj);
3070 _outRowExpr(str, obj);
3072 case T_RowCompareExpr:
3073 _outRowCompareExpr(str, obj);
3075 case T_CoalesceExpr:
3076 _outCoalesceExpr(str, obj);
3079 _outMinMaxExpr(str, obj);
3082 _outXmlExpr(str, obj);
3085 _outNullTest(str, obj);
3088 _outBooleanTest(str, obj);
3090 case T_CoerceToDomain:
3091 _outCoerceToDomain(str, obj);
3093 case T_CoerceToDomainValue:
3094 _outCoerceToDomainValue(str, obj);
3096 case T_SetToDefault:
3097 _outSetToDefault(str, obj);
3099 case T_CurrentOfExpr:
3100 _outCurrentOfExpr(str, obj);
3103 _outTargetEntry(str, obj);
3106 _outRangeTblRef(str, obj);
3109 _outJoinExpr(str, obj);
3112 _outFromExpr(str, obj);
3119 _outIndexPath(str, obj);
3121 case T_BitmapHeapPath:
3122 _outBitmapHeapPath(str, obj);
3124 case T_BitmapAndPath:
3125 _outBitmapAndPath(str, obj);
3127 case T_BitmapOrPath:
3128 _outBitmapOrPath(str, obj);
3131 _outTidPath(str, obj);
3134 _outForeignPath(str, obj);
3137 _outCustomPath(str, obj);
3140 _outAppendPath(str, obj);
3142 case T_MergeAppendPath:
3143 _outMergeAppendPath(str, obj);
3146 _outResultPath(str, obj);
3148 case T_MaterialPath:
3149 _outMaterialPath(str, obj);
3152 _outUniquePath(str, obj);
3155 _outNestPath(str, obj);
3158 _outMergePath(str, obj);
3161 _outHashPath(str, obj);
3163 case T_PlannerGlobal:
3164 _outPlannerGlobal(str, obj);
3167 _outPlannerInfo(str, obj);
3170 _outRelOptInfo(str, obj);
3172 case T_IndexOptInfo:
3173 _outIndexOptInfo(str, obj);
3175 case T_EquivalenceClass:
3176 _outEquivalenceClass(str, obj);
3178 case T_EquivalenceMember:
3179 _outEquivalenceMember(str, obj);
3182 _outPathKey(str, obj);
3184 case T_ParamPathInfo:
3185 _outParamPathInfo(str, obj);
3187 case T_RestrictInfo:
3188 _outRestrictInfo(str, obj);
3190 case T_PlaceHolderVar:
3191 _outPlaceHolderVar(str, obj);
3193 case T_SpecialJoinInfo:
3194 _outSpecialJoinInfo(str, obj);
3196 case T_LateralJoinInfo:
3197 _outLateralJoinInfo(str, obj);
3199 case T_AppendRelInfo:
3200 _outAppendRelInfo(str, obj);
3202 case T_PlaceHolderInfo:
3203 _outPlaceHolderInfo(str, obj);
3205 case T_MinMaxAggInfo:
3206 _outMinMaxAggInfo(str, obj);
3208 case T_PlannerParamItem:
3209 _outPlannerParamItem(str, obj);
3213 _outCreateStmt(str, obj);
3215 case T_CreateForeignTableStmt:
3216 _outCreateForeignTableStmt(str, obj);
3218 case T_ImportForeignSchemaStmt:
3219 _outImportForeignSchemaStmt(str, obj);
3222 _outIndexStmt(str, obj);
3225 _outNotifyStmt(str, obj);
3227 case T_DeclareCursorStmt:
3228 _outDeclareCursorStmt(str, obj);
3231 _outSelectStmt(str, obj);
3234 _outColumnDef(str, obj);
3237 _outTypeName(str, obj);
3240 _outTypeCast(str, obj);
3242 case T_CollateClause:
3243 _outCollateClause(str, obj);
3246 _outIndexElem(str, obj);
3249 _outQuery(str, obj);
3251 case T_WithCheckOption:
3252 _outWithCheckOption(str, obj);
3254 case T_SortGroupClause:
3255 _outSortGroupClause(str, obj);
3257 case T_WindowClause:
3258 _outWindowClause(str, obj);
3260 case T_RowMarkClause:
3261 _outRowMarkClause(str, obj);
3264 _outWithClause(str, obj);
3266 case T_CommonTableExpr:
3267 _outCommonTableExpr(str, obj);
3269 case T_SetOperationStmt:
3270 _outSetOperationStmt(str, obj);
3272 case T_RangeTblEntry:
3273 _outRangeTblEntry(str, obj);
3275 case T_RangeTblFunction:
3276 _outRangeTblFunction(str, obj);
3279 _outAExpr(str, obj);
3282 _outColumnRef(str, obj);
3285 _outParamRef(str, obj);
3288 _outAConst(str, obj);
3291 _outA_Star(str, obj);
3294 _outA_Indices(str, obj);
3296 case T_A_Indirection:
3297 _outA_Indirection(str, obj);
3300 _outA_ArrayExpr(str, obj);
3303 _outResTarget(str, obj);
3305 case T_MultiAssignRef:
3306 _outMultiAssignRef(str, obj);
3309 _outSortBy(str, obj);
3312 _outWindowDef(str, obj);
3314 case T_RangeSubselect:
3315 _outRangeSubselect(str, obj);
3317 case T_RangeFunction:
3318 _outRangeFunction(str, obj);
3321 _outConstraint(str, obj);
3324 _outFuncCall(str, obj);
3327 _outDefElem(str, obj);
3329 case T_TableLikeClause:
3330 _outTableLikeClause(str, obj);
3332 case T_LockingClause:
3333 _outLockingClause(str, obj);
3335 case T_XmlSerialize:
3336 _outXmlSerialize(str, obj);
3342 * This should be an ERROR, but it's too useful to be able to
3343 * dump structures that _outNode only understands part of.
3345 elog(WARNING, "could not dump unrecognized node type: %d",
3346 (int) nodeTag(obj));
3349 appendStringInfoChar(str, '}');
3355 * returns the ascii representation of the Node as a palloc'd string
3358 nodeToString(const void *obj)
3362 /* see stringinfo.h for an explanation of this maneuver */
3363 initStringInfo(&str);
3364 _outNode(&str, obj);