1 /*-------------------------------------------------------------------------
4 * Output functions for Postgres tree nodes.
6 * Portions Copyright (c) 1996-2012, 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 appendStringInfo(str, "<>");
119 * Look for characters or patterns that are treated specially by read.c
120 * (either in pg_strtok() or in nodeRead()), and therefore need a
121 * protective backslash.
123 /* These characters only need to be quoted at the start of the string */
126 isdigit((unsigned char) *s) ||
127 ((*s == '+' || *s == '-') &&
128 (isdigit((unsigned char) s[1]) || s[1] == '.')))
129 appendStringInfoChar(str, '\\');
132 /* These chars must be backslashed anywhere in the string */
133 if (*s == ' ' || *s == '\n' || *s == '\t' ||
134 *s == '(' || *s == ')' || *s == '{' || *s == '}' ||
136 appendStringInfoChar(str, '\\');
137 appendStringInfoChar(str, *s++);
142 _outList(StringInfo str, const List *node)
146 appendStringInfoChar(str, '(');
148 if (IsA(node, IntList))
149 appendStringInfoChar(str, 'i');
150 else if (IsA(node, OidList))
151 appendStringInfoChar(str, 'o');
156 * For the sake of backward compatibility, we emit a slightly
157 * different whitespace format for lists of nodes vs. other types of
158 * lists. XXX: is this necessary?
162 _outNode(str, lfirst(lc));
164 appendStringInfoChar(str, ' ');
166 else if (IsA(node, IntList))
167 appendStringInfo(str, " %d", lfirst_int(lc));
168 else if (IsA(node, OidList))
169 appendStringInfo(str, " %u", lfirst_oid(lc));
171 elog(ERROR, "unrecognized list node type: %d",
175 appendStringInfoChar(str, ')');
180 * converts a bitmap set of integers
182 * Note: the output format is "(b int int ...)", similar to an integer List.
185 _outBitmapset(StringInfo str, const Bitmapset *bms)
190 appendStringInfoChar(str, '(');
191 appendStringInfoChar(str, 'b');
192 tmpset = bms_copy(bms);
193 while ((x = bms_first_member(tmpset)) >= 0)
194 appendStringInfo(str, " %d", x);
196 appendStringInfoChar(str, ')');
200 * Print the value of a Datum given its type.
203 _outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
209 length = datumGetSize(value, typbyval, typlen);
213 s = (char *) (&value);
214 appendStringInfo(str, "%u [ ", (unsigned int) length);
215 for (i = 0; i < (Size) sizeof(Datum); i++)
216 appendStringInfo(str, "%d ", (int) (s[i]));
217 appendStringInfo(str, "]");
221 s = (char *) DatumGetPointer(value);
222 if (!PointerIsValid(s))
223 appendStringInfo(str, "0 [ ]");
226 appendStringInfo(str, "%u [ ", (unsigned int) length);
227 for (i = 0; i < length; i++)
228 appendStringInfo(str, "%d ", (int) (s[i]));
229 appendStringInfo(str, "]");
236 * Stuff from plannodes.h
240 _outPlannedStmt(StringInfo str, const PlannedStmt *node)
242 WRITE_NODE_TYPE("PLANNEDSTMT");
244 WRITE_ENUM_FIELD(commandType, CmdType);
245 WRITE_UINT_FIELD(queryId);
246 WRITE_BOOL_FIELD(hasReturning);
247 WRITE_BOOL_FIELD(hasModifyingCTE);
248 WRITE_BOOL_FIELD(canSetTag);
249 WRITE_BOOL_FIELD(transientPlan);
250 WRITE_NODE_FIELD(planTree);
251 WRITE_NODE_FIELD(rtable);
252 WRITE_NODE_FIELD(resultRelations);
253 WRITE_NODE_FIELD(utilityStmt);
254 WRITE_NODE_FIELD(subplans);
255 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
256 WRITE_NODE_FIELD(rowMarks);
257 WRITE_NODE_FIELD(relationOids);
258 WRITE_NODE_FIELD(invalItems);
259 WRITE_INT_FIELD(nParamExec);
263 * print the basic stuff of all nodes that inherit from Plan
266 _outPlanInfo(StringInfo str, const Plan *node)
268 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
269 WRITE_FLOAT_FIELD(total_cost, "%.2f");
270 WRITE_FLOAT_FIELD(plan_rows, "%.0f");
271 WRITE_INT_FIELD(plan_width);
272 WRITE_NODE_FIELD(targetlist);
273 WRITE_NODE_FIELD(qual);
274 WRITE_NODE_FIELD(lefttree);
275 WRITE_NODE_FIELD(righttree);
276 WRITE_NODE_FIELD(initPlan);
277 WRITE_BITMAPSET_FIELD(extParam);
278 WRITE_BITMAPSET_FIELD(allParam);
282 * print the basic stuff of all nodes that inherit from Scan
285 _outScanInfo(StringInfo str, const Scan *node)
287 _outPlanInfo(str, (const Plan *) node);
289 WRITE_UINT_FIELD(scanrelid);
293 * print the basic stuff of all nodes that inherit from Join
296 _outJoinPlanInfo(StringInfo str, const Join *node)
298 _outPlanInfo(str, (const Plan *) node);
300 WRITE_ENUM_FIELD(jointype, JoinType);
301 WRITE_NODE_FIELD(joinqual);
306 _outPlan(StringInfo str, const Plan *node)
308 WRITE_NODE_TYPE("PLAN");
310 _outPlanInfo(str, (const Plan *) node);
314 _outResult(StringInfo str, const Result *node)
316 WRITE_NODE_TYPE("RESULT");
318 _outPlanInfo(str, (const Plan *) node);
320 WRITE_NODE_FIELD(resconstantqual);
324 _outModifyTable(StringInfo str, const ModifyTable *node)
326 WRITE_NODE_TYPE("MODIFYTABLE");
328 _outPlanInfo(str, (const Plan *) node);
330 WRITE_ENUM_FIELD(operation, CmdType);
331 WRITE_BOOL_FIELD(canSetTag);
332 WRITE_NODE_FIELD(resultRelations);
333 WRITE_INT_FIELD(resultRelIndex);
334 WRITE_NODE_FIELD(plans);
335 WRITE_NODE_FIELD(returningLists);
336 WRITE_NODE_FIELD(rowMarks);
337 WRITE_INT_FIELD(epqParam);
341 _outAppend(StringInfo str, const Append *node)
343 WRITE_NODE_TYPE("APPEND");
345 _outPlanInfo(str, (const Plan *) node);
347 WRITE_NODE_FIELD(appendplans);
351 _outMergeAppend(StringInfo str, const MergeAppend *node)
355 WRITE_NODE_TYPE("MERGEAPPEND");
357 _outPlanInfo(str, (const Plan *) node);
359 WRITE_NODE_FIELD(mergeplans);
361 WRITE_INT_FIELD(numCols);
363 appendStringInfo(str, " :sortColIdx");
364 for (i = 0; i < node->numCols; i++)
365 appendStringInfo(str, " %d", node->sortColIdx[i]);
367 appendStringInfo(str, " :sortOperators");
368 for (i = 0; i < node->numCols; i++)
369 appendStringInfo(str, " %u", node->sortOperators[i]);
371 appendStringInfo(str, " :collations");
372 for (i = 0; i < node->numCols; i++)
373 appendStringInfo(str, " %u", node->collations[i]);
375 appendStringInfo(str, " :nullsFirst");
376 for (i = 0; i < node->numCols; i++)
377 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
381 _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
385 WRITE_NODE_TYPE("RECURSIVEUNION");
387 _outPlanInfo(str, (const Plan *) node);
389 WRITE_INT_FIELD(wtParam);
390 WRITE_INT_FIELD(numCols);
392 appendStringInfo(str, " :dupColIdx");
393 for (i = 0; i < node->numCols; i++)
394 appendStringInfo(str, " %d", node->dupColIdx[i]);
396 appendStringInfo(str, " :dupOperators");
397 for (i = 0; i < node->numCols; i++)
398 appendStringInfo(str, " %u", node->dupOperators[i]);
400 WRITE_LONG_FIELD(numGroups);
404 _outBitmapAnd(StringInfo str, const BitmapAnd *node)
406 WRITE_NODE_TYPE("BITMAPAND");
408 _outPlanInfo(str, (const Plan *) node);
410 WRITE_NODE_FIELD(bitmapplans);
414 _outBitmapOr(StringInfo str, const BitmapOr *node)
416 WRITE_NODE_TYPE("BITMAPOR");
418 _outPlanInfo(str, (const Plan *) node);
420 WRITE_NODE_FIELD(bitmapplans);
424 _outScan(StringInfo str, const Scan *node)
426 WRITE_NODE_TYPE("SCAN");
428 _outScanInfo(str, node);
432 _outSeqScan(StringInfo str, const SeqScan *node)
434 WRITE_NODE_TYPE("SEQSCAN");
436 _outScanInfo(str, (const Scan *) node);
440 _outIndexScan(StringInfo str, const IndexScan *node)
442 WRITE_NODE_TYPE("INDEXSCAN");
444 _outScanInfo(str, (const Scan *) node);
446 WRITE_OID_FIELD(indexid);
447 WRITE_NODE_FIELD(indexqual);
448 WRITE_NODE_FIELD(indexqualorig);
449 WRITE_NODE_FIELD(indexorderby);
450 WRITE_NODE_FIELD(indexorderbyorig);
451 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
455 _outIndexOnlyScan(StringInfo str, const IndexOnlyScan *node)
457 WRITE_NODE_TYPE("INDEXONLYSCAN");
459 _outScanInfo(str, (const Scan *) node);
461 WRITE_OID_FIELD(indexid);
462 WRITE_NODE_FIELD(indexqual);
463 WRITE_NODE_FIELD(indexorderby);
464 WRITE_NODE_FIELD(indextlist);
465 WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
469 _outBitmapIndexScan(StringInfo str, const BitmapIndexScan *node)
471 WRITE_NODE_TYPE("BITMAPINDEXSCAN");
473 _outScanInfo(str, (const Scan *) node);
475 WRITE_OID_FIELD(indexid);
476 WRITE_NODE_FIELD(indexqual);
477 WRITE_NODE_FIELD(indexqualorig);
481 _outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
483 WRITE_NODE_TYPE("BITMAPHEAPSCAN");
485 _outScanInfo(str, (const Scan *) node);
487 WRITE_NODE_FIELD(bitmapqualorig);
491 _outTidScan(StringInfo str, const TidScan *node)
493 WRITE_NODE_TYPE("TIDSCAN");
495 _outScanInfo(str, (const Scan *) node);
497 WRITE_NODE_FIELD(tidquals);
501 _outSubqueryScan(StringInfo str, const SubqueryScan *node)
503 WRITE_NODE_TYPE("SUBQUERYSCAN");
505 _outScanInfo(str, (const Scan *) node);
507 WRITE_NODE_FIELD(subplan);
511 _outFunctionScan(StringInfo str, const FunctionScan *node)
513 WRITE_NODE_TYPE("FUNCTIONSCAN");
515 _outScanInfo(str, (const Scan *) node);
517 WRITE_NODE_FIELD(funcexpr);
518 WRITE_NODE_FIELD(funccolnames);
519 WRITE_NODE_FIELD(funccoltypes);
520 WRITE_NODE_FIELD(funccoltypmods);
521 WRITE_NODE_FIELD(funccolcollations);
525 _outValuesScan(StringInfo str, const ValuesScan *node)
527 WRITE_NODE_TYPE("VALUESSCAN");
529 _outScanInfo(str, (const Scan *) node);
531 WRITE_NODE_FIELD(values_lists);
535 _outCteScan(StringInfo str, const CteScan *node)
537 WRITE_NODE_TYPE("CTESCAN");
539 _outScanInfo(str, (const Scan *) node);
541 WRITE_INT_FIELD(ctePlanId);
542 WRITE_INT_FIELD(cteParam);
546 _outWorkTableScan(StringInfo str, const WorkTableScan *node)
548 WRITE_NODE_TYPE("WORKTABLESCAN");
550 _outScanInfo(str, (const Scan *) node);
552 WRITE_INT_FIELD(wtParam);
556 _outForeignScan(StringInfo str, const ForeignScan *node)
558 WRITE_NODE_TYPE("FOREIGNSCAN");
560 _outScanInfo(str, (const Scan *) node);
562 WRITE_NODE_FIELD(fdw_exprs);
563 WRITE_NODE_FIELD(fdw_private);
564 WRITE_BOOL_FIELD(fsSystemCol);
568 _outJoin(StringInfo str, const Join *node)
570 WRITE_NODE_TYPE("JOIN");
572 _outJoinPlanInfo(str, (const Join *) node);
576 _outNestLoop(StringInfo str, const NestLoop *node)
578 WRITE_NODE_TYPE("NESTLOOP");
580 _outJoinPlanInfo(str, (const Join *) node);
582 WRITE_NODE_FIELD(nestParams);
586 _outMergeJoin(StringInfo str, const MergeJoin *node)
591 WRITE_NODE_TYPE("MERGEJOIN");
593 _outJoinPlanInfo(str, (const Join *) node);
595 WRITE_NODE_FIELD(mergeclauses);
597 numCols = list_length(node->mergeclauses);
599 appendStringInfo(str, " :mergeFamilies");
600 for (i = 0; i < numCols; i++)
601 appendStringInfo(str, " %u", node->mergeFamilies[i]);
603 appendStringInfo(str, " :mergeCollations");
604 for (i = 0; i < numCols; i++)
605 appendStringInfo(str, " %u", node->mergeCollations[i]);
607 appendStringInfo(str, " :mergeStrategies");
608 for (i = 0; i < numCols; i++)
609 appendStringInfo(str, " %d", node->mergeStrategies[i]);
611 appendStringInfo(str, " :mergeNullsFirst");
612 for (i = 0; i < numCols; i++)
613 appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
617 _outHashJoin(StringInfo str, const HashJoin *node)
619 WRITE_NODE_TYPE("HASHJOIN");
621 _outJoinPlanInfo(str, (const Join *) node);
623 WRITE_NODE_FIELD(hashclauses);
627 _outAgg(StringInfo str, const Agg *node)
631 WRITE_NODE_TYPE("AGG");
633 _outPlanInfo(str, (const Plan *) node);
635 WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
636 WRITE_INT_FIELD(numCols);
638 appendStringInfo(str, " :grpColIdx");
639 for (i = 0; i < node->numCols; i++)
640 appendStringInfo(str, " %d", node->grpColIdx[i]);
642 appendStringInfo(str, " :grpOperators");
643 for (i = 0; i < node->numCols; i++)
644 appendStringInfo(str, " %u", node->grpOperators[i]);
646 WRITE_LONG_FIELD(numGroups);
650 _outWindowAgg(StringInfo str, const WindowAgg *node)
654 WRITE_NODE_TYPE("WINDOWAGG");
656 _outPlanInfo(str, (const Plan *) node);
658 WRITE_UINT_FIELD(winref);
659 WRITE_INT_FIELD(partNumCols);
661 appendStringInfo(str, " :partColIdx");
662 for (i = 0; i < node->partNumCols; i++)
663 appendStringInfo(str, " %d", node->partColIdx[i]);
665 appendStringInfo(str, " :partOperations");
666 for (i = 0; i < node->partNumCols; i++)
667 appendStringInfo(str, " %u", node->partOperators[i]);
669 WRITE_INT_FIELD(ordNumCols);
671 appendStringInfo(str, " :ordColIdx");
672 for (i = 0; i < node->ordNumCols; i++)
673 appendStringInfo(str, " %d", node->ordColIdx[i]);
675 appendStringInfo(str, " :ordOperations");
676 for (i = 0; i < node->ordNumCols; i++)
677 appendStringInfo(str, " %u", node->ordOperators[i]);
679 WRITE_INT_FIELD(frameOptions);
680 WRITE_NODE_FIELD(startOffset);
681 WRITE_NODE_FIELD(endOffset);
685 _outGroup(StringInfo str, const Group *node)
689 WRITE_NODE_TYPE("GROUP");
691 _outPlanInfo(str, (const Plan *) node);
693 WRITE_INT_FIELD(numCols);
695 appendStringInfo(str, " :grpColIdx");
696 for (i = 0; i < node->numCols; i++)
697 appendStringInfo(str, " %d", node->grpColIdx[i]);
699 appendStringInfo(str, " :grpOperators");
700 for (i = 0; i < node->numCols; i++)
701 appendStringInfo(str, " %u", node->grpOperators[i]);
705 _outMaterial(StringInfo str, const Material *node)
707 WRITE_NODE_TYPE("MATERIAL");
709 _outPlanInfo(str, (const Plan *) node);
713 _outSort(StringInfo str, const Sort *node)
717 WRITE_NODE_TYPE("SORT");
719 _outPlanInfo(str, (const Plan *) node);
721 WRITE_INT_FIELD(numCols);
723 appendStringInfo(str, " :sortColIdx");
724 for (i = 0; i < node->numCols; i++)
725 appendStringInfo(str, " %d", node->sortColIdx[i]);
727 appendStringInfo(str, " :sortOperators");
728 for (i = 0; i < node->numCols; i++)
729 appendStringInfo(str, " %u", node->sortOperators[i]);
731 appendStringInfo(str, " :collations");
732 for (i = 0; i < node->numCols; i++)
733 appendStringInfo(str, " %u", node->collations[i]);
735 appendStringInfo(str, " :nullsFirst");
736 for (i = 0; i < node->numCols; i++)
737 appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
741 _outUnique(StringInfo str, const Unique *node)
745 WRITE_NODE_TYPE("UNIQUE");
747 _outPlanInfo(str, (const Plan *) node);
749 WRITE_INT_FIELD(numCols);
751 appendStringInfo(str, " :uniqColIdx");
752 for (i = 0; i < node->numCols; i++)
753 appendStringInfo(str, " %d", node->uniqColIdx[i]);
755 appendStringInfo(str, " :uniqOperators");
756 for (i = 0; i < node->numCols; i++)
757 appendStringInfo(str, " %u", node->uniqOperators[i]);
761 _outHash(StringInfo str, const Hash *node)
763 WRITE_NODE_TYPE("HASH");
765 _outPlanInfo(str, (const Plan *) node);
767 WRITE_OID_FIELD(skewTable);
768 WRITE_INT_FIELD(skewColumn);
769 WRITE_BOOL_FIELD(skewInherit);
770 WRITE_OID_FIELD(skewColType);
771 WRITE_INT_FIELD(skewColTypmod);
775 _outSetOp(StringInfo str, const SetOp *node)
779 WRITE_NODE_TYPE("SETOP");
781 _outPlanInfo(str, (const Plan *) node);
783 WRITE_ENUM_FIELD(cmd, SetOpCmd);
784 WRITE_ENUM_FIELD(strategy, SetOpStrategy);
785 WRITE_INT_FIELD(numCols);
787 appendStringInfo(str, " :dupColIdx");
788 for (i = 0; i < node->numCols; i++)
789 appendStringInfo(str, " %d", node->dupColIdx[i]);
791 appendStringInfo(str, " :dupOperators");
792 for (i = 0; i < node->numCols; i++)
793 appendStringInfo(str, " %u", node->dupOperators[i]);
795 WRITE_INT_FIELD(flagColIdx);
796 WRITE_INT_FIELD(firstFlag);
797 WRITE_LONG_FIELD(numGroups);
801 _outLockRows(StringInfo str, const LockRows *node)
803 WRITE_NODE_TYPE("LOCKROWS");
805 _outPlanInfo(str, (const Plan *) node);
807 WRITE_NODE_FIELD(rowMarks);
808 WRITE_INT_FIELD(epqParam);
812 _outLimit(StringInfo str, const Limit *node)
814 WRITE_NODE_TYPE("LIMIT");
816 _outPlanInfo(str, (const Plan *) node);
818 WRITE_NODE_FIELD(limitOffset);
819 WRITE_NODE_FIELD(limitCount);
823 _outNestLoopParam(StringInfo str, const NestLoopParam *node)
825 WRITE_NODE_TYPE("NESTLOOPPARAM");
827 WRITE_INT_FIELD(paramno);
828 WRITE_NODE_FIELD(paramval);
832 _outPlanRowMark(StringInfo str, const PlanRowMark *node)
834 WRITE_NODE_TYPE("PLANROWMARK");
836 WRITE_UINT_FIELD(rti);
837 WRITE_UINT_FIELD(prti);
838 WRITE_UINT_FIELD(rowmarkId);
839 WRITE_ENUM_FIELD(markType, RowMarkType);
840 WRITE_BOOL_FIELD(noWait);
841 WRITE_BOOL_FIELD(isParent);
845 _outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
847 WRITE_NODE_TYPE("PLANINVALITEM");
849 WRITE_INT_FIELD(cacheId);
850 WRITE_UINT_FIELD(hashValue);
853 /*****************************************************************************
855 * Stuff from primnodes.h.
857 *****************************************************************************/
860 _outAlias(StringInfo str, const Alias *node)
862 WRITE_NODE_TYPE("ALIAS");
864 WRITE_STRING_FIELD(aliasname);
865 WRITE_NODE_FIELD(colnames);
869 _outRangeVar(StringInfo str, const RangeVar *node)
871 WRITE_NODE_TYPE("RANGEVAR");
874 * we deliberately ignore catalogname here, since it is presently not
875 * semantically meaningful
877 WRITE_STRING_FIELD(schemaname);
878 WRITE_STRING_FIELD(relname);
879 WRITE_ENUM_FIELD(inhOpt, InhOption);
880 WRITE_CHAR_FIELD(relpersistence);
881 WRITE_NODE_FIELD(alias);
882 WRITE_LOCATION_FIELD(location);
886 _outIntoClause(StringInfo str, const IntoClause *node)
888 WRITE_NODE_TYPE("INTOCLAUSE");
890 WRITE_NODE_FIELD(rel);
891 WRITE_NODE_FIELD(colNames);
892 WRITE_NODE_FIELD(options);
893 WRITE_ENUM_FIELD(onCommit, OnCommitAction);
894 WRITE_STRING_FIELD(tableSpaceName);
895 WRITE_BOOL_FIELD(skipData);
899 _outVar(StringInfo str, const Var *node)
901 WRITE_NODE_TYPE("VAR");
903 WRITE_UINT_FIELD(varno);
904 WRITE_INT_FIELD(varattno);
905 WRITE_OID_FIELD(vartype);
906 WRITE_INT_FIELD(vartypmod);
907 WRITE_OID_FIELD(varcollid);
908 WRITE_UINT_FIELD(varlevelsup);
909 WRITE_UINT_FIELD(varnoold);
910 WRITE_INT_FIELD(varoattno);
911 WRITE_LOCATION_FIELD(location);
915 _outConst(StringInfo str, const Const *node)
917 WRITE_NODE_TYPE("CONST");
919 WRITE_OID_FIELD(consttype);
920 WRITE_INT_FIELD(consttypmod);
921 WRITE_OID_FIELD(constcollid);
922 WRITE_INT_FIELD(constlen);
923 WRITE_BOOL_FIELD(constbyval);
924 WRITE_BOOL_FIELD(constisnull);
925 WRITE_LOCATION_FIELD(location);
927 appendStringInfo(str, " :constvalue ");
928 if (node->constisnull)
929 appendStringInfo(str, "<>");
931 _outDatum(str, node->constvalue, node->constlen, node->constbyval);
935 _outParam(StringInfo str, const Param *node)
937 WRITE_NODE_TYPE("PARAM");
939 WRITE_ENUM_FIELD(paramkind, ParamKind);
940 WRITE_INT_FIELD(paramid);
941 WRITE_OID_FIELD(paramtype);
942 WRITE_INT_FIELD(paramtypmod);
943 WRITE_OID_FIELD(paramcollid);
944 WRITE_LOCATION_FIELD(location);
948 _outAggref(StringInfo str, const Aggref *node)
950 WRITE_NODE_TYPE("AGGREF");
952 WRITE_OID_FIELD(aggfnoid);
953 WRITE_OID_FIELD(aggtype);
954 WRITE_OID_FIELD(aggcollid);
955 WRITE_OID_FIELD(inputcollid);
956 WRITE_NODE_FIELD(args);
957 WRITE_NODE_FIELD(aggorder);
958 WRITE_NODE_FIELD(aggdistinct);
959 WRITE_BOOL_FIELD(aggstar);
960 WRITE_UINT_FIELD(agglevelsup);
961 WRITE_LOCATION_FIELD(location);
965 _outWindowFunc(StringInfo str, const WindowFunc *node)
967 WRITE_NODE_TYPE("WINDOWFUNC");
969 WRITE_OID_FIELD(winfnoid);
970 WRITE_OID_FIELD(wintype);
971 WRITE_OID_FIELD(wincollid);
972 WRITE_OID_FIELD(inputcollid);
973 WRITE_NODE_FIELD(args);
974 WRITE_UINT_FIELD(winref);
975 WRITE_BOOL_FIELD(winstar);
976 WRITE_BOOL_FIELD(winagg);
977 WRITE_LOCATION_FIELD(location);
981 _outArrayRef(StringInfo str, const ArrayRef *node)
983 WRITE_NODE_TYPE("ARRAYREF");
985 WRITE_OID_FIELD(refarraytype);
986 WRITE_OID_FIELD(refelemtype);
987 WRITE_INT_FIELD(reftypmod);
988 WRITE_OID_FIELD(refcollid);
989 WRITE_NODE_FIELD(refupperindexpr);
990 WRITE_NODE_FIELD(reflowerindexpr);
991 WRITE_NODE_FIELD(refexpr);
992 WRITE_NODE_FIELD(refassgnexpr);
996 _outFuncExpr(StringInfo str, const FuncExpr *node)
998 WRITE_NODE_TYPE("FUNCEXPR");
1000 WRITE_OID_FIELD(funcid);
1001 WRITE_OID_FIELD(funcresulttype);
1002 WRITE_BOOL_FIELD(funcretset);
1003 WRITE_ENUM_FIELD(funcformat, CoercionForm);
1004 WRITE_OID_FIELD(funccollid);
1005 WRITE_OID_FIELD(inputcollid);
1006 WRITE_NODE_FIELD(args);
1007 WRITE_LOCATION_FIELD(location);
1011 _outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
1013 WRITE_NODE_TYPE("NAMEDARGEXPR");
1015 WRITE_NODE_FIELD(arg);
1016 WRITE_STRING_FIELD(name);
1017 WRITE_INT_FIELD(argnumber);
1018 WRITE_LOCATION_FIELD(location);
1022 _outOpExpr(StringInfo str, const OpExpr *node)
1024 WRITE_NODE_TYPE("OPEXPR");
1026 WRITE_OID_FIELD(opno);
1027 WRITE_OID_FIELD(opfuncid);
1028 WRITE_OID_FIELD(opresulttype);
1029 WRITE_BOOL_FIELD(opretset);
1030 WRITE_OID_FIELD(opcollid);
1031 WRITE_OID_FIELD(inputcollid);
1032 WRITE_NODE_FIELD(args);
1033 WRITE_LOCATION_FIELD(location);
1037 _outDistinctExpr(StringInfo str, const DistinctExpr *node)
1039 WRITE_NODE_TYPE("DISTINCTEXPR");
1041 WRITE_OID_FIELD(opno);
1042 WRITE_OID_FIELD(opfuncid);
1043 WRITE_OID_FIELD(opresulttype);
1044 WRITE_BOOL_FIELD(opretset);
1045 WRITE_OID_FIELD(opcollid);
1046 WRITE_OID_FIELD(inputcollid);
1047 WRITE_NODE_FIELD(args);
1048 WRITE_LOCATION_FIELD(location);
1052 _outNullIfExpr(StringInfo str, const NullIfExpr *node)
1054 WRITE_NODE_TYPE("NULLIFEXPR");
1056 WRITE_OID_FIELD(opno);
1057 WRITE_OID_FIELD(opfuncid);
1058 WRITE_OID_FIELD(opresulttype);
1059 WRITE_BOOL_FIELD(opretset);
1060 WRITE_OID_FIELD(opcollid);
1061 WRITE_OID_FIELD(inputcollid);
1062 WRITE_NODE_FIELD(args);
1063 WRITE_LOCATION_FIELD(location);
1067 _outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
1069 WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
1071 WRITE_OID_FIELD(opno);
1072 WRITE_OID_FIELD(opfuncid);
1073 WRITE_BOOL_FIELD(useOr);
1074 WRITE_OID_FIELD(inputcollid);
1075 WRITE_NODE_FIELD(args);
1076 WRITE_LOCATION_FIELD(location);
1080 _outBoolExpr(StringInfo str, const BoolExpr *node)
1084 WRITE_NODE_TYPE("BOOLEXPR");
1086 /* do-it-yourself enum representation */
1087 switch (node->boolop)
1099 appendStringInfo(str, " :boolop ");
1100 _outToken(str, opstr);
1102 WRITE_NODE_FIELD(args);
1103 WRITE_LOCATION_FIELD(location);
1107 _outSubLink(StringInfo str, const SubLink *node)
1109 WRITE_NODE_TYPE("SUBLINK");
1111 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1112 WRITE_NODE_FIELD(testexpr);
1113 WRITE_NODE_FIELD(operName);
1114 WRITE_NODE_FIELD(subselect);
1115 WRITE_LOCATION_FIELD(location);
1119 _outSubPlan(StringInfo str, const SubPlan *node)
1121 WRITE_NODE_TYPE("SUBPLAN");
1123 WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1124 WRITE_NODE_FIELD(testexpr);
1125 WRITE_NODE_FIELD(paramIds);
1126 WRITE_INT_FIELD(plan_id);
1127 WRITE_STRING_FIELD(plan_name);
1128 WRITE_OID_FIELD(firstColType);
1129 WRITE_INT_FIELD(firstColTypmod);
1130 WRITE_OID_FIELD(firstColCollation);
1131 WRITE_BOOL_FIELD(useHashTable);
1132 WRITE_BOOL_FIELD(unknownEqFalse);
1133 WRITE_NODE_FIELD(setParam);
1134 WRITE_NODE_FIELD(parParam);
1135 WRITE_NODE_FIELD(args);
1136 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1137 WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
1141 _outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
1143 WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
1145 WRITE_NODE_FIELD(subplans);
1149 _outFieldSelect(StringInfo str, const FieldSelect *node)
1151 WRITE_NODE_TYPE("FIELDSELECT");
1153 WRITE_NODE_FIELD(arg);
1154 WRITE_INT_FIELD(fieldnum);
1155 WRITE_OID_FIELD(resulttype);
1156 WRITE_INT_FIELD(resulttypmod);
1157 WRITE_OID_FIELD(resultcollid);
1161 _outFieldStore(StringInfo str, const FieldStore *node)
1163 WRITE_NODE_TYPE("FIELDSTORE");
1165 WRITE_NODE_FIELD(arg);
1166 WRITE_NODE_FIELD(newvals);
1167 WRITE_NODE_FIELD(fieldnums);
1168 WRITE_OID_FIELD(resulttype);
1172 _outRelabelType(StringInfo str, const RelabelType *node)
1174 WRITE_NODE_TYPE("RELABELTYPE");
1176 WRITE_NODE_FIELD(arg);
1177 WRITE_OID_FIELD(resulttype);
1178 WRITE_INT_FIELD(resulttypmod);
1179 WRITE_OID_FIELD(resultcollid);
1180 WRITE_ENUM_FIELD(relabelformat, CoercionForm);
1181 WRITE_LOCATION_FIELD(location);
1185 _outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
1187 WRITE_NODE_TYPE("COERCEVIAIO");
1189 WRITE_NODE_FIELD(arg);
1190 WRITE_OID_FIELD(resulttype);
1191 WRITE_OID_FIELD(resultcollid);
1192 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1193 WRITE_LOCATION_FIELD(location);
1197 _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
1199 WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
1201 WRITE_NODE_FIELD(arg);
1202 WRITE_OID_FIELD(elemfuncid);
1203 WRITE_OID_FIELD(resulttype);
1204 WRITE_INT_FIELD(resulttypmod);
1205 WRITE_OID_FIELD(resultcollid);
1206 WRITE_BOOL_FIELD(isExplicit);
1207 WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1208 WRITE_LOCATION_FIELD(location);
1212 _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
1214 WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
1216 WRITE_NODE_FIELD(arg);
1217 WRITE_OID_FIELD(resulttype);
1218 WRITE_ENUM_FIELD(convertformat, CoercionForm);
1219 WRITE_LOCATION_FIELD(location);
1223 _outCollateExpr(StringInfo str, const CollateExpr *node)
1225 WRITE_NODE_TYPE("COLLATE");
1227 WRITE_NODE_FIELD(arg);
1228 WRITE_OID_FIELD(collOid);
1229 WRITE_LOCATION_FIELD(location);
1233 _outCaseExpr(StringInfo str, const CaseExpr *node)
1235 WRITE_NODE_TYPE("CASE");
1237 WRITE_OID_FIELD(casetype);
1238 WRITE_OID_FIELD(casecollid);
1239 WRITE_NODE_FIELD(arg);
1240 WRITE_NODE_FIELD(args);
1241 WRITE_NODE_FIELD(defresult);
1242 WRITE_LOCATION_FIELD(location);
1246 _outCaseWhen(StringInfo str, const CaseWhen *node)
1248 WRITE_NODE_TYPE("WHEN");
1250 WRITE_NODE_FIELD(expr);
1251 WRITE_NODE_FIELD(result);
1252 WRITE_LOCATION_FIELD(location);
1256 _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
1258 WRITE_NODE_TYPE("CASETESTEXPR");
1260 WRITE_OID_FIELD(typeId);
1261 WRITE_INT_FIELD(typeMod);
1262 WRITE_OID_FIELD(collation);
1266 _outArrayExpr(StringInfo str, const ArrayExpr *node)
1268 WRITE_NODE_TYPE("ARRAY");
1270 WRITE_OID_FIELD(array_typeid);
1271 WRITE_OID_FIELD(array_collid);
1272 WRITE_OID_FIELD(element_typeid);
1273 WRITE_NODE_FIELD(elements);
1274 WRITE_BOOL_FIELD(multidims);
1275 WRITE_LOCATION_FIELD(location);
1279 _outRowExpr(StringInfo str, const RowExpr *node)
1281 WRITE_NODE_TYPE("ROW");
1283 WRITE_NODE_FIELD(args);
1284 WRITE_OID_FIELD(row_typeid);
1285 WRITE_ENUM_FIELD(row_format, CoercionForm);
1286 WRITE_NODE_FIELD(colnames);
1287 WRITE_LOCATION_FIELD(location);
1291 _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
1293 WRITE_NODE_TYPE("ROWCOMPARE");
1295 WRITE_ENUM_FIELD(rctype, RowCompareType);
1296 WRITE_NODE_FIELD(opnos);
1297 WRITE_NODE_FIELD(opfamilies);
1298 WRITE_NODE_FIELD(inputcollids);
1299 WRITE_NODE_FIELD(largs);
1300 WRITE_NODE_FIELD(rargs);
1304 _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
1306 WRITE_NODE_TYPE("COALESCE");
1308 WRITE_OID_FIELD(coalescetype);
1309 WRITE_OID_FIELD(coalescecollid);
1310 WRITE_NODE_FIELD(args);
1311 WRITE_LOCATION_FIELD(location);
1315 _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
1317 WRITE_NODE_TYPE("MINMAX");
1319 WRITE_OID_FIELD(minmaxtype);
1320 WRITE_OID_FIELD(minmaxcollid);
1321 WRITE_OID_FIELD(inputcollid);
1322 WRITE_ENUM_FIELD(op, MinMaxOp);
1323 WRITE_NODE_FIELD(args);
1324 WRITE_LOCATION_FIELD(location);
1328 _outXmlExpr(StringInfo str, const XmlExpr *node)
1330 WRITE_NODE_TYPE("XMLEXPR");
1332 WRITE_ENUM_FIELD(op, XmlExprOp);
1333 WRITE_STRING_FIELD(name);
1334 WRITE_NODE_FIELD(named_args);
1335 WRITE_NODE_FIELD(arg_names);
1336 WRITE_NODE_FIELD(args);
1337 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
1338 WRITE_OID_FIELD(type);
1339 WRITE_INT_FIELD(typmod);
1340 WRITE_LOCATION_FIELD(location);
1344 _outNullTest(StringInfo str, const NullTest *node)
1346 WRITE_NODE_TYPE("NULLTEST");
1348 WRITE_NODE_FIELD(arg);
1349 WRITE_ENUM_FIELD(nulltesttype, NullTestType);
1350 WRITE_BOOL_FIELD(argisrow);
1354 _outBooleanTest(StringInfo str, const BooleanTest *node)
1356 WRITE_NODE_TYPE("BOOLEANTEST");
1358 WRITE_NODE_FIELD(arg);
1359 WRITE_ENUM_FIELD(booltesttype, BoolTestType);
1363 _outCoerceToDomain(StringInfo str, const CoerceToDomain *node)
1365 WRITE_NODE_TYPE("COERCETODOMAIN");
1367 WRITE_NODE_FIELD(arg);
1368 WRITE_OID_FIELD(resulttype);
1369 WRITE_INT_FIELD(resulttypmod);
1370 WRITE_OID_FIELD(resultcollid);
1371 WRITE_ENUM_FIELD(coercionformat, CoercionForm);
1372 WRITE_LOCATION_FIELD(location);
1376 _outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
1378 WRITE_NODE_TYPE("COERCETODOMAINVALUE");
1380 WRITE_OID_FIELD(typeId);
1381 WRITE_INT_FIELD(typeMod);
1382 WRITE_OID_FIELD(collation);
1383 WRITE_LOCATION_FIELD(location);
1387 _outSetToDefault(StringInfo str, const SetToDefault *node)
1389 WRITE_NODE_TYPE("SETTODEFAULT");
1391 WRITE_OID_FIELD(typeId);
1392 WRITE_INT_FIELD(typeMod);
1393 WRITE_OID_FIELD(collation);
1394 WRITE_LOCATION_FIELD(location);
1398 _outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
1400 WRITE_NODE_TYPE("CURRENTOFEXPR");
1402 WRITE_UINT_FIELD(cvarno);
1403 WRITE_STRING_FIELD(cursor_name);
1404 WRITE_INT_FIELD(cursor_param);
1408 _outTargetEntry(StringInfo str, const TargetEntry *node)
1410 WRITE_NODE_TYPE("TARGETENTRY");
1412 WRITE_NODE_FIELD(expr);
1413 WRITE_INT_FIELD(resno);
1414 WRITE_STRING_FIELD(resname);
1415 WRITE_UINT_FIELD(ressortgroupref);
1416 WRITE_OID_FIELD(resorigtbl);
1417 WRITE_INT_FIELD(resorigcol);
1418 WRITE_BOOL_FIELD(resjunk);
1422 _outRangeTblRef(StringInfo str, const RangeTblRef *node)
1424 WRITE_NODE_TYPE("RANGETBLREF");
1426 WRITE_INT_FIELD(rtindex);
1430 _outJoinExpr(StringInfo str, const JoinExpr *node)
1432 WRITE_NODE_TYPE("JOINEXPR");
1434 WRITE_ENUM_FIELD(jointype, JoinType);
1435 WRITE_BOOL_FIELD(isNatural);
1436 WRITE_NODE_FIELD(larg);
1437 WRITE_NODE_FIELD(rarg);
1438 WRITE_NODE_FIELD(usingClause);
1439 WRITE_NODE_FIELD(quals);
1440 WRITE_NODE_FIELD(alias);
1441 WRITE_INT_FIELD(rtindex);
1445 _outFromExpr(StringInfo str, const FromExpr *node)
1447 WRITE_NODE_TYPE("FROMEXPR");
1449 WRITE_NODE_FIELD(fromlist);
1450 WRITE_NODE_FIELD(quals);
1453 /*****************************************************************************
1455 * Stuff from relation.h.
1457 *****************************************************************************/
1460 * print the basic stuff of all nodes that inherit from Path
1462 * Note we do NOT print the parent, else we'd be in infinite recursion.
1463 * We can print the parent's relids for identification purposes, though.
1464 * We also do not print the whole of param_info, since it's printed by
1465 * _outRelOptInfo; it's sufficient and less cluttering to print just the
1466 * required outer relids.
1469 _outPathInfo(StringInfo str, const Path *node)
1471 WRITE_ENUM_FIELD(pathtype, NodeTag);
1472 appendStringInfo(str, " :parent_relids ");
1473 _outBitmapset(str, node->parent->relids);
1474 appendStringInfo(str, " :required_outer ");
1475 if (node->param_info)
1476 _outBitmapset(str, node->param_info->ppi_req_outer);
1478 _outBitmapset(str, NULL);
1479 WRITE_FLOAT_FIELD(rows, "%.0f");
1480 WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1481 WRITE_FLOAT_FIELD(total_cost, "%.2f");
1482 WRITE_NODE_FIELD(pathkeys);
1486 * print the basic stuff of all nodes that inherit from JoinPath
1489 _outJoinPathInfo(StringInfo str, const JoinPath *node)
1491 _outPathInfo(str, (const Path *) node);
1493 WRITE_ENUM_FIELD(jointype, JoinType);
1494 WRITE_NODE_FIELD(outerjoinpath);
1495 WRITE_NODE_FIELD(innerjoinpath);
1496 WRITE_NODE_FIELD(joinrestrictinfo);
1500 _outPath(StringInfo str, const Path *node)
1502 WRITE_NODE_TYPE("PATH");
1504 _outPathInfo(str, (const Path *) node);
1508 _outIndexPath(StringInfo str, const IndexPath *node)
1510 WRITE_NODE_TYPE("INDEXPATH");
1512 _outPathInfo(str, (const Path *) node);
1514 WRITE_NODE_FIELD(indexinfo);
1515 WRITE_NODE_FIELD(indexclauses);
1516 WRITE_NODE_FIELD(indexquals);
1517 WRITE_NODE_FIELD(indexqualcols);
1518 WRITE_NODE_FIELD(indexorderbys);
1519 WRITE_NODE_FIELD(indexorderbycols);
1520 WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1521 WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1522 WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1526 _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
1528 WRITE_NODE_TYPE("BITMAPHEAPPATH");
1530 _outPathInfo(str, (const Path *) node);
1532 WRITE_NODE_FIELD(bitmapqual);
1536 _outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
1538 WRITE_NODE_TYPE("BITMAPANDPATH");
1540 _outPathInfo(str, (const Path *) node);
1542 WRITE_NODE_FIELD(bitmapquals);
1543 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1547 _outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
1549 WRITE_NODE_TYPE("BITMAPORPATH");
1551 _outPathInfo(str, (const Path *) node);
1553 WRITE_NODE_FIELD(bitmapquals);
1554 WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1558 _outTidPath(StringInfo str, const TidPath *node)
1560 WRITE_NODE_TYPE("TIDPATH");
1562 _outPathInfo(str, (const Path *) node);
1564 WRITE_NODE_FIELD(tidquals);
1568 _outForeignPath(StringInfo str, const ForeignPath *node)
1570 WRITE_NODE_TYPE("FOREIGNPATH");
1572 _outPathInfo(str, (const Path *) node);
1574 WRITE_NODE_FIELD(fdw_private);
1578 _outAppendPath(StringInfo str, const AppendPath *node)
1580 WRITE_NODE_TYPE("APPENDPATH");
1582 _outPathInfo(str, (const Path *) node);
1584 WRITE_NODE_FIELD(subpaths);
1588 _outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
1590 WRITE_NODE_TYPE("MERGEAPPENDPATH");
1592 _outPathInfo(str, (const Path *) node);
1594 WRITE_NODE_FIELD(subpaths);
1595 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1599 _outResultPath(StringInfo str, const ResultPath *node)
1601 WRITE_NODE_TYPE("RESULTPATH");
1603 _outPathInfo(str, (const Path *) node);
1605 WRITE_NODE_FIELD(quals);
1609 _outMaterialPath(StringInfo str, const MaterialPath *node)
1611 WRITE_NODE_TYPE("MATERIALPATH");
1613 _outPathInfo(str, (const Path *) node);
1615 WRITE_NODE_FIELD(subpath);
1619 _outUniquePath(StringInfo str, const UniquePath *node)
1621 WRITE_NODE_TYPE("UNIQUEPATH");
1623 _outPathInfo(str, (const Path *) node);
1625 WRITE_NODE_FIELD(subpath);
1626 WRITE_ENUM_FIELD(umethod, UniquePathMethod);
1627 WRITE_NODE_FIELD(in_operators);
1628 WRITE_NODE_FIELD(uniq_exprs);
1632 _outNestPath(StringInfo str, const NestPath *node)
1634 WRITE_NODE_TYPE("NESTPATH");
1636 _outJoinPathInfo(str, (const JoinPath *) node);
1640 _outMergePath(StringInfo str, const MergePath *node)
1642 WRITE_NODE_TYPE("MERGEPATH");
1644 _outJoinPathInfo(str, (const JoinPath *) node);
1646 WRITE_NODE_FIELD(path_mergeclauses);
1647 WRITE_NODE_FIELD(outersortkeys);
1648 WRITE_NODE_FIELD(innersortkeys);
1649 WRITE_BOOL_FIELD(materialize_inner);
1653 _outHashPath(StringInfo str, const HashPath *node)
1655 WRITE_NODE_TYPE("HASHPATH");
1657 _outJoinPathInfo(str, (const JoinPath *) node);
1659 WRITE_NODE_FIELD(path_hashclauses);
1660 WRITE_INT_FIELD(num_batches);
1664 _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
1666 WRITE_NODE_TYPE("PLANNERGLOBAL");
1668 /* NB: this isn't a complete set of fields */
1669 WRITE_NODE_FIELD(subplans);
1670 WRITE_BITMAPSET_FIELD(rewindPlanIDs);
1671 WRITE_NODE_FIELD(finalrtable);
1672 WRITE_NODE_FIELD(finalrowmarks);
1673 WRITE_NODE_FIELD(resultRelations);
1674 WRITE_NODE_FIELD(relationOids);
1675 WRITE_NODE_FIELD(invalItems);
1676 WRITE_INT_FIELD(nParamExec);
1677 WRITE_UINT_FIELD(lastPHId);
1678 WRITE_UINT_FIELD(lastRowMarkId);
1679 WRITE_BOOL_FIELD(transientPlan);
1683 _outPlannerInfo(StringInfo str, const PlannerInfo *node)
1685 WRITE_NODE_TYPE("PLANNERINFO");
1687 /* NB: this isn't a complete set of fields */
1688 WRITE_NODE_FIELD(parse);
1689 WRITE_NODE_FIELD(glob);
1690 WRITE_UINT_FIELD(query_level);
1691 WRITE_NODE_FIELD(plan_params);
1692 WRITE_BITMAPSET_FIELD(all_baserels);
1693 WRITE_NODE_FIELD(join_rel_list);
1694 WRITE_INT_FIELD(join_cur_level);
1695 WRITE_NODE_FIELD(init_plans);
1696 WRITE_NODE_FIELD(cte_plan_ids);
1697 WRITE_NODE_FIELD(eq_classes);
1698 WRITE_NODE_FIELD(canon_pathkeys);
1699 WRITE_NODE_FIELD(left_join_clauses);
1700 WRITE_NODE_FIELD(right_join_clauses);
1701 WRITE_NODE_FIELD(full_join_clauses);
1702 WRITE_NODE_FIELD(join_info_list);
1703 WRITE_NODE_FIELD(lateral_info_list);
1704 WRITE_NODE_FIELD(append_rel_list);
1705 WRITE_NODE_FIELD(rowMarks);
1706 WRITE_NODE_FIELD(placeholder_list);
1707 WRITE_NODE_FIELD(query_pathkeys);
1708 WRITE_NODE_FIELD(group_pathkeys);
1709 WRITE_NODE_FIELD(window_pathkeys);
1710 WRITE_NODE_FIELD(distinct_pathkeys);
1711 WRITE_NODE_FIELD(sort_pathkeys);
1712 WRITE_NODE_FIELD(minmax_aggs);
1713 WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
1714 WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
1715 WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1716 WRITE_BOOL_FIELD(hasInheritedTarget);
1717 WRITE_BOOL_FIELD(hasJoinRTEs);
1718 WRITE_BOOL_FIELD(hasLateralRTEs);
1719 WRITE_BOOL_FIELD(hasHavingQual);
1720 WRITE_BOOL_FIELD(hasPseudoConstantQuals);
1721 WRITE_BOOL_FIELD(hasRecursion);
1722 WRITE_INT_FIELD(wt_param_id);
1723 WRITE_BITMAPSET_FIELD(curOuterRels);
1724 WRITE_NODE_FIELD(curOuterParams);
1728 _outRelOptInfo(StringInfo str, const RelOptInfo *node)
1730 WRITE_NODE_TYPE("RELOPTINFO");
1732 /* NB: this isn't a complete set of fields */
1733 WRITE_ENUM_FIELD(reloptkind, RelOptKind);
1734 WRITE_BITMAPSET_FIELD(relids);
1735 WRITE_FLOAT_FIELD(rows, "%.0f");
1736 WRITE_INT_FIELD(width);
1737 WRITE_BOOL_FIELD(consider_startup);
1738 WRITE_NODE_FIELD(reltargetlist);
1739 WRITE_NODE_FIELD(pathlist);
1740 WRITE_NODE_FIELD(ppilist);
1741 WRITE_NODE_FIELD(cheapest_startup_path);
1742 WRITE_NODE_FIELD(cheapest_total_path);
1743 WRITE_NODE_FIELD(cheapest_unique_path);
1744 WRITE_NODE_FIELD(cheapest_parameterized_paths);
1745 WRITE_UINT_FIELD(relid);
1746 WRITE_UINT_FIELD(reltablespace);
1747 WRITE_ENUM_FIELD(rtekind, RTEKind);
1748 WRITE_INT_FIELD(min_attr);
1749 WRITE_INT_FIELD(max_attr);
1750 WRITE_NODE_FIELD(lateral_vars);
1751 WRITE_BITMAPSET_FIELD(lateral_relids);
1752 WRITE_NODE_FIELD(indexlist);
1753 WRITE_UINT_FIELD(pages);
1754 WRITE_FLOAT_FIELD(tuples, "%.0f");
1755 WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
1756 WRITE_NODE_FIELD(subplan);
1757 WRITE_NODE_FIELD(subroot);
1758 WRITE_NODE_FIELD(subplan_params);
1759 /* we don't try to print fdwroutine or fdw_private */
1760 WRITE_NODE_FIELD(baserestrictinfo);
1761 WRITE_NODE_FIELD(joininfo);
1762 WRITE_BOOL_FIELD(has_eclass_joins);
1766 _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
1768 WRITE_NODE_TYPE("INDEXOPTINFO");
1770 /* NB: this isn't a complete set of fields */
1771 WRITE_OID_FIELD(indexoid);
1772 /* Do NOT print rel field, else infinite recursion */
1773 WRITE_UINT_FIELD(pages);
1774 WRITE_FLOAT_FIELD(tuples, "%.0f");
1775 WRITE_INT_FIELD(ncolumns);
1776 WRITE_OID_FIELD(relam);
1777 /* indexprs is redundant since we print indextlist */
1778 WRITE_NODE_FIELD(indpred);
1779 WRITE_NODE_FIELD(indextlist);
1780 WRITE_BOOL_FIELD(predOK);
1781 WRITE_BOOL_FIELD(unique);
1782 WRITE_BOOL_FIELD(immediate);
1783 WRITE_BOOL_FIELD(hypothetical);
1787 _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
1790 * To simplify reading, we just chase up to the topmost merged EC and
1791 * print that, without bothering to show the merge-ees separately.
1793 while (node->ec_merged)
1794 node = node->ec_merged;
1796 WRITE_NODE_TYPE("EQUIVALENCECLASS");
1798 WRITE_NODE_FIELD(ec_opfamilies);
1799 WRITE_OID_FIELD(ec_collation);
1800 WRITE_NODE_FIELD(ec_members);
1801 WRITE_NODE_FIELD(ec_sources);
1802 WRITE_NODE_FIELD(ec_derives);
1803 WRITE_BITMAPSET_FIELD(ec_relids);
1804 WRITE_BOOL_FIELD(ec_has_const);
1805 WRITE_BOOL_FIELD(ec_has_volatile);
1806 WRITE_BOOL_FIELD(ec_below_outer_join);
1807 WRITE_BOOL_FIELD(ec_broken);
1808 WRITE_UINT_FIELD(ec_sortref);
1812 _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
1814 WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
1816 WRITE_NODE_FIELD(em_expr);
1817 WRITE_BITMAPSET_FIELD(em_relids);
1818 WRITE_BOOL_FIELD(em_is_const);
1819 WRITE_BOOL_FIELD(em_is_child);
1820 WRITE_OID_FIELD(em_datatype);
1824 _outPathKey(StringInfo str, const PathKey *node)
1826 WRITE_NODE_TYPE("PATHKEY");
1828 WRITE_NODE_FIELD(pk_eclass);
1829 WRITE_OID_FIELD(pk_opfamily);
1830 WRITE_INT_FIELD(pk_strategy);
1831 WRITE_BOOL_FIELD(pk_nulls_first);
1835 _outParamPathInfo(StringInfo str, const ParamPathInfo *node)
1837 WRITE_NODE_TYPE("PARAMPATHINFO");
1839 WRITE_BITMAPSET_FIELD(ppi_req_outer);
1840 WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
1841 WRITE_NODE_FIELD(ppi_clauses);
1845 _outRestrictInfo(StringInfo str, const RestrictInfo *node)
1847 WRITE_NODE_TYPE("RESTRICTINFO");
1849 /* NB: this isn't a complete set of fields */
1850 WRITE_NODE_FIELD(clause);
1851 WRITE_BOOL_FIELD(is_pushed_down);
1852 WRITE_BOOL_FIELD(outerjoin_delayed);
1853 WRITE_BOOL_FIELD(can_join);
1854 WRITE_BOOL_FIELD(pseudoconstant);
1855 WRITE_BITMAPSET_FIELD(clause_relids);
1856 WRITE_BITMAPSET_FIELD(required_relids);
1857 WRITE_BITMAPSET_FIELD(outer_relids);
1858 WRITE_BITMAPSET_FIELD(nullable_relids);
1859 WRITE_BITMAPSET_FIELD(left_relids);
1860 WRITE_BITMAPSET_FIELD(right_relids);
1861 WRITE_NODE_FIELD(orclause);
1862 /* don't write parent_ec, leads to infinite recursion in plan tree dump */
1863 WRITE_FLOAT_FIELD(norm_selec, "%.4f");
1864 WRITE_FLOAT_FIELD(outer_selec, "%.4f");
1865 WRITE_NODE_FIELD(mergeopfamilies);
1866 /* don't write left_ec, leads to infinite recursion in plan tree dump */
1867 /* don't write right_ec, leads to infinite recursion in plan tree dump */
1868 WRITE_NODE_FIELD(left_em);
1869 WRITE_NODE_FIELD(right_em);
1870 WRITE_BOOL_FIELD(outer_is_left);
1871 WRITE_OID_FIELD(hashjoinoperator);
1875 _outPlaceHolderVar(StringInfo str, const PlaceHolderVar *node)
1877 WRITE_NODE_TYPE("PLACEHOLDERVAR");
1879 WRITE_NODE_FIELD(phexpr);
1880 WRITE_BITMAPSET_FIELD(phrels);
1881 WRITE_UINT_FIELD(phid);
1882 WRITE_UINT_FIELD(phlevelsup);
1886 _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
1888 WRITE_NODE_TYPE("SPECIALJOININFO");
1890 WRITE_BITMAPSET_FIELD(min_lefthand);
1891 WRITE_BITMAPSET_FIELD(min_righthand);
1892 WRITE_BITMAPSET_FIELD(syn_lefthand);
1893 WRITE_BITMAPSET_FIELD(syn_righthand);
1894 WRITE_ENUM_FIELD(jointype, JoinType);
1895 WRITE_BOOL_FIELD(lhs_strict);
1896 WRITE_BOOL_FIELD(delay_upper_joins);
1897 WRITE_NODE_FIELD(join_quals);
1901 _outLateralJoinInfo(StringInfo str, const LateralJoinInfo *node)
1903 WRITE_NODE_TYPE("LATERALJOININFO");
1905 WRITE_UINT_FIELD(lateral_rhs);
1906 WRITE_BITMAPSET_FIELD(lateral_lhs);
1910 _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
1912 WRITE_NODE_TYPE("APPENDRELINFO");
1914 WRITE_UINT_FIELD(parent_relid);
1915 WRITE_UINT_FIELD(child_relid);
1916 WRITE_OID_FIELD(parent_reltype);
1917 WRITE_OID_FIELD(child_reltype);
1918 WRITE_NODE_FIELD(translated_vars);
1919 WRITE_OID_FIELD(parent_reloid);
1923 _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
1925 WRITE_NODE_TYPE("PLACEHOLDERINFO");
1927 WRITE_UINT_FIELD(phid);
1928 WRITE_NODE_FIELD(ph_var);
1929 WRITE_BITMAPSET_FIELD(ph_eval_at);
1930 WRITE_BITMAPSET_FIELD(ph_needed);
1931 WRITE_BITMAPSET_FIELD(ph_may_need);
1932 WRITE_INT_FIELD(ph_width);
1936 _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
1938 WRITE_NODE_TYPE("MINMAXAGGINFO");
1940 WRITE_OID_FIELD(aggfnoid);
1941 WRITE_OID_FIELD(aggsortop);
1942 WRITE_NODE_FIELD(target);
1943 /* We intentionally omit subroot --- too large, not interesting enough */
1944 WRITE_NODE_FIELD(path);
1945 WRITE_FLOAT_FIELD(pathcost, "%.2f");
1946 WRITE_NODE_FIELD(param);
1950 _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
1952 WRITE_NODE_TYPE("PLANNERPARAMITEM");
1954 WRITE_NODE_FIELD(item);
1955 WRITE_INT_FIELD(paramId);
1958 /*****************************************************************************
1960 * Stuff from parsenodes.h.
1962 *****************************************************************************/
1965 * print the basic stuff of all nodes that inherit from CreateStmt
1968 _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
1970 WRITE_NODE_FIELD(relation);
1971 WRITE_NODE_FIELD(tableElts);
1972 WRITE_NODE_FIELD(inhRelations);
1973 WRITE_NODE_FIELD(ofTypename);
1974 WRITE_NODE_FIELD(constraints);
1975 WRITE_NODE_FIELD(options);
1976 WRITE_ENUM_FIELD(oncommit, OnCommitAction);
1977 WRITE_STRING_FIELD(tablespacename);
1978 WRITE_BOOL_FIELD(if_not_exists);
1982 _outCreateStmt(StringInfo str, const CreateStmt *node)
1984 WRITE_NODE_TYPE("CREATESTMT");
1986 _outCreateStmtInfo(str, (const CreateStmt *) node);
1990 _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
1992 WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
1994 _outCreateStmtInfo(str, (const CreateStmt *) node);
1996 WRITE_STRING_FIELD(servername);
1997 WRITE_NODE_FIELD(options);
2001 _outIndexStmt(StringInfo str, const IndexStmt *node)
2003 WRITE_NODE_TYPE("INDEXSTMT");
2005 WRITE_STRING_FIELD(idxname);
2006 WRITE_NODE_FIELD(relation);
2007 WRITE_STRING_FIELD(accessMethod);
2008 WRITE_STRING_FIELD(tableSpace);
2009 WRITE_NODE_FIELD(indexParams);
2010 WRITE_NODE_FIELD(options);
2011 WRITE_NODE_FIELD(whereClause);
2012 WRITE_NODE_FIELD(excludeOpNames);
2013 WRITE_STRING_FIELD(idxcomment);
2014 WRITE_OID_FIELD(indexOid);
2015 WRITE_OID_FIELD(oldNode);
2016 WRITE_BOOL_FIELD(unique);
2017 WRITE_BOOL_FIELD(primary);
2018 WRITE_BOOL_FIELD(isconstraint);
2019 WRITE_BOOL_FIELD(deferrable);
2020 WRITE_BOOL_FIELD(initdeferred);
2021 WRITE_BOOL_FIELD(concurrent);
2025 _outNotifyStmt(StringInfo str, const NotifyStmt *node)
2027 WRITE_NODE_TYPE("NOTIFY");
2029 WRITE_STRING_FIELD(conditionname);
2030 WRITE_STRING_FIELD(payload);
2034 _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
2036 WRITE_NODE_TYPE("DECLARECURSOR");
2038 WRITE_STRING_FIELD(portalname);
2039 WRITE_INT_FIELD(options);
2040 WRITE_NODE_FIELD(query);
2044 _outSelectStmt(StringInfo str, const SelectStmt *node)
2046 WRITE_NODE_TYPE("SELECT");
2048 WRITE_NODE_FIELD(distinctClause);
2049 WRITE_NODE_FIELD(intoClause);
2050 WRITE_NODE_FIELD(targetList);
2051 WRITE_NODE_FIELD(fromClause);
2052 WRITE_NODE_FIELD(whereClause);
2053 WRITE_NODE_FIELD(groupClause);
2054 WRITE_NODE_FIELD(havingClause);
2055 WRITE_NODE_FIELD(windowClause);
2056 WRITE_NODE_FIELD(valuesLists);
2057 WRITE_NODE_FIELD(sortClause);
2058 WRITE_NODE_FIELD(limitOffset);
2059 WRITE_NODE_FIELD(limitCount);
2060 WRITE_NODE_FIELD(lockingClause);
2061 WRITE_NODE_FIELD(withClause);
2062 WRITE_ENUM_FIELD(op, SetOperation);
2063 WRITE_BOOL_FIELD(all);
2064 WRITE_NODE_FIELD(larg);
2065 WRITE_NODE_FIELD(rarg);
2069 _outFuncCall(StringInfo str, const FuncCall *node)
2071 WRITE_NODE_TYPE("FUNCCALL");
2073 WRITE_NODE_FIELD(funcname);
2074 WRITE_NODE_FIELD(args);
2075 WRITE_NODE_FIELD(agg_order);
2076 WRITE_BOOL_FIELD(agg_star);
2077 WRITE_BOOL_FIELD(agg_distinct);
2078 WRITE_BOOL_FIELD(func_variadic);
2079 WRITE_NODE_FIELD(over);
2080 WRITE_LOCATION_FIELD(location);
2084 _outDefElem(StringInfo str, const DefElem *node)
2086 WRITE_NODE_TYPE("DEFELEM");
2088 WRITE_STRING_FIELD(defnamespace);
2089 WRITE_STRING_FIELD(defname);
2090 WRITE_NODE_FIELD(arg);
2091 WRITE_ENUM_FIELD(defaction, DefElemAction);
2095 _outTableLikeClause(StringInfo str, const TableLikeClause *node)
2097 WRITE_NODE_TYPE("TABLELIKECLAUSE");
2099 WRITE_NODE_FIELD(relation);
2100 WRITE_UINT_FIELD(options);
2104 _outLockingClause(StringInfo str, const LockingClause *node)
2106 WRITE_NODE_TYPE("LOCKINGCLAUSE");
2108 WRITE_NODE_FIELD(lockedRels);
2109 WRITE_BOOL_FIELD(forUpdate);
2110 WRITE_BOOL_FIELD(noWait);
2114 _outXmlSerialize(StringInfo str, const XmlSerialize *node)
2116 WRITE_NODE_TYPE("XMLSERIALIZE");
2118 WRITE_ENUM_FIELD(xmloption, XmlOptionType);
2119 WRITE_NODE_FIELD(expr);
2120 WRITE_NODE_FIELD(typeName);
2121 WRITE_LOCATION_FIELD(location);
2125 _outColumnDef(StringInfo str, const ColumnDef *node)
2127 WRITE_NODE_TYPE("COLUMNDEF");
2129 WRITE_STRING_FIELD(colname);
2130 WRITE_NODE_FIELD(typeName);
2131 WRITE_INT_FIELD(inhcount);
2132 WRITE_BOOL_FIELD(is_local);
2133 WRITE_BOOL_FIELD(is_not_null);
2134 WRITE_BOOL_FIELD(is_from_type);
2135 WRITE_CHAR_FIELD(storage);
2136 WRITE_NODE_FIELD(raw_default);
2137 WRITE_NODE_FIELD(cooked_default);
2138 WRITE_NODE_FIELD(collClause);
2139 WRITE_OID_FIELD(collOid);
2140 WRITE_NODE_FIELD(constraints);
2141 WRITE_NODE_FIELD(fdwoptions);
2145 _outTypeName(StringInfo str, const TypeName *node)
2147 WRITE_NODE_TYPE("TYPENAME");
2149 WRITE_NODE_FIELD(names);
2150 WRITE_OID_FIELD(typeOid);
2151 WRITE_BOOL_FIELD(setof);
2152 WRITE_BOOL_FIELD(pct_type);
2153 WRITE_NODE_FIELD(typmods);
2154 WRITE_INT_FIELD(typemod);
2155 WRITE_NODE_FIELD(arrayBounds);
2156 WRITE_LOCATION_FIELD(location);
2160 _outTypeCast(StringInfo str, const TypeCast *node)
2162 WRITE_NODE_TYPE("TYPECAST");
2164 WRITE_NODE_FIELD(arg);
2165 WRITE_NODE_FIELD(typeName);
2166 WRITE_LOCATION_FIELD(location);
2170 _outCollateClause(StringInfo str, const CollateClause *node)
2172 WRITE_NODE_TYPE("COLLATECLAUSE");
2174 WRITE_NODE_FIELD(arg);
2175 WRITE_NODE_FIELD(collname);
2176 WRITE_LOCATION_FIELD(location);
2180 _outIndexElem(StringInfo str, const IndexElem *node)
2182 WRITE_NODE_TYPE("INDEXELEM");
2184 WRITE_STRING_FIELD(name);
2185 WRITE_NODE_FIELD(expr);
2186 WRITE_STRING_FIELD(indexcolname);
2187 WRITE_NODE_FIELD(collation);
2188 WRITE_NODE_FIELD(opclass);
2189 WRITE_ENUM_FIELD(ordering, SortByDir);
2190 WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2194 _outQuery(StringInfo str, const Query *node)
2196 WRITE_NODE_TYPE("QUERY");
2198 WRITE_ENUM_FIELD(commandType, CmdType);
2199 WRITE_ENUM_FIELD(querySource, QuerySource);
2200 /* we intentionally do not print the queryId field */
2201 WRITE_BOOL_FIELD(canSetTag);
2204 * Hack to work around missing outfuncs routines for a lot of the
2205 * utility-statement node types. (The only one we actually *need* for
2206 * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2207 * for the meantime do this to avoid getting lots of warnings when running
2208 * with debug_print_parse on.
2210 if (node->utilityStmt)
2212 switch (nodeTag(node->utilityStmt))
2217 case T_DeclareCursorStmt:
2218 WRITE_NODE_FIELD(utilityStmt);
2221 appendStringInfo(str, " :utilityStmt ?");
2226 appendStringInfo(str, " :utilityStmt <>");
2228 WRITE_INT_FIELD(resultRelation);
2229 WRITE_BOOL_FIELD(hasAggs);
2230 WRITE_BOOL_FIELD(hasWindowFuncs);
2231 WRITE_BOOL_FIELD(hasSubLinks);
2232 WRITE_BOOL_FIELD(hasDistinctOn);
2233 WRITE_BOOL_FIELD(hasRecursive);
2234 WRITE_BOOL_FIELD(hasModifyingCTE);
2235 WRITE_BOOL_FIELD(hasForUpdate);
2236 WRITE_NODE_FIELD(cteList);
2237 WRITE_NODE_FIELD(rtable);
2238 WRITE_NODE_FIELD(jointree);
2239 WRITE_NODE_FIELD(targetList);
2240 WRITE_NODE_FIELD(returningList);
2241 WRITE_NODE_FIELD(groupClause);
2242 WRITE_NODE_FIELD(havingQual);
2243 WRITE_NODE_FIELD(windowClause);
2244 WRITE_NODE_FIELD(distinctClause);
2245 WRITE_NODE_FIELD(sortClause);
2246 WRITE_NODE_FIELD(limitOffset);
2247 WRITE_NODE_FIELD(limitCount);
2248 WRITE_NODE_FIELD(rowMarks);
2249 WRITE_NODE_FIELD(setOperations);
2250 WRITE_NODE_FIELD(constraintDeps);
2254 _outSortGroupClause(StringInfo str, const SortGroupClause *node)
2256 WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2258 WRITE_UINT_FIELD(tleSortGroupRef);
2259 WRITE_OID_FIELD(eqop);
2260 WRITE_OID_FIELD(sortop);
2261 WRITE_BOOL_FIELD(nulls_first);
2262 WRITE_BOOL_FIELD(hashable);
2266 _outWindowClause(StringInfo str, const WindowClause *node)
2268 WRITE_NODE_TYPE("WINDOWCLAUSE");
2270 WRITE_STRING_FIELD(name);
2271 WRITE_STRING_FIELD(refname);
2272 WRITE_NODE_FIELD(partitionClause);
2273 WRITE_NODE_FIELD(orderClause);
2274 WRITE_INT_FIELD(frameOptions);
2275 WRITE_NODE_FIELD(startOffset);
2276 WRITE_NODE_FIELD(endOffset);
2277 WRITE_UINT_FIELD(winref);
2278 WRITE_BOOL_FIELD(copiedOrder);
2282 _outRowMarkClause(StringInfo str, const RowMarkClause *node)
2284 WRITE_NODE_TYPE("ROWMARKCLAUSE");
2286 WRITE_UINT_FIELD(rti);
2287 WRITE_BOOL_FIELD(forUpdate);
2288 WRITE_BOOL_FIELD(noWait);
2289 WRITE_BOOL_FIELD(pushedDown);
2293 _outWithClause(StringInfo str, const WithClause *node)
2295 WRITE_NODE_TYPE("WITHCLAUSE");
2297 WRITE_NODE_FIELD(ctes);
2298 WRITE_BOOL_FIELD(recursive);
2299 WRITE_LOCATION_FIELD(location);
2303 _outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
2305 WRITE_NODE_TYPE("COMMONTABLEEXPR");
2307 WRITE_STRING_FIELD(ctename);
2308 WRITE_NODE_FIELD(aliascolnames);
2309 WRITE_NODE_FIELD(ctequery);
2310 WRITE_LOCATION_FIELD(location);
2311 WRITE_BOOL_FIELD(cterecursive);
2312 WRITE_INT_FIELD(cterefcount);
2313 WRITE_NODE_FIELD(ctecolnames);
2314 WRITE_NODE_FIELD(ctecoltypes);
2315 WRITE_NODE_FIELD(ctecoltypmods);
2316 WRITE_NODE_FIELD(ctecolcollations);
2320 _outSetOperationStmt(StringInfo str, const SetOperationStmt *node)
2322 WRITE_NODE_TYPE("SETOPERATIONSTMT");
2324 WRITE_ENUM_FIELD(op, SetOperation);
2325 WRITE_BOOL_FIELD(all);
2326 WRITE_NODE_FIELD(larg);
2327 WRITE_NODE_FIELD(rarg);
2328 WRITE_NODE_FIELD(colTypes);
2329 WRITE_NODE_FIELD(colTypmods);
2330 WRITE_NODE_FIELD(colCollations);
2331 WRITE_NODE_FIELD(groupClauses);
2335 _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
2337 WRITE_NODE_TYPE("RTE");
2339 /* put alias + eref first to make dump more legible */
2340 WRITE_NODE_FIELD(alias);
2341 WRITE_NODE_FIELD(eref);
2342 WRITE_ENUM_FIELD(rtekind, RTEKind);
2344 switch (node->rtekind)
2347 WRITE_OID_FIELD(relid);
2348 WRITE_CHAR_FIELD(relkind);
2351 WRITE_NODE_FIELD(subquery);
2352 WRITE_BOOL_FIELD(security_barrier);
2355 WRITE_ENUM_FIELD(jointype, JoinType);
2356 WRITE_NODE_FIELD(joinaliasvars);
2359 WRITE_NODE_FIELD(funcexpr);
2360 WRITE_NODE_FIELD(funccoltypes);
2361 WRITE_NODE_FIELD(funccoltypmods);
2362 WRITE_NODE_FIELD(funccolcollations);
2365 WRITE_NODE_FIELD(values_lists);
2366 WRITE_NODE_FIELD(values_collations);
2369 WRITE_STRING_FIELD(ctename);
2370 WRITE_UINT_FIELD(ctelevelsup);
2371 WRITE_BOOL_FIELD(self_reference);
2372 WRITE_NODE_FIELD(ctecoltypes);
2373 WRITE_NODE_FIELD(ctecoltypmods);
2374 WRITE_NODE_FIELD(ctecolcollations);
2377 elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
2381 WRITE_BOOL_FIELD(lateral);
2382 WRITE_BOOL_FIELD(inh);
2383 WRITE_BOOL_FIELD(inFromCl);
2384 WRITE_UINT_FIELD(requiredPerms);
2385 WRITE_OID_FIELD(checkAsUser);
2386 WRITE_BITMAPSET_FIELD(selectedCols);
2387 WRITE_BITMAPSET_FIELD(modifiedCols);
2391 _outAExpr(StringInfo str, const A_Expr *node)
2393 WRITE_NODE_TYPE("AEXPR");
2398 appendStringInfo(str, " ");
2399 WRITE_NODE_FIELD(name);
2402 appendStringInfo(str, " AND");
2405 appendStringInfo(str, " OR");
2408 appendStringInfo(str, " NOT");
2411 appendStringInfo(str, " ");
2412 WRITE_NODE_FIELD(name);
2413 appendStringInfo(str, " ANY ");
2416 appendStringInfo(str, " ");
2417 WRITE_NODE_FIELD(name);
2418 appendStringInfo(str, " ALL ");
2420 case AEXPR_DISTINCT:
2421 appendStringInfo(str, " DISTINCT ");
2422 WRITE_NODE_FIELD(name);
2425 appendStringInfo(str, " NULLIF ");
2426 WRITE_NODE_FIELD(name);
2429 appendStringInfo(str, " OF ");
2430 WRITE_NODE_FIELD(name);
2433 appendStringInfo(str, " IN ");
2434 WRITE_NODE_FIELD(name);
2437 appendStringInfo(str, " ??");
2441 WRITE_NODE_FIELD(lexpr);
2442 WRITE_NODE_FIELD(rexpr);
2443 WRITE_LOCATION_FIELD(location);
2447 _outValue(StringInfo str, const Value *value)
2449 switch (value->type)
2452 appendStringInfo(str, "%ld", value->val.ival);
2457 * We assume the value is a valid numeric literal and so does not
2460 appendStringInfoString(str, value->val.str);
2463 appendStringInfoChar(str, '"');
2464 _outToken(str, value->val.str);
2465 appendStringInfoChar(str, '"');
2468 /* internal representation already has leading 'b' */
2469 appendStringInfoString(str, value->val.str);
2472 /* this is seen only within A_Const, not in transformed trees */
2473 appendStringInfoString(str, "NULL");
2476 elog(ERROR, "unrecognized node type: %d", (int) value->type);
2482 _outColumnRef(StringInfo str, const ColumnRef *node)
2484 WRITE_NODE_TYPE("COLUMNREF");
2486 WRITE_NODE_FIELD(fields);
2487 WRITE_LOCATION_FIELD(location);
2491 _outParamRef(StringInfo str, const ParamRef *node)
2493 WRITE_NODE_TYPE("PARAMREF");
2495 WRITE_INT_FIELD(number);
2496 WRITE_LOCATION_FIELD(location);
2500 _outAConst(StringInfo str, const A_Const *node)
2502 WRITE_NODE_TYPE("A_CONST");
2504 appendStringInfo(str, " :val ");
2505 _outValue(str, &(node->val));
2506 WRITE_LOCATION_FIELD(location);
2510 _outA_Star(StringInfo str, const A_Star *node)
2512 WRITE_NODE_TYPE("A_STAR");
2516 _outA_Indices(StringInfo str, const A_Indices *node)
2518 WRITE_NODE_TYPE("A_INDICES");
2520 WRITE_NODE_FIELD(lidx);
2521 WRITE_NODE_FIELD(uidx);
2525 _outA_Indirection(StringInfo str, const A_Indirection *node)
2527 WRITE_NODE_TYPE("A_INDIRECTION");
2529 WRITE_NODE_FIELD(arg);
2530 WRITE_NODE_FIELD(indirection);
2534 _outA_ArrayExpr(StringInfo str, const A_ArrayExpr *node)
2536 WRITE_NODE_TYPE("A_ARRAYEXPR");
2538 WRITE_NODE_FIELD(elements);
2539 WRITE_LOCATION_FIELD(location);
2543 _outResTarget(StringInfo str, const ResTarget *node)
2545 WRITE_NODE_TYPE("RESTARGET");
2547 WRITE_STRING_FIELD(name);
2548 WRITE_NODE_FIELD(indirection);
2549 WRITE_NODE_FIELD(val);
2550 WRITE_LOCATION_FIELD(location);
2554 _outSortBy(StringInfo str, const SortBy *node)
2556 WRITE_NODE_TYPE("SORTBY");
2558 WRITE_NODE_FIELD(node);
2559 WRITE_ENUM_FIELD(sortby_dir, SortByDir);
2560 WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
2561 WRITE_NODE_FIELD(useOp);
2562 WRITE_LOCATION_FIELD(location);
2566 _outWindowDef(StringInfo str, const WindowDef *node)
2568 WRITE_NODE_TYPE("WINDOWDEF");
2570 WRITE_STRING_FIELD(name);
2571 WRITE_STRING_FIELD(refname);
2572 WRITE_NODE_FIELD(partitionClause);
2573 WRITE_NODE_FIELD(orderClause);
2574 WRITE_INT_FIELD(frameOptions);
2575 WRITE_NODE_FIELD(startOffset);
2576 WRITE_NODE_FIELD(endOffset);
2577 WRITE_LOCATION_FIELD(location);
2581 _outRangeSubselect(StringInfo str, const RangeSubselect *node)
2583 WRITE_NODE_TYPE("RANGESUBSELECT");
2585 WRITE_BOOL_FIELD(lateral);
2586 WRITE_NODE_FIELD(subquery);
2587 WRITE_NODE_FIELD(alias);
2591 _outRangeFunction(StringInfo str, const RangeFunction *node)
2593 WRITE_NODE_TYPE("RANGEFUNCTION");
2595 WRITE_BOOL_FIELD(lateral);
2596 WRITE_NODE_FIELD(funccallnode);
2597 WRITE_NODE_FIELD(alias);
2598 WRITE_NODE_FIELD(coldeflist);
2602 _outConstraint(StringInfo str, const Constraint *node)
2604 WRITE_NODE_TYPE("CONSTRAINT");
2606 WRITE_STRING_FIELD(conname);
2607 WRITE_BOOL_FIELD(deferrable);
2608 WRITE_BOOL_FIELD(initdeferred);
2609 WRITE_LOCATION_FIELD(location);
2611 appendStringInfo(str, " :contype ");
2612 switch (node->contype)
2615 appendStringInfo(str, "NULL");
2618 case CONSTR_NOTNULL:
2619 appendStringInfo(str, "NOT_NULL");
2622 case CONSTR_DEFAULT:
2623 appendStringInfo(str, "DEFAULT");
2624 WRITE_NODE_FIELD(raw_expr);
2625 WRITE_STRING_FIELD(cooked_expr);
2629 appendStringInfo(str, "CHECK");
2630 WRITE_BOOL_FIELD(is_no_inherit);
2631 WRITE_NODE_FIELD(raw_expr);
2632 WRITE_STRING_FIELD(cooked_expr);
2635 case CONSTR_PRIMARY:
2636 appendStringInfo(str, "PRIMARY_KEY");
2637 WRITE_NODE_FIELD(keys);
2638 WRITE_NODE_FIELD(options);
2639 WRITE_STRING_FIELD(indexname);
2640 WRITE_STRING_FIELD(indexspace);
2641 /* access_method and where_clause not currently used */
2645 appendStringInfo(str, "UNIQUE");
2646 WRITE_NODE_FIELD(keys);
2647 WRITE_NODE_FIELD(options);
2648 WRITE_STRING_FIELD(indexname);
2649 WRITE_STRING_FIELD(indexspace);
2650 /* access_method and where_clause not currently used */
2653 case CONSTR_EXCLUSION:
2654 appendStringInfo(str, "EXCLUSION");
2655 WRITE_NODE_FIELD(exclusions);
2656 WRITE_NODE_FIELD(options);
2657 WRITE_STRING_FIELD(indexname);
2658 WRITE_STRING_FIELD(indexspace);
2659 WRITE_STRING_FIELD(access_method);
2660 WRITE_NODE_FIELD(where_clause);
2663 case CONSTR_FOREIGN:
2664 appendStringInfo(str, "FOREIGN_KEY");
2665 WRITE_NODE_FIELD(pktable);
2666 WRITE_NODE_FIELD(fk_attrs);
2667 WRITE_NODE_FIELD(pk_attrs);
2668 WRITE_CHAR_FIELD(fk_matchtype);
2669 WRITE_CHAR_FIELD(fk_upd_action);
2670 WRITE_CHAR_FIELD(fk_del_action);
2671 WRITE_NODE_FIELD(old_conpfeqop);
2672 WRITE_BOOL_FIELD(skip_validation);
2673 WRITE_BOOL_FIELD(initially_valid);
2676 case CONSTR_ATTR_DEFERRABLE:
2677 appendStringInfo(str, "ATTR_DEFERRABLE");
2680 case CONSTR_ATTR_NOT_DEFERRABLE:
2681 appendStringInfo(str, "ATTR_NOT_DEFERRABLE");
2684 case CONSTR_ATTR_DEFERRED:
2685 appendStringInfo(str, "ATTR_DEFERRED");
2688 case CONSTR_ATTR_IMMEDIATE:
2689 appendStringInfo(str, "ATTR_IMMEDIATE");
2693 appendStringInfo(str, "<unrecognized_constraint %d>",
2694 (int) node->contype);
2702 * converts a Node into ascii string and append it to 'str'
2705 _outNode(StringInfo str, const void *obj)
2708 appendStringInfo(str, "<>");
2709 else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
2711 else if (IsA(obj, Integer) ||
2714 IsA(obj, BitString))
2716 /* nodeRead does not want to see { } around these! */
2717 _outValue(str, obj);
2721 appendStringInfoChar(str, '{');
2722 switch (nodeTag(obj))
2725 _outPlannedStmt(str, obj);
2731 _outResult(str, obj);
2734 _outModifyTable(str, obj);
2737 _outAppend(str, obj);
2740 _outMergeAppend(str, obj);
2742 case T_RecursiveUnion:
2743 _outRecursiveUnion(str, obj);
2746 _outBitmapAnd(str, obj);
2749 _outBitmapOr(str, obj);
2755 _outSeqScan(str, obj);
2758 _outIndexScan(str, obj);
2760 case T_IndexOnlyScan:
2761 _outIndexOnlyScan(str, obj);
2763 case T_BitmapIndexScan:
2764 _outBitmapIndexScan(str, obj);
2766 case T_BitmapHeapScan:
2767 _outBitmapHeapScan(str, obj);
2770 _outTidScan(str, obj);
2772 case T_SubqueryScan:
2773 _outSubqueryScan(str, obj);
2775 case T_FunctionScan:
2776 _outFunctionScan(str, obj);
2779 _outValuesScan(str, obj);
2782 _outCteScan(str, obj);
2784 case T_WorkTableScan:
2785 _outWorkTableScan(str, obj);
2788 _outForeignScan(str, obj);
2794 _outNestLoop(str, obj);
2797 _outMergeJoin(str, obj);
2800 _outHashJoin(str, obj);
2806 _outWindowAgg(str, obj);
2809 _outGroup(str, obj);
2812 _outMaterial(str, obj);
2818 _outUnique(str, obj);
2824 _outSetOp(str, obj);
2827 _outLockRows(str, obj);
2830 _outLimit(str, obj);
2832 case T_NestLoopParam:
2833 _outNestLoopParam(str, obj);
2836 _outPlanRowMark(str, obj);
2838 case T_PlanInvalItem:
2839 _outPlanInvalItem(str, obj);
2842 _outAlias(str, obj);
2845 _outRangeVar(str, obj);
2848 _outIntoClause(str, obj);
2854 _outConst(str, obj);
2857 _outParam(str, obj);
2860 _outAggref(str, obj);
2863 _outWindowFunc(str, obj);
2866 _outArrayRef(str, obj);
2869 _outFuncExpr(str, obj);
2871 case T_NamedArgExpr:
2872 _outNamedArgExpr(str, obj);
2875 _outOpExpr(str, obj);
2877 case T_DistinctExpr:
2878 _outDistinctExpr(str, obj);
2881 _outNullIfExpr(str, obj);
2883 case T_ScalarArrayOpExpr:
2884 _outScalarArrayOpExpr(str, obj);
2887 _outBoolExpr(str, obj);
2890 _outSubLink(str, obj);
2893 _outSubPlan(str, obj);
2895 case T_AlternativeSubPlan:
2896 _outAlternativeSubPlan(str, obj);
2899 _outFieldSelect(str, obj);
2902 _outFieldStore(str, obj);
2905 _outRelabelType(str, obj);
2908 _outCoerceViaIO(str, obj);
2910 case T_ArrayCoerceExpr:
2911 _outArrayCoerceExpr(str, obj);
2913 case T_ConvertRowtypeExpr:
2914 _outConvertRowtypeExpr(str, obj);
2917 _outCollateExpr(str, obj);
2920 _outCaseExpr(str, obj);
2923 _outCaseWhen(str, obj);
2925 case T_CaseTestExpr:
2926 _outCaseTestExpr(str, obj);
2929 _outArrayExpr(str, obj);
2932 _outRowExpr(str, obj);
2934 case T_RowCompareExpr:
2935 _outRowCompareExpr(str, obj);
2937 case T_CoalesceExpr:
2938 _outCoalesceExpr(str, obj);
2941 _outMinMaxExpr(str, obj);
2944 _outXmlExpr(str, obj);
2947 _outNullTest(str, obj);
2950 _outBooleanTest(str, obj);
2952 case T_CoerceToDomain:
2953 _outCoerceToDomain(str, obj);
2955 case T_CoerceToDomainValue:
2956 _outCoerceToDomainValue(str, obj);
2958 case T_SetToDefault:
2959 _outSetToDefault(str, obj);
2961 case T_CurrentOfExpr:
2962 _outCurrentOfExpr(str, obj);
2965 _outTargetEntry(str, obj);
2968 _outRangeTblRef(str, obj);
2971 _outJoinExpr(str, obj);
2974 _outFromExpr(str, obj);
2981 _outIndexPath(str, obj);
2983 case T_BitmapHeapPath:
2984 _outBitmapHeapPath(str, obj);
2986 case T_BitmapAndPath:
2987 _outBitmapAndPath(str, obj);
2989 case T_BitmapOrPath:
2990 _outBitmapOrPath(str, obj);
2993 _outTidPath(str, obj);
2996 _outForeignPath(str, obj);
2999 _outAppendPath(str, obj);
3001 case T_MergeAppendPath:
3002 _outMergeAppendPath(str, obj);
3005 _outResultPath(str, obj);
3007 case T_MaterialPath:
3008 _outMaterialPath(str, obj);
3011 _outUniquePath(str, obj);
3014 _outNestPath(str, obj);
3017 _outMergePath(str, obj);
3020 _outHashPath(str, obj);
3022 case T_PlannerGlobal:
3023 _outPlannerGlobal(str, obj);
3026 _outPlannerInfo(str, obj);
3029 _outRelOptInfo(str, obj);
3031 case T_IndexOptInfo:
3032 _outIndexOptInfo(str, obj);
3034 case T_EquivalenceClass:
3035 _outEquivalenceClass(str, obj);
3037 case T_EquivalenceMember:
3038 _outEquivalenceMember(str, obj);
3041 _outPathKey(str, obj);
3043 case T_ParamPathInfo:
3044 _outParamPathInfo(str, obj);
3046 case T_RestrictInfo:
3047 _outRestrictInfo(str, obj);
3049 case T_PlaceHolderVar:
3050 _outPlaceHolderVar(str, obj);
3052 case T_SpecialJoinInfo:
3053 _outSpecialJoinInfo(str, obj);
3055 case T_LateralJoinInfo:
3056 _outLateralJoinInfo(str, obj);
3058 case T_AppendRelInfo:
3059 _outAppendRelInfo(str, obj);
3061 case T_PlaceHolderInfo:
3062 _outPlaceHolderInfo(str, obj);
3064 case T_MinMaxAggInfo:
3065 _outMinMaxAggInfo(str, obj);
3067 case T_PlannerParamItem:
3068 _outPlannerParamItem(str, obj);
3072 _outCreateStmt(str, obj);
3074 case T_CreateForeignTableStmt:
3075 _outCreateForeignTableStmt(str, obj);
3078 _outIndexStmt(str, obj);
3081 _outNotifyStmt(str, obj);
3083 case T_DeclareCursorStmt:
3084 _outDeclareCursorStmt(str, obj);
3087 _outSelectStmt(str, obj);
3090 _outColumnDef(str, obj);
3093 _outTypeName(str, obj);
3096 _outTypeCast(str, obj);
3098 case T_CollateClause:
3099 _outCollateClause(str, obj);
3102 _outIndexElem(str, obj);
3105 _outQuery(str, obj);
3107 case T_SortGroupClause:
3108 _outSortGroupClause(str, obj);
3110 case T_WindowClause:
3111 _outWindowClause(str, obj);
3113 case T_RowMarkClause:
3114 _outRowMarkClause(str, obj);
3117 _outWithClause(str, obj);
3119 case T_CommonTableExpr:
3120 _outCommonTableExpr(str, obj);
3122 case T_SetOperationStmt:
3123 _outSetOperationStmt(str, obj);
3125 case T_RangeTblEntry:
3126 _outRangeTblEntry(str, obj);
3129 _outAExpr(str, obj);
3132 _outColumnRef(str, obj);
3135 _outParamRef(str, obj);
3138 _outAConst(str, obj);
3141 _outA_Star(str, obj);
3144 _outA_Indices(str, obj);
3146 case T_A_Indirection:
3147 _outA_Indirection(str, obj);
3150 _outA_ArrayExpr(str, obj);
3153 _outResTarget(str, obj);
3156 _outSortBy(str, obj);
3159 _outWindowDef(str, obj);
3161 case T_RangeSubselect:
3162 _outRangeSubselect(str, obj);
3164 case T_RangeFunction:
3165 _outRangeFunction(str, obj);
3168 _outConstraint(str, obj);
3171 _outFuncCall(str, obj);
3174 _outDefElem(str, obj);
3176 case T_TableLikeClause:
3177 _outTableLikeClause(str, obj);
3179 case T_LockingClause:
3180 _outLockingClause(str, obj);
3182 case T_XmlSerialize:
3183 _outXmlSerialize(str, obj);
3189 * This should be an ERROR, but it's too useful to be able to
3190 * dump structures that _outNode only understands part of.
3192 elog(WARNING, "could not dump unrecognized node type: %d",
3193 (int) nodeTag(obj));
3196 appendStringInfoChar(str, '}');
3202 * returns the ascii representation of the Node as a palloc'd string
3205 nodeToString(const void *obj)
3209 /* see stringinfo.h for an explanation of this maneuver */
3210 initStringInfo(&str);
3211 _outNode(&str, obj);