PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
outfuncs.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * outfuncs.c
4  * Output functions for Postgres tree nodes.
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/nodes/outfuncs.c
12  *
13  * NOTES
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). In addition, plan nodes should have input and
17  * output functions so that they can be sent to parallel workers.
18  * For use in debugging, we also provide output functions for nodes
19  * that appear in raw parsetrees and path. These nodes however need
20  * not have input functions.
21  *
22  *-------------------------------------------------------------------------
23  */
24 #include "postgres.h"
25 
26 #include <ctype.h>
27 
28 #include "lib/stringinfo.h"
29 #include "nodes/extensible.h"
30 #include "nodes/plannodes.h"
31 #include "nodes/relation.h"
32 #include "utils/datum.h"
33 #include "utils/rel.h"
34 
35 static void outChar(StringInfo str, char c);
36 
37 
38 /*
39  * Macros to simplify output of different kinds of fields. Use these
40  * wherever possible to reduce the chance for silly typos. Note that these
41  * hard-wire conventions about the names of the local variables in an Out
42  * routine.
43  */
44 
45 /* Write the label for the node type */
46 #define WRITE_NODE_TYPE(nodelabel) \
47  appendStringInfoString(str, nodelabel)
48 
49 /* Write an integer field (anything written as ":fldname %d") */
50 #define WRITE_INT_FIELD(fldname) \
51  appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
52 
53 /* Write an unsigned integer field (anything written as ":fldname %u") */
54 #define WRITE_UINT_FIELD(fldname) \
55  appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
56 
57 /* Write an OID field (don't hard-wire assumption that OID is same as uint) */
58 #define WRITE_OID_FIELD(fldname) \
59  appendStringInfo(str, " :" CppAsString(fldname) " %u", node->fldname)
60 
61 /* Write a long-integer field */
62 #define WRITE_LONG_FIELD(fldname) \
63  appendStringInfo(str, " :" CppAsString(fldname) " %ld", node->fldname)
64 
65 /* Write a char field (ie, one ascii character) */
66 #define WRITE_CHAR_FIELD(fldname) \
67  (appendStringInfo(str, " :" CppAsString(fldname) " "), \
68  outChar(str, node->fldname))
69 
70 /* Write an enumerated-type field as an integer code */
71 #define WRITE_ENUM_FIELD(fldname, enumtype) \
72  appendStringInfo(str, " :" CppAsString(fldname) " %d", \
73  (int) node->fldname)
74 
75 /* Write a float field --- caller must give format to define precision */
76 #define WRITE_FLOAT_FIELD(fldname,format) \
77  appendStringInfo(str, " :" CppAsString(fldname) " " format, node->fldname)
78 
79 /* Write a boolean field */
80 #define WRITE_BOOL_FIELD(fldname) \
81  appendStringInfo(str, " :" CppAsString(fldname) " %s", \
82  booltostr(node->fldname))
83 
84 /* Write a character-string (possibly NULL) field */
85 #define WRITE_STRING_FIELD(fldname) \
86  (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
87  outToken(str, node->fldname))
88 
89 /* Write a parse location field (actually same as INT case) */
90 #define WRITE_LOCATION_FIELD(fldname) \
91  appendStringInfo(str, " :" CppAsString(fldname) " %d", node->fldname)
92 
93 /* Write a Node field */
94 #define WRITE_NODE_FIELD(fldname) \
95  (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
96  outNode(str, node->fldname))
97 
98 /* Write a bitmapset field */
99 #define WRITE_BITMAPSET_FIELD(fldname) \
100  (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
101  outBitmapset(str, node->fldname))
102 
103 
104 #define booltostr(x) ((x) ? "true" : "false")
105 
106 
107 /*
108  * outToken
109  * Convert an ordinary string (eg, an identifier) into a form that
110  * will be decoded back to a plain token by read.c's functions.
111  *
112  * If a null or empty string is given, it is encoded as "<>".
113  */
114 void
115 outToken(StringInfo str, const char *s)
116 {
117  if (s == NULL || *s == '\0')
118  {
119  appendStringInfoString(str, "<>");
120  return;
121  }
122 
123  /*
124  * Look for characters or patterns that are treated specially by read.c
125  * (either in pg_strtok() or in nodeRead()), and therefore need a
126  * protective backslash.
127  */
128  /* These characters only need to be quoted at the start of the string */
129  if (*s == '<' ||
130  *s == '"' ||
131  isdigit((unsigned char) *s) ||
132  ((*s == '+' || *s == '-') &&
133  (isdigit((unsigned char) s[1]) || s[1] == '.')))
134  appendStringInfoChar(str, '\\');
135  while (*s)
136  {
137  /* These chars must be backslashed anywhere in the string */
138  if (*s == ' ' || *s == '\n' || *s == '\t' ||
139  *s == '(' || *s == ')' || *s == '{' || *s == '}' ||
140  *s == '\\')
141  appendStringInfoChar(str, '\\');
142  appendStringInfoChar(str, *s++);
143  }
144 }
145 
146 /*
147  * Convert one char. Goes through outToken() so that special characters are
148  * escaped.
149  */
150 static void
151 outChar(StringInfo str, char c)
152 {
153  char in[2];
154 
155  in[0] = c;
156  in[1] = '\0';
157 
158  outToken(str, in);
159 }
160 
161 static void
162 _outList(StringInfo str, const List *node)
163 {
164  const ListCell *lc;
165 
166  appendStringInfoChar(str, '(');
167 
168  if (IsA(node, IntList))
169  appendStringInfoChar(str, 'i');
170  else if (IsA(node, OidList))
171  appendStringInfoChar(str, 'o');
172 
173  foreach(lc, node)
174  {
175  /*
176  * For the sake of backward compatibility, we emit a slightly
177  * different whitespace format for lists of nodes vs. other types of
178  * lists. XXX: is this necessary?
179  */
180  if (IsA(node, List))
181  {
182  outNode(str, lfirst(lc));
183  if (lnext(lc))
184  appendStringInfoChar(str, ' ');
185  }
186  else if (IsA(node, IntList))
187  appendStringInfo(str, " %d", lfirst_int(lc));
188  else if (IsA(node, OidList))
189  appendStringInfo(str, " %u", lfirst_oid(lc));
190  else
191  elog(ERROR, "unrecognized list node type: %d",
192  (int) node->type);
193  }
194 
195  appendStringInfoChar(str, ')');
196 }
197 
198 /*
199  * outBitmapset -
200  * converts a bitmap set of integers
201  *
202  * Note: the output format is "(b int int ...)", similar to an integer List.
203  */
204 void
206 {
207  int x;
208 
209  appendStringInfoChar(str, '(');
210  appendStringInfoChar(str, 'b');
211  x = -1;
212  while ((x = bms_next_member(bms, x)) >= 0)
213  appendStringInfo(str, " %d", x);
214  appendStringInfoChar(str, ')');
215 }
216 
217 /*
218  * Print the value of a Datum given its type.
219  */
220 void
221 outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
222 {
223  Size length,
224  i;
225  char *s;
226 
227  length = datumGetSize(value, typbyval, typlen);
228 
229  if (typbyval)
230  {
231  s = (char *) (&value);
232  appendStringInfo(str, "%u [ ", (unsigned int) length);
233  for (i = 0; i < (Size) sizeof(Datum); i++)
234  appendStringInfo(str, "%d ", (int) (s[i]));
235  appendStringInfoChar(str, ']');
236  }
237  else
238  {
239  s = (char *) DatumGetPointer(value);
240  if (!PointerIsValid(s))
241  appendStringInfoString(str, "0 [ ]");
242  else
243  {
244  appendStringInfo(str, "%u [ ", (unsigned int) length);
245  for (i = 0; i < length; i++)
246  appendStringInfo(str, "%d ", (int) (s[i]));
247  appendStringInfoChar(str, ']');
248  }
249  }
250 }
251 
252 
253 /*
254  * Stuff from plannodes.h
255  */
256 
257 static void
259 {
260  WRITE_NODE_TYPE("PLANNEDSTMT");
261 
262  WRITE_ENUM_FIELD(commandType, CmdType);
263  WRITE_UINT_FIELD(queryId);
264  WRITE_BOOL_FIELD(hasReturning);
265  WRITE_BOOL_FIELD(hasModifyingCTE);
266  WRITE_BOOL_FIELD(canSetTag);
267  WRITE_BOOL_FIELD(transientPlan);
268  WRITE_BOOL_FIELD(dependsOnRole);
269  WRITE_BOOL_FIELD(parallelModeNeeded);
270  WRITE_NODE_FIELD(planTree);
271  WRITE_NODE_FIELD(rtable);
272  WRITE_NODE_FIELD(resultRelations);
273  WRITE_NODE_FIELD(nonleafResultRelations);
274  WRITE_NODE_FIELD(rootResultRelations);
275  WRITE_NODE_FIELD(subplans);
276  WRITE_BITMAPSET_FIELD(rewindPlanIDs);
277  WRITE_NODE_FIELD(rowMarks);
278  WRITE_NODE_FIELD(relationOids);
279  WRITE_NODE_FIELD(invalItems);
280  WRITE_INT_FIELD(nParamExec);
281  WRITE_NODE_FIELD(utilityStmt);
282  WRITE_LOCATION_FIELD(stmt_location);
283  WRITE_LOCATION_FIELD(stmt_len);
284 }
285 
286 /*
287  * print the basic stuff of all nodes that inherit from Plan
288  */
289 static void
290 _outPlanInfo(StringInfo str, const Plan *node)
291 {
292  WRITE_FLOAT_FIELD(startup_cost, "%.2f");
293  WRITE_FLOAT_FIELD(total_cost, "%.2f");
294  WRITE_FLOAT_FIELD(plan_rows, "%.0f");
295  WRITE_INT_FIELD(plan_width);
296  WRITE_BOOL_FIELD(parallel_aware);
297  WRITE_BOOL_FIELD(parallel_safe);
298  WRITE_INT_FIELD(plan_node_id);
299  WRITE_NODE_FIELD(targetlist);
300  WRITE_NODE_FIELD(qual);
301  WRITE_NODE_FIELD(lefttree);
302  WRITE_NODE_FIELD(righttree);
303  WRITE_NODE_FIELD(initPlan);
304  WRITE_BITMAPSET_FIELD(extParam);
305  WRITE_BITMAPSET_FIELD(allParam);
306 }
307 
308 /*
309  * print the basic stuff of all nodes that inherit from Scan
310  */
311 static void
312 _outScanInfo(StringInfo str, const Scan *node)
313 {
314  _outPlanInfo(str, (const Plan *) node);
315 
316  WRITE_UINT_FIELD(scanrelid);
317 }
318 
319 /*
320  * print the basic stuff of all nodes that inherit from Join
321  */
322 static void
324 {
325  _outPlanInfo(str, (const Plan *) node);
326 
327  WRITE_ENUM_FIELD(jointype, JoinType);
328  WRITE_BOOL_FIELD(inner_unique);
329  WRITE_NODE_FIELD(joinqual);
330 }
331 
332 
333 static void
334 _outPlan(StringInfo str, const Plan *node)
335 {
336  WRITE_NODE_TYPE("PLAN");
337 
338  _outPlanInfo(str, (const Plan *) node);
339 }
340 
341 static void
342 _outResult(StringInfo str, const Result *node)
343 {
344  WRITE_NODE_TYPE("RESULT");
345 
346  _outPlanInfo(str, (const Plan *) node);
347 
348  WRITE_NODE_FIELD(resconstantqual);
349 }
350 
351 static void
353 {
354  WRITE_NODE_TYPE("PROJECTSET");
355 
356  _outPlanInfo(str, (const Plan *) node);
357 }
358 
359 static void
361 {
362  WRITE_NODE_TYPE("MODIFYTABLE");
363 
364  _outPlanInfo(str, (const Plan *) node);
365 
366  WRITE_ENUM_FIELD(operation, CmdType);
367  WRITE_BOOL_FIELD(canSetTag);
368  WRITE_UINT_FIELD(nominalRelation);
369  WRITE_NODE_FIELD(partitioned_rels);
370  WRITE_NODE_FIELD(resultRelations);
371  WRITE_INT_FIELD(resultRelIndex);
372  WRITE_INT_FIELD(rootResultRelIndex);
373  WRITE_NODE_FIELD(plans);
374  WRITE_NODE_FIELD(withCheckOptionLists);
375  WRITE_NODE_FIELD(returningLists);
376  WRITE_NODE_FIELD(fdwPrivLists);
377  WRITE_BITMAPSET_FIELD(fdwDirectModifyPlans);
378  WRITE_NODE_FIELD(rowMarks);
379  WRITE_INT_FIELD(epqParam);
380  WRITE_ENUM_FIELD(onConflictAction, OnConflictAction);
381  WRITE_NODE_FIELD(arbiterIndexes);
382  WRITE_NODE_FIELD(onConflictSet);
383  WRITE_NODE_FIELD(onConflictWhere);
384  WRITE_UINT_FIELD(exclRelRTI);
385  WRITE_NODE_FIELD(exclRelTlist);
386 }
387 
388 static void
389 _outAppend(StringInfo str, const Append *node)
390 {
391  WRITE_NODE_TYPE("APPEND");
392 
393  _outPlanInfo(str, (const Plan *) node);
394 
395  WRITE_NODE_FIELD(partitioned_rels);
396  WRITE_NODE_FIELD(appendplans);
397 }
398 
399 static void
401 {
402  int i;
403 
404  WRITE_NODE_TYPE("MERGEAPPEND");
405 
406  _outPlanInfo(str, (const Plan *) node);
407 
408  WRITE_NODE_FIELD(partitioned_rels);
409  WRITE_NODE_FIELD(mergeplans);
410 
411  WRITE_INT_FIELD(numCols);
412 
413  appendStringInfoString(str, " :sortColIdx");
414  for (i = 0; i < node->numCols; i++)
415  appendStringInfo(str, " %d", node->sortColIdx[i]);
416 
417  appendStringInfoString(str, " :sortOperators");
418  for (i = 0; i < node->numCols; i++)
419  appendStringInfo(str, " %u", node->sortOperators[i]);
420 
421  appendStringInfoString(str, " :collations");
422  for (i = 0; i < node->numCols; i++)
423  appendStringInfo(str, " %u", node->collations[i]);
424 
425  appendStringInfoString(str, " :nullsFirst");
426  for (i = 0; i < node->numCols; i++)
427  appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
428 }
429 
430 static void
432 {
433  int i;
434 
435  WRITE_NODE_TYPE("RECURSIVEUNION");
436 
437  _outPlanInfo(str, (const Plan *) node);
438 
439  WRITE_INT_FIELD(wtParam);
440  WRITE_INT_FIELD(numCols);
441 
442  appendStringInfoString(str, " :dupColIdx");
443  for (i = 0; i < node->numCols; i++)
444  appendStringInfo(str, " %d", node->dupColIdx[i]);
445 
446  appendStringInfoString(str, " :dupOperators");
447  for (i = 0; i < node->numCols; i++)
448  appendStringInfo(str, " %u", node->dupOperators[i]);
449 
450  WRITE_LONG_FIELD(numGroups);
451 }
452 
453 static void
455 {
456  WRITE_NODE_TYPE("BITMAPAND");
457 
458  _outPlanInfo(str, (const Plan *) node);
459 
460  WRITE_NODE_FIELD(bitmapplans);
461 }
462 
463 static void
465 {
466  WRITE_NODE_TYPE("BITMAPOR");
467 
468  _outPlanInfo(str, (const Plan *) node);
469 
470  WRITE_BOOL_FIELD(isshared);
471  WRITE_NODE_FIELD(bitmapplans);
472 }
473 
474 static void
475 _outGather(StringInfo str, const Gather *node)
476 {
477  WRITE_NODE_TYPE("GATHER");
478 
479  _outPlanInfo(str, (const Plan *) node);
480 
481  WRITE_INT_FIELD(num_workers);
482  WRITE_BOOL_FIELD(single_copy);
483  WRITE_BOOL_FIELD(invisible);
484 }
485 
486 static void
488 {
489  int i;
490 
491  WRITE_NODE_TYPE("GATHERMERGE");
492 
493  _outPlanInfo(str, (const Plan *) node);
494 
495  WRITE_INT_FIELD(num_workers);
496  WRITE_INT_FIELD(numCols);
497 
498  appendStringInfoString(str, " :sortColIdx");
499  for (i = 0; i < node->numCols; i++)
500  appendStringInfo(str, " %d", node->sortColIdx[i]);
501 
502  appendStringInfoString(str, " :sortOperators");
503  for (i = 0; i < node->numCols; i++)
504  appendStringInfo(str, " %u", node->sortOperators[i]);
505 
506  appendStringInfoString(str, " :collations");
507  for (i = 0; i < node->numCols; i++)
508  appendStringInfo(str, " %u", node->collations[i]);
509 
510  appendStringInfoString(str, " :nullsFirst");
511  for (i = 0; i < node->numCols; i++)
512  appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
513 }
514 
515 static void
516 _outScan(StringInfo str, const Scan *node)
517 {
518  WRITE_NODE_TYPE("SCAN");
519 
520  _outScanInfo(str, node);
521 }
522 
523 static void
524 _outSeqScan(StringInfo str, const SeqScan *node)
525 {
526  WRITE_NODE_TYPE("SEQSCAN");
527 
528  _outScanInfo(str, (const Scan *) node);
529 }
530 
531 static void
533 {
534  WRITE_NODE_TYPE("SAMPLESCAN");
535 
536  _outScanInfo(str, (const Scan *) node);
537 
538  WRITE_NODE_FIELD(tablesample);
539 }
540 
541 static void
543 {
544  WRITE_NODE_TYPE("INDEXSCAN");
545 
546  _outScanInfo(str, (const Scan *) node);
547 
548  WRITE_OID_FIELD(indexid);
549  WRITE_NODE_FIELD(indexqual);
550  WRITE_NODE_FIELD(indexqualorig);
551  WRITE_NODE_FIELD(indexorderby);
552  WRITE_NODE_FIELD(indexorderbyorig);
553  WRITE_NODE_FIELD(indexorderbyops);
554  WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
555 }
556 
557 static void
559 {
560  WRITE_NODE_TYPE("INDEXONLYSCAN");
561 
562  _outScanInfo(str, (const Scan *) node);
563 
564  WRITE_OID_FIELD(indexid);
565  WRITE_NODE_FIELD(indexqual);
566  WRITE_NODE_FIELD(indexorderby);
567  WRITE_NODE_FIELD(indextlist);
568  WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
569 }
570 
571 static void
573 {
574  WRITE_NODE_TYPE("BITMAPINDEXSCAN");
575 
576  _outScanInfo(str, (const Scan *) node);
577 
578  WRITE_OID_FIELD(indexid);
579  WRITE_BOOL_FIELD(isshared);
580  WRITE_NODE_FIELD(indexqual);
581  WRITE_NODE_FIELD(indexqualorig);
582 }
583 
584 static void
586 {
587  WRITE_NODE_TYPE("BITMAPHEAPSCAN");
588 
589  _outScanInfo(str, (const Scan *) node);
590 
591  WRITE_NODE_FIELD(bitmapqualorig);
592 }
593 
594 static void
595 _outTidScan(StringInfo str, const TidScan *node)
596 {
597  WRITE_NODE_TYPE("TIDSCAN");
598 
599  _outScanInfo(str, (const Scan *) node);
600 
601  WRITE_NODE_FIELD(tidquals);
602 }
603 
604 static void
606 {
607  WRITE_NODE_TYPE("SUBQUERYSCAN");
608 
609  _outScanInfo(str, (const Scan *) node);
610 
611  WRITE_NODE_FIELD(subplan);
612 }
613 
614 static void
616 {
617  WRITE_NODE_TYPE("FUNCTIONSCAN");
618 
619  _outScanInfo(str, (const Scan *) node);
620 
622  WRITE_BOOL_FIELD(funcordinality);
623 }
624 
625 static void
627 {
628  WRITE_NODE_TYPE("TABLEFUNCSCAN");
629 
630  _outScanInfo(str, (const Scan *) node);
631 
632  WRITE_NODE_FIELD(tablefunc);
633 }
634 
635 static void
637 {
638  WRITE_NODE_TYPE("VALUESSCAN");
639 
640  _outScanInfo(str, (const Scan *) node);
641 
642  WRITE_NODE_FIELD(values_lists);
643 }
644 
645 static void
646 _outCteScan(StringInfo str, const CteScan *node)
647 {
648  WRITE_NODE_TYPE("CTESCAN");
649 
650  _outScanInfo(str, (const Scan *) node);
651 
652  WRITE_INT_FIELD(ctePlanId);
653  WRITE_INT_FIELD(cteParam);
654 }
655 
656 static void
658 {
659  WRITE_NODE_TYPE("NAMEDTUPLESTORESCAN");
660 
661  _outScanInfo(str, (const Scan *) node);
662 
663  WRITE_STRING_FIELD(enrname);
664 }
665 
666 static void
668 {
669  WRITE_NODE_TYPE("WORKTABLESCAN");
670 
671  _outScanInfo(str, (const Scan *) node);
672 
673  WRITE_INT_FIELD(wtParam);
674 }
675 
676 static void
678 {
679  WRITE_NODE_TYPE("FOREIGNSCAN");
680 
681  _outScanInfo(str, (const Scan *) node);
682 
683  WRITE_ENUM_FIELD(operation, CmdType);
684  WRITE_OID_FIELD(fs_server);
685  WRITE_NODE_FIELD(fdw_exprs);
686  WRITE_NODE_FIELD(fdw_private);
687  WRITE_NODE_FIELD(fdw_scan_tlist);
688  WRITE_NODE_FIELD(fdw_recheck_quals);
689  WRITE_BITMAPSET_FIELD(fs_relids);
690  WRITE_BOOL_FIELD(fsSystemCol);
691 }
692 
693 static void
695 {
696  WRITE_NODE_TYPE("CUSTOMSCAN");
697 
698  _outScanInfo(str, (const Scan *) node);
699 
700  WRITE_UINT_FIELD(flags);
701  WRITE_NODE_FIELD(custom_plans);
702  WRITE_NODE_FIELD(custom_exprs);
703  WRITE_NODE_FIELD(custom_private);
704  WRITE_NODE_FIELD(custom_scan_tlist);
705  WRITE_BITMAPSET_FIELD(custom_relids);
706  /* CustomName is a key to lookup CustomScanMethods */
707  appendStringInfoString(str, " :methods ");
708  outToken(str, node->methods->CustomName);
709 }
710 
711 static void
712 _outJoin(StringInfo str, const Join *node)
713 {
714  WRITE_NODE_TYPE("JOIN");
715 
716  _outJoinPlanInfo(str, (const Join *) node);
717 }
718 
719 static void
721 {
722  WRITE_NODE_TYPE("NESTLOOP");
723 
724  _outJoinPlanInfo(str, (const Join *) node);
725 
726  WRITE_NODE_FIELD(nestParams);
727 }
728 
729 static void
731 {
732  int numCols;
733  int i;
734 
735  WRITE_NODE_TYPE("MERGEJOIN");
736 
737  _outJoinPlanInfo(str, (const Join *) node);
738 
739  WRITE_BOOL_FIELD(skip_mark_restore);
740  WRITE_NODE_FIELD(mergeclauses);
741 
742  numCols = list_length(node->mergeclauses);
743 
744  appendStringInfoString(str, " :mergeFamilies");
745  for (i = 0; i < numCols; i++)
746  appendStringInfo(str, " %u", node->mergeFamilies[i]);
747 
748  appendStringInfoString(str, " :mergeCollations");
749  for (i = 0; i < numCols; i++)
750  appendStringInfo(str, " %u", node->mergeCollations[i]);
751 
752  appendStringInfoString(str, " :mergeStrategies");
753  for (i = 0; i < numCols; i++)
754  appendStringInfo(str, " %d", node->mergeStrategies[i]);
755 
756  appendStringInfoString(str, " :mergeNullsFirst");
757  for (i = 0; i < numCols; i++)
758  appendStringInfo(str, " %s", booltostr(node->mergeNullsFirst[i]));
759 }
760 
761 static void
763 {
764  WRITE_NODE_TYPE("HASHJOIN");
765 
766  _outJoinPlanInfo(str, (const Join *) node);
767 
768  WRITE_NODE_FIELD(hashclauses);
769 }
770 
771 static void
772 _outAgg(StringInfo str, const Agg *node)
773 {
774  int i;
775 
776  WRITE_NODE_TYPE("AGG");
777 
778  _outPlanInfo(str, (const Plan *) node);
779 
780  WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
781  WRITE_ENUM_FIELD(aggsplit, AggSplit);
782  WRITE_INT_FIELD(numCols);
783 
784  appendStringInfoString(str, " :grpColIdx");
785  for (i = 0; i < node->numCols; i++)
786  appendStringInfo(str, " %d", node->grpColIdx[i]);
787 
788  appendStringInfoString(str, " :grpOperators");
789  for (i = 0; i < node->numCols; i++)
790  appendStringInfo(str, " %u", node->grpOperators[i]);
791 
792  WRITE_LONG_FIELD(numGroups);
793  WRITE_BITMAPSET_FIELD(aggParams);
794  WRITE_NODE_FIELD(groupingSets);
795  WRITE_NODE_FIELD(chain);
796 }
797 
798 static void
800 {
801  int i;
802 
803  WRITE_NODE_TYPE("WINDOWAGG");
804 
805  _outPlanInfo(str, (const Plan *) node);
806 
807  WRITE_UINT_FIELD(winref);
808  WRITE_INT_FIELD(partNumCols);
809 
810  appendStringInfoString(str, " :partColIdx");
811  for (i = 0; i < node->partNumCols; i++)
812  appendStringInfo(str, " %d", node->partColIdx[i]);
813 
814  appendStringInfoString(str, " :partOperations");
815  for (i = 0; i < node->partNumCols; i++)
816  appendStringInfo(str, " %u", node->partOperators[i]);
817 
818  WRITE_INT_FIELD(ordNumCols);
819 
820  appendStringInfoString(str, " :ordColIdx");
821  for (i = 0; i < node->ordNumCols; i++)
822  appendStringInfo(str, " %d", node->ordColIdx[i]);
823 
824  appendStringInfoString(str, " :ordOperations");
825  for (i = 0; i < node->ordNumCols; i++)
826  appendStringInfo(str, " %u", node->ordOperators[i]);
827 
828  WRITE_INT_FIELD(frameOptions);
829  WRITE_NODE_FIELD(startOffset);
830  WRITE_NODE_FIELD(endOffset);
831 }
832 
833 static void
834 _outGroup(StringInfo str, const Group *node)
835 {
836  int i;
837 
838  WRITE_NODE_TYPE("GROUP");
839 
840  _outPlanInfo(str, (const Plan *) node);
841 
842  WRITE_INT_FIELD(numCols);
843 
844  appendStringInfoString(str, " :grpColIdx");
845  for (i = 0; i < node->numCols; i++)
846  appendStringInfo(str, " %d", node->grpColIdx[i]);
847 
848  appendStringInfoString(str, " :grpOperators");
849  for (i = 0; i < node->numCols; i++)
850  appendStringInfo(str, " %u", node->grpOperators[i]);
851 }
852 
853 static void
855 {
856  WRITE_NODE_TYPE("MATERIAL");
857 
858  _outPlanInfo(str, (const Plan *) node);
859 }
860 
861 static void
862 _outSort(StringInfo str, const Sort *node)
863 {
864  int i;
865 
866  WRITE_NODE_TYPE("SORT");
867 
868  _outPlanInfo(str, (const Plan *) node);
869 
870  WRITE_INT_FIELD(numCols);
871 
872  appendStringInfoString(str, " :sortColIdx");
873  for (i = 0; i < node->numCols; i++)
874  appendStringInfo(str, " %d", node->sortColIdx[i]);
875 
876  appendStringInfoString(str, " :sortOperators");
877  for (i = 0; i < node->numCols; i++)
878  appendStringInfo(str, " %u", node->sortOperators[i]);
879 
880  appendStringInfoString(str, " :collations");
881  for (i = 0; i < node->numCols; i++)
882  appendStringInfo(str, " %u", node->collations[i]);
883 
884  appendStringInfoString(str, " :nullsFirst");
885  for (i = 0; i < node->numCols; i++)
886  appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
887 }
888 
889 static void
890 _outUnique(StringInfo str, const Unique *node)
891 {
892  int i;
893 
894  WRITE_NODE_TYPE("UNIQUE");
895 
896  _outPlanInfo(str, (const Plan *) node);
897 
898  WRITE_INT_FIELD(numCols);
899 
900  appendStringInfoString(str, " :uniqColIdx");
901  for (i = 0; i < node->numCols; i++)
902  appendStringInfo(str, " %d", node->uniqColIdx[i]);
903 
904  appendStringInfoString(str, " :uniqOperators");
905  for (i = 0; i < node->numCols; i++)
906  appendStringInfo(str, " %u", node->uniqOperators[i]);
907 }
908 
909 static void
910 _outHash(StringInfo str, const Hash *node)
911 {
912  WRITE_NODE_TYPE("HASH");
913 
914  _outPlanInfo(str, (const Plan *) node);
915 
916  WRITE_OID_FIELD(skewTable);
917  WRITE_INT_FIELD(skewColumn);
918  WRITE_BOOL_FIELD(skewInherit);
919 }
920 
921 static void
922 _outSetOp(StringInfo str, const SetOp *node)
923 {
924  int i;
925 
926  WRITE_NODE_TYPE("SETOP");
927 
928  _outPlanInfo(str, (const Plan *) node);
929 
931  WRITE_ENUM_FIELD(strategy, SetOpStrategy);
932  WRITE_INT_FIELD(numCols);
933 
934  appendStringInfoString(str, " :dupColIdx");
935  for (i = 0; i < node->numCols; i++)
936  appendStringInfo(str, " %d", node->dupColIdx[i]);
937 
938  appendStringInfoString(str, " :dupOperators");
939  for (i = 0; i < node->numCols; i++)
940  appendStringInfo(str, " %u", node->dupOperators[i]);
941 
942  WRITE_INT_FIELD(flagColIdx);
943  WRITE_INT_FIELD(firstFlag);
944  WRITE_LONG_FIELD(numGroups);
945 }
946 
947 static void
949 {
950  WRITE_NODE_TYPE("LOCKROWS");
951 
952  _outPlanInfo(str, (const Plan *) node);
953 
954  WRITE_NODE_FIELD(rowMarks);
955  WRITE_INT_FIELD(epqParam);
956 }
957 
958 static void
959 _outLimit(StringInfo str, const Limit *node)
960 {
961  WRITE_NODE_TYPE("LIMIT");
962 
963  _outPlanInfo(str, (const Plan *) node);
964 
965  WRITE_NODE_FIELD(limitOffset);
966  WRITE_NODE_FIELD(limitCount);
967 }
968 
969 static void
971 {
972  WRITE_NODE_TYPE("NESTLOOPPARAM");
973 
974  WRITE_INT_FIELD(paramno);
975  WRITE_NODE_FIELD(paramval);
976 }
977 
978 static void
980 {
981  WRITE_NODE_TYPE("PLANROWMARK");
982 
983  WRITE_UINT_FIELD(rti);
984  WRITE_UINT_FIELD(prti);
985  WRITE_UINT_FIELD(rowmarkId);
986  WRITE_ENUM_FIELD(markType, RowMarkType);
987  WRITE_INT_FIELD(allMarkTypes);
989  WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
990  WRITE_BOOL_FIELD(isParent);
991 }
992 
993 static void
995 {
996  WRITE_NODE_TYPE("PLANINVALITEM");
997 
998  WRITE_INT_FIELD(cacheId);
999  WRITE_UINT_FIELD(hashValue);
1000 }
1001 
1002 /*****************************************************************************
1003  *
1004  * Stuff from primnodes.h.
1005  *
1006  *****************************************************************************/
1007 
1008 static void
1009 _outAlias(StringInfo str, const Alias *node)
1010 {
1011  WRITE_NODE_TYPE("ALIAS");
1012 
1013  WRITE_STRING_FIELD(aliasname);
1014  WRITE_NODE_FIELD(colnames);
1015 }
1016 
1017 static void
1019 {
1020  WRITE_NODE_TYPE("RANGEVAR");
1021 
1022  /*
1023  * we deliberately ignore catalogname here, since it is presently not
1024  * semantically meaningful
1025  */
1026  WRITE_STRING_FIELD(schemaname);
1027  WRITE_STRING_FIELD(relname);
1028  WRITE_BOOL_FIELD(inh);
1029  WRITE_CHAR_FIELD(relpersistence);
1030  WRITE_NODE_FIELD(alias);
1031  WRITE_LOCATION_FIELD(location);
1032 }
1033 
1034 static void
1036 {
1037  WRITE_NODE_TYPE("TABLEFUNC");
1038 
1039  WRITE_NODE_FIELD(ns_uris);
1040  WRITE_NODE_FIELD(ns_names);
1041  WRITE_NODE_FIELD(docexpr);
1042  WRITE_NODE_FIELD(rowexpr);
1043  WRITE_NODE_FIELD(colnames);
1044  WRITE_NODE_FIELD(coltypes);
1045  WRITE_NODE_FIELD(coltypmods);
1046  WRITE_NODE_FIELD(colcollations);
1047  WRITE_NODE_FIELD(colexprs);
1048  WRITE_NODE_FIELD(coldefexprs);
1049  WRITE_BITMAPSET_FIELD(notnulls);
1050  WRITE_INT_FIELD(ordinalitycol);
1051  WRITE_LOCATION_FIELD(location);
1052 }
1053 
1054 static void
1056 {
1057  WRITE_NODE_TYPE("INTOCLAUSE");
1058 
1059  WRITE_NODE_FIELD(rel);
1060  WRITE_NODE_FIELD(colNames);
1062  WRITE_ENUM_FIELD(onCommit, OnCommitAction);
1063  WRITE_STRING_FIELD(tableSpaceName);
1064  WRITE_NODE_FIELD(viewQuery);
1065  WRITE_BOOL_FIELD(skipData);
1066 }
1067 
1068 static void
1069 _outVar(StringInfo str, const Var *node)
1070 {
1071  WRITE_NODE_TYPE("VAR");
1072 
1073  WRITE_UINT_FIELD(varno);
1074  WRITE_INT_FIELD(varattno);
1075  WRITE_OID_FIELD(vartype);
1076  WRITE_INT_FIELD(vartypmod);
1077  WRITE_OID_FIELD(varcollid);
1078  WRITE_UINT_FIELD(varlevelsup);
1079  WRITE_UINT_FIELD(varnoold);
1080  WRITE_INT_FIELD(varoattno);
1081  WRITE_LOCATION_FIELD(location);
1082 }
1083 
1084 static void
1085 _outConst(StringInfo str, const Const *node)
1086 {
1087  WRITE_NODE_TYPE("CONST");
1088 
1089  WRITE_OID_FIELD(consttype);
1090  WRITE_INT_FIELD(consttypmod);
1091  WRITE_OID_FIELD(constcollid);
1092  WRITE_INT_FIELD(constlen);
1093  WRITE_BOOL_FIELD(constbyval);
1094  WRITE_BOOL_FIELD(constisnull);
1095  WRITE_LOCATION_FIELD(location);
1096 
1097  appendStringInfoString(str, " :constvalue ");
1098  if (node->constisnull)
1099  appendStringInfoString(str, "<>");
1100  else
1101  outDatum(str, node->constvalue, node->constlen, node->constbyval);
1102 }
1103 
1104 static void
1105 _outParam(StringInfo str, const Param *node)
1106 {
1107  WRITE_NODE_TYPE("PARAM");
1108 
1109  WRITE_ENUM_FIELD(paramkind, ParamKind);
1110  WRITE_INT_FIELD(paramid);
1111  WRITE_OID_FIELD(paramtype);
1112  WRITE_INT_FIELD(paramtypmod);
1113  WRITE_OID_FIELD(paramcollid);
1114  WRITE_LOCATION_FIELD(location);
1115 }
1116 
1117 static void
1118 _outAggref(StringInfo str, const Aggref *node)
1119 {
1120  WRITE_NODE_TYPE("AGGREF");
1121 
1122  WRITE_OID_FIELD(aggfnoid);
1123  WRITE_OID_FIELD(aggtype);
1124  WRITE_OID_FIELD(aggcollid);
1125  WRITE_OID_FIELD(inputcollid);
1126  WRITE_OID_FIELD(aggtranstype);
1127  WRITE_NODE_FIELD(aggargtypes);
1128  WRITE_NODE_FIELD(aggdirectargs);
1130  WRITE_NODE_FIELD(aggorder);
1131  WRITE_NODE_FIELD(aggdistinct);
1132  WRITE_NODE_FIELD(aggfilter);
1133  WRITE_BOOL_FIELD(aggstar);
1134  WRITE_BOOL_FIELD(aggvariadic);
1135  WRITE_CHAR_FIELD(aggkind);
1136  WRITE_UINT_FIELD(agglevelsup);
1137  WRITE_ENUM_FIELD(aggsplit, AggSplit);
1138  WRITE_LOCATION_FIELD(location);
1139 }
1140 
1141 static void
1143 {
1144  WRITE_NODE_TYPE("GROUPINGFUNC");
1145 
1147  WRITE_NODE_FIELD(refs);
1148  WRITE_NODE_FIELD(cols);
1149  WRITE_UINT_FIELD(agglevelsup);
1150  WRITE_LOCATION_FIELD(location);
1151 }
1152 
1153 static void
1155 {
1156  WRITE_NODE_TYPE("WINDOWFUNC");
1157 
1158  WRITE_OID_FIELD(winfnoid);
1159  WRITE_OID_FIELD(wintype);
1160  WRITE_OID_FIELD(wincollid);
1161  WRITE_OID_FIELD(inputcollid);
1163  WRITE_NODE_FIELD(aggfilter);
1164  WRITE_UINT_FIELD(winref);
1165  WRITE_BOOL_FIELD(winstar);
1166  WRITE_BOOL_FIELD(winagg);
1167  WRITE_LOCATION_FIELD(location);
1168 }
1169 
1170 static void
1172 {
1173  WRITE_NODE_TYPE("ARRAYREF");
1174 
1175  WRITE_OID_FIELD(refarraytype);
1176  WRITE_OID_FIELD(refelemtype);
1177  WRITE_INT_FIELD(reftypmod);
1178  WRITE_OID_FIELD(refcollid);
1179  WRITE_NODE_FIELD(refupperindexpr);
1180  WRITE_NODE_FIELD(reflowerindexpr);
1181  WRITE_NODE_FIELD(refexpr);
1182  WRITE_NODE_FIELD(refassgnexpr);
1183 }
1184 
1185 static void
1187 {
1188  WRITE_NODE_TYPE("FUNCEXPR");
1189 
1190  WRITE_OID_FIELD(funcid);
1191  WRITE_OID_FIELD(funcresulttype);
1192  WRITE_BOOL_FIELD(funcretset);
1193  WRITE_BOOL_FIELD(funcvariadic);
1194  WRITE_ENUM_FIELD(funcformat, CoercionForm);
1195  WRITE_OID_FIELD(funccollid);
1196  WRITE_OID_FIELD(inputcollid);
1198  WRITE_LOCATION_FIELD(location);
1199 }
1200 
1201 static void
1203 {
1204  WRITE_NODE_TYPE("NAMEDARGEXPR");
1205 
1208  WRITE_INT_FIELD(argnumber);
1209  WRITE_LOCATION_FIELD(location);
1210 }
1211 
1212 static void
1213 _outOpExpr(StringInfo str, const OpExpr *node)
1214 {
1215  WRITE_NODE_TYPE("OPEXPR");
1216 
1217  WRITE_OID_FIELD(opno);
1218  WRITE_OID_FIELD(opfuncid);
1219  WRITE_OID_FIELD(opresulttype);
1220  WRITE_BOOL_FIELD(opretset);
1221  WRITE_OID_FIELD(opcollid);
1222  WRITE_OID_FIELD(inputcollid);
1224  WRITE_LOCATION_FIELD(location);
1225 }
1226 
1227 static void
1229 {
1230  WRITE_NODE_TYPE("DISTINCTEXPR");
1231 
1232  WRITE_OID_FIELD(opno);
1233  WRITE_OID_FIELD(opfuncid);
1234  WRITE_OID_FIELD(opresulttype);
1235  WRITE_BOOL_FIELD(opretset);
1236  WRITE_OID_FIELD(opcollid);
1237  WRITE_OID_FIELD(inputcollid);
1239  WRITE_LOCATION_FIELD(location);
1240 }
1241 
1242 static void
1244 {
1245  WRITE_NODE_TYPE("NULLIFEXPR");
1246 
1247  WRITE_OID_FIELD(opno);
1248  WRITE_OID_FIELD(opfuncid);
1249  WRITE_OID_FIELD(opresulttype);
1250  WRITE_BOOL_FIELD(opretset);
1251  WRITE_OID_FIELD(opcollid);
1252  WRITE_OID_FIELD(inputcollid);
1254  WRITE_LOCATION_FIELD(location);
1255 }
1256 
1257 static void
1259 {
1260  WRITE_NODE_TYPE("SCALARARRAYOPEXPR");
1261 
1262  WRITE_OID_FIELD(opno);
1263  WRITE_OID_FIELD(opfuncid);
1264  WRITE_BOOL_FIELD(useOr);
1265  WRITE_OID_FIELD(inputcollid);
1267  WRITE_LOCATION_FIELD(location);
1268 }
1269 
1270 static void
1272 {
1273  char *opstr = NULL;
1274 
1275  WRITE_NODE_TYPE("BOOLEXPR");
1276 
1277  /* do-it-yourself enum representation */
1278  switch (node->boolop)
1279  {
1280  case AND_EXPR:
1281  opstr = "and";
1282  break;
1283  case OR_EXPR:
1284  opstr = "or";
1285  break;
1286  case NOT_EXPR:
1287  opstr = "not";
1288  break;
1289  }
1290  appendStringInfoString(str, " :boolop ");
1291  outToken(str, opstr);
1292 
1294  WRITE_LOCATION_FIELD(location);
1295 }
1296 
1297 static void
1298 _outSubLink(StringInfo str, const SubLink *node)
1299 {
1300  WRITE_NODE_TYPE("SUBLINK");
1301 
1302  WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1303  WRITE_INT_FIELD(subLinkId);
1304  WRITE_NODE_FIELD(testexpr);
1305  WRITE_NODE_FIELD(operName);
1306  WRITE_NODE_FIELD(subselect);
1307  WRITE_LOCATION_FIELD(location);
1308 }
1309 
1310 static void
1311 _outSubPlan(StringInfo str, const SubPlan *node)
1312 {
1313  WRITE_NODE_TYPE("SUBPLAN");
1314 
1315  WRITE_ENUM_FIELD(subLinkType, SubLinkType);
1316  WRITE_NODE_FIELD(testexpr);
1317  WRITE_NODE_FIELD(paramIds);
1318  WRITE_INT_FIELD(plan_id);
1319  WRITE_STRING_FIELD(plan_name);
1320  WRITE_OID_FIELD(firstColType);
1321  WRITE_INT_FIELD(firstColTypmod);
1322  WRITE_OID_FIELD(firstColCollation);
1323  WRITE_BOOL_FIELD(useHashTable);
1324  WRITE_BOOL_FIELD(unknownEqFalse);
1325  WRITE_BOOL_FIELD(parallel_safe);
1326  WRITE_NODE_FIELD(setParam);
1327  WRITE_NODE_FIELD(parParam);
1329  WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1330  WRITE_FLOAT_FIELD(per_call_cost, "%.2f");
1331 }
1332 
1333 static void
1335 {
1336  WRITE_NODE_TYPE("ALTERNATIVESUBPLAN");
1337 
1338  WRITE_NODE_FIELD(subplans);
1339 }
1340 
1341 static void
1343 {
1344  WRITE_NODE_TYPE("FIELDSELECT");
1345 
1347  WRITE_INT_FIELD(fieldnum);
1348  WRITE_OID_FIELD(resulttype);
1349  WRITE_INT_FIELD(resulttypmod);
1350  WRITE_OID_FIELD(resultcollid);
1351 }
1352 
1353 static void
1355 {
1356  WRITE_NODE_TYPE("FIELDSTORE");
1357 
1359  WRITE_NODE_FIELD(newvals);
1360  WRITE_NODE_FIELD(fieldnums);
1361  WRITE_OID_FIELD(resulttype);
1362 }
1363 
1364 static void
1366 {
1367  WRITE_NODE_TYPE("RELABELTYPE");
1368 
1370  WRITE_OID_FIELD(resulttype);
1371  WRITE_INT_FIELD(resulttypmod);
1372  WRITE_OID_FIELD(resultcollid);
1373  WRITE_ENUM_FIELD(relabelformat, CoercionForm);
1374  WRITE_LOCATION_FIELD(location);
1375 }
1376 
1377 static void
1379 {
1380  WRITE_NODE_TYPE("COERCEVIAIO");
1381 
1383  WRITE_OID_FIELD(resulttype);
1384  WRITE_OID_FIELD(resultcollid);
1385  WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1386  WRITE_LOCATION_FIELD(location);
1387 }
1388 
1389 static void
1391 {
1392  WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
1393 
1395  WRITE_OID_FIELD(elemfuncid);
1396  WRITE_OID_FIELD(resulttype);
1397  WRITE_INT_FIELD(resulttypmod);
1398  WRITE_OID_FIELD(resultcollid);
1399  WRITE_BOOL_FIELD(isExplicit);
1400  WRITE_ENUM_FIELD(coerceformat, CoercionForm);
1401  WRITE_LOCATION_FIELD(location);
1402 }
1403 
1404 static void
1406 {
1407  WRITE_NODE_TYPE("CONVERTROWTYPEEXPR");
1408 
1410  WRITE_OID_FIELD(resulttype);
1411  WRITE_ENUM_FIELD(convertformat, CoercionForm);
1412  WRITE_LOCATION_FIELD(location);
1413 }
1414 
1415 static void
1417 {
1418  WRITE_NODE_TYPE("COLLATE");
1419 
1421  WRITE_OID_FIELD(collOid);
1422  WRITE_LOCATION_FIELD(location);
1423 }
1424 
1425 static void
1427 {
1428  WRITE_NODE_TYPE("CASE");
1429 
1430  WRITE_OID_FIELD(casetype);
1431  WRITE_OID_FIELD(casecollid);
1434  WRITE_NODE_FIELD(defresult);
1435  WRITE_LOCATION_FIELD(location);
1436 }
1437 
1438 static void
1440 {
1441  WRITE_NODE_TYPE("WHEN");
1442 
1443  WRITE_NODE_FIELD(expr);
1445  WRITE_LOCATION_FIELD(location);
1446 }
1447 
1448 static void
1450 {
1451  WRITE_NODE_TYPE("CASETESTEXPR");
1452 
1453  WRITE_OID_FIELD(typeId);
1454  WRITE_INT_FIELD(typeMod);
1455  WRITE_OID_FIELD(collation);
1456 }
1457 
1458 static void
1460 {
1461  WRITE_NODE_TYPE("ARRAY");
1462 
1463  WRITE_OID_FIELD(array_typeid);
1464  WRITE_OID_FIELD(array_collid);
1465  WRITE_OID_FIELD(element_typeid);
1466  WRITE_NODE_FIELD(elements);
1467  WRITE_BOOL_FIELD(multidims);
1468  WRITE_LOCATION_FIELD(location);
1469 }
1470 
1471 static void
1472 _outRowExpr(StringInfo str, const RowExpr *node)
1473 {
1474  WRITE_NODE_TYPE("ROW");
1475 
1477  WRITE_OID_FIELD(row_typeid);
1478  WRITE_ENUM_FIELD(row_format, CoercionForm);
1479  WRITE_NODE_FIELD(colnames);
1480  WRITE_LOCATION_FIELD(location);
1481 }
1482 
1483 static void
1485 {
1486  WRITE_NODE_TYPE("ROWCOMPARE");
1487 
1489  WRITE_NODE_FIELD(opnos);
1490  WRITE_NODE_FIELD(opfamilies);
1491  WRITE_NODE_FIELD(inputcollids);
1492  WRITE_NODE_FIELD(largs);
1493  WRITE_NODE_FIELD(rargs);
1494 }
1495 
1496 static void
1498 {
1499  WRITE_NODE_TYPE("COALESCE");
1500 
1501  WRITE_OID_FIELD(coalescetype);
1502  WRITE_OID_FIELD(coalescecollid);
1504  WRITE_LOCATION_FIELD(location);
1505 }
1506 
1507 static void
1509 {
1510  WRITE_NODE_TYPE("MINMAX");
1511 
1512  WRITE_OID_FIELD(minmaxtype);
1513  WRITE_OID_FIELD(minmaxcollid);
1514  WRITE_OID_FIELD(inputcollid);
1517  WRITE_LOCATION_FIELD(location);
1518 }
1519 
1520 static void
1522 {
1523  WRITE_NODE_TYPE("SQLVALUEFUNCTION");
1524 
1526  WRITE_OID_FIELD(type);
1527  WRITE_INT_FIELD(typmod);
1528  WRITE_LOCATION_FIELD(location);
1529 }
1530 
1531 static void
1532 _outXmlExpr(StringInfo str, const XmlExpr *node)
1533 {
1534  WRITE_NODE_TYPE("XMLEXPR");
1535 
1538  WRITE_NODE_FIELD(named_args);
1539  WRITE_NODE_FIELD(arg_names);
1542  WRITE_OID_FIELD(type);
1543  WRITE_INT_FIELD(typmod);
1544  WRITE_LOCATION_FIELD(location);
1545 }
1546 
1547 static void
1549 {
1550  WRITE_NODE_TYPE("NULLTEST");
1551 
1553  WRITE_ENUM_FIELD(nulltesttype, NullTestType);
1554  WRITE_BOOL_FIELD(argisrow);
1555  WRITE_LOCATION_FIELD(location);
1556 }
1557 
1558 static void
1560 {
1561  WRITE_NODE_TYPE("BOOLEANTEST");
1562 
1564  WRITE_ENUM_FIELD(booltesttype, BoolTestType);
1565  WRITE_LOCATION_FIELD(location);
1566 }
1567 
1568 static void
1570 {
1571  WRITE_NODE_TYPE("COERCETODOMAIN");
1572 
1574  WRITE_OID_FIELD(resulttype);
1575  WRITE_INT_FIELD(resulttypmod);
1576  WRITE_OID_FIELD(resultcollid);
1577  WRITE_ENUM_FIELD(coercionformat, CoercionForm);
1578  WRITE_LOCATION_FIELD(location);
1579 }
1580 
1581 static void
1583 {
1584  WRITE_NODE_TYPE("COERCETODOMAINVALUE");
1585 
1586  WRITE_OID_FIELD(typeId);
1587  WRITE_INT_FIELD(typeMod);
1588  WRITE_OID_FIELD(collation);
1589  WRITE_LOCATION_FIELD(location);
1590 }
1591 
1592 static void
1594 {
1595  WRITE_NODE_TYPE("SETTODEFAULT");
1596 
1597  WRITE_OID_FIELD(typeId);
1598  WRITE_INT_FIELD(typeMod);
1599  WRITE_OID_FIELD(collation);
1600  WRITE_LOCATION_FIELD(location);
1601 }
1602 
1603 static void
1605 {
1606  WRITE_NODE_TYPE("CURRENTOFEXPR");
1607 
1608  WRITE_UINT_FIELD(cvarno);
1609  WRITE_STRING_FIELD(cursor_name);
1610  WRITE_INT_FIELD(cursor_param);
1611 }
1612 
1613 static void
1615 {
1616  WRITE_NODE_TYPE("NEXTVALUEEXPR");
1617 
1618  WRITE_OID_FIELD(seqid);
1619  WRITE_OID_FIELD(typeId);
1620 }
1621 
1622 static void
1624 {
1625  WRITE_NODE_TYPE("INFERENCEELEM");
1626 
1627  WRITE_NODE_FIELD(expr);
1628  WRITE_OID_FIELD(infercollid);
1629  WRITE_OID_FIELD(inferopclass);
1630 }
1631 
1632 static void
1634 {
1635  WRITE_NODE_TYPE("TARGETENTRY");
1636 
1637  WRITE_NODE_FIELD(expr);
1638  WRITE_INT_FIELD(resno);
1639  WRITE_STRING_FIELD(resname);
1640  WRITE_UINT_FIELD(ressortgroupref);
1641  WRITE_OID_FIELD(resorigtbl);
1642  WRITE_INT_FIELD(resorigcol);
1643  WRITE_BOOL_FIELD(resjunk);
1644 }
1645 
1646 static void
1648 {
1649  WRITE_NODE_TYPE("RANGETBLREF");
1650 
1651  WRITE_INT_FIELD(rtindex);
1652 }
1653 
1654 static void
1656 {
1657  WRITE_NODE_TYPE("JOINEXPR");
1658 
1659  WRITE_ENUM_FIELD(jointype, JoinType);
1660  WRITE_BOOL_FIELD(isNatural);
1661  WRITE_NODE_FIELD(larg);
1662  WRITE_NODE_FIELD(rarg);
1663  WRITE_NODE_FIELD(usingClause);
1664  WRITE_NODE_FIELD(quals);
1665  WRITE_NODE_FIELD(alias);
1666  WRITE_INT_FIELD(rtindex);
1667 }
1668 
1669 static void
1671 {
1672  WRITE_NODE_TYPE("FROMEXPR");
1673 
1674  WRITE_NODE_FIELD(fromlist);
1675  WRITE_NODE_FIELD(quals);
1676 }
1677 
1678 static void
1680 {
1681  WRITE_NODE_TYPE("ONCONFLICTEXPR");
1682 
1684  WRITE_NODE_FIELD(arbiterElems);
1685  WRITE_NODE_FIELD(arbiterWhere);
1686  WRITE_OID_FIELD(constraint);
1687  WRITE_NODE_FIELD(onConflictSet);
1688  WRITE_NODE_FIELD(onConflictWhere);
1689  WRITE_INT_FIELD(exclRelIndex);
1690  WRITE_NODE_FIELD(exclRelTlist);
1691 }
1692 
1693 /*****************************************************************************
1694  *
1695  * Stuff from relation.h.
1696  *
1697  *****************************************************************************/
1698 
1699 /*
1700  * print the basic stuff of all nodes that inherit from Path
1701  *
1702  * Note we do NOT print the parent, else we'd be in infinite recursion.
1703  * We can print the parent's relids for identification purposes, though.
1704  * We print the pathtarget only if it's not the default one for the rel.
1705  * We also do not print the whole of param_info, since it's printed by
1706  * _outRelOptInfo; it's sufficient and less cluttering to print just the
1707  * required outer relids.
1708  */
1709 static void
1710 _outPathInfo(StringInfo str, const Path *node)
1711 {
1712  WRITE_ENUM_FIELD(pathtype, NodeTag);
1713  appendStringInfoString(str, " :parent_relids ");
1714  outBitmapset(str, node->parent->relids);
1715  if (node->pathtarget != node->parent->reltarget)
1716  WRITE_NODE_FIELD(pathtarget);
1717  appendStringInfoString(str, " :required_outer ");
1718  if (node->param_info)
1719  outBitmapset(str, node->param_info->ppi_req_outer);
1720  else
1721  outBitmapset(str, NULL);
1722  WRITE_BOOL_FIELD(parallel_aware);
1723  WRITE_BOOL_FIELD(parallel_safe);
1724  WRITE_INT_FIELD(parallel_workers);
1725  WRITE_FLOAT_FIELD(rows, "%.0f");
1726  WRITE_FLOAT_FIELD(startup_cost, "%.2f");
1727  WRITE_FLOAT_FIELD(total_cost, "%.2f");
1728  WRITE_NODE_FIELD(pathkeys);
1729 }
1730 
1731 /*
1732  * print the basic stuff of all nodes that inherit from JoinPath
1733  */
1734 static void
1736 {
1737  _outPathInfo(str, (const Path *) node);
1738 
1739  WRITE_ENUM_FIELD(jointype, JoinType);
1740  WRITE_BOOL_FIELD(inner_unique);
1741  WRITE_NODE_FIELD(outerjoinpath);
1742  WRITE_NODE_FIELD(innerjoinpath);
1743  WRITE_NODE_FIELD(joinrestrictinfo);
1744 }
1745 
1746 static void
1747 _outPath(StringInfo str, const Path *node)
1748 {
1749  WRITE_NODE_TYPE("PATH");
1750 
1751  _outPathInfo(str, (const Path *) node);
1752 }
1753 
1754 static void
1756 {
1757  WRITE_NODE_TYPE("INDEXPATH");
1758 
1759  _outPathInfo(str, (const Path *) node);
1760 
1761  WRITE_NODE_FIELD(indexinfo);
1762  WRITE_NODE_FIELD(indexclauses);
1763  WRITE_NODE_FIELD(indexquals);
1764  WRITE_NODE_FIELD(indexqualcols);
1765  WRITE_NODE_FIELD(indexorderbys);
1766  WRITE_NODE_FIELD(indexorderbycols);
1767  WRITE_ENUM_FIELD(indexscandir, ScanDirection);
1768  WRITE_FLOAT_FIELD(indextotalcost, "%.2f");
1769  WRITE_FLOAT_FIELD(indexselectivity, "%.4f");
1770 }
1771 
1772 static void
1774 {
1775  WRITE_NODE_TYPE("BITMAPHEAPPATH");
1776 
1777  _outPathInfo(str, (const Path *) node);
1778 
1779  WRITE_NODE_FIELD(bitmapqual);
1780 }
1781 
1782 static void
1784 {
1785  WRITE_NODE_TYPE("BITMAPANDPATH");
1786 
1787  _outPathInfo(str, (const Path *) node);
1788 
1789  WRITE_NODE_FIELD(bitmapquals);
1790  WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1791 }
1792 
1793 static void
1795 {
1796  WRITE_NODE_TYPE("BITMAPORPATH");
1797 
1798  _outPathInfo(str, (const Path *) node);
1799 
1800  WRITE_NODE_FIELD(bitmapquals);
1801  WRITE_FLOAT_FIELD(bitmapselectivity, "%.4f");
1802 }
1803 
1804 static void
1805 _outTidPath(StringInfo str, const TidPath *node)
1806 {
1807  WRITE_NODE_TYPE("TIDPATH");
1808 
1809  _outPathInfo(str, (const Path *) node);
1810 
1811  WRITE_NODE_FIELD(tidquals);
1812 }
1813 
1814 static void
1816 {
1817  WRITE_NODE_TYPE("SUBQUERYSCANPATH");
1818 
1819  _outPathInfo(str, (const Path *) node);
1820 
1822 }
1823 
1824 static void
1826 {
1827  WRITE_NODE_TYPE("FOREIGNPATH");
1828 
1829  _outPathInfo(str, (const Path *) node);
1830 
1831  WRITE_NODE_FIELD(fdw_outerpath);
1832  WRITE_NODE_FIELD(fdw_private);
1833 }
1834 
1835 static void
1837 {
1838  WRITE_NODE_TYPE("CUSTOMPATH");
1839 
1840  _outPathInfo(str, (const Path *) node);
1841 
1842  WRITE_UINT_FIELD(flags);
1843  WRITE_NODE_FIELD(custom_paths);
1844  WRITE_NODE_FIELD(custom_private);
1845  appendStringInfoString(str, " :methods ");
1846  outToken(str, node->methods->CustomName);
1847 }
1848 
1849 static void
1851 {
1852  WRITE_NODE_TYPE("APPENDPATH");
1853 
1854  _outPathInfo(str, (const Path *) node);
1855 
1856  WRITE_NODE_FIELD(partitioned_rels);
1857  WRITE_NODE_FIELD(subpaths);
1858 }
1859 
1860 static void
1862 {
1863  WRITE_NODE_TYPE("MERGEAPPENDPATH");
1864 
1865  _outPathInfo(str, (const Path *) node);
1866 
1867  WRITE_NODE_FIELD(partitioned_rels);
1868  WRITE_NODE_FIELD(subpaths);
1869  WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
1870 }
1871 
1872 static void
1874 {
1875  WRITE_NODE_TYPE("RESULTPATH");
1876 
1877  _outPathInfo(str, (const Path *) node);
1878 
1879  WRITE_NODE_FIELD(quals);
1880 }
1881 
1882 static void
1884 {
1885  WRITE_NODE_TYPE("MATERIALPATH");
1886 
1887  _outPathInfo(str, (const Path *) node);
1888 
1890 }
1891 
1892 static void
1894 {
1895  WRITE_NODE_TYPE("UNIQUEPATH");
1896 
1897  _outPathInfo(str, (const Path *) node);
1898 
1901  WRITE_NODE_FIELD(in_operators);
1902  WRITE_NODE_FIELD(uniq_exprs);
1903 }
1904 
1905 static void
1907 {
1908  WRITE_NODE_TYPE("GATHERPATH");
1909 
1910  _outPathInfo(str, (const Path *) node);
1911 
1913  WRITE_BOOL_FIELD(single_copy);
1914  WRITE_INT_FIELD(num_workers);
1915 }
1916 
1917 static void
1919 {
1920  WRITE_NODE_TYPE("PROJECTIONPATH");
1921 
1922  _outPathInfo(str, (const Path *) node);
1923 
1925  WRITE_BOOL_FIELD(dummypp);
1926 }
1927 
1928 static void
1930 {
1931  WRITE_NODE_TYPE("PROJECTSETPATH");
1932 
1933  _outPathInfo(str, (const Path *) node);
1934 
1936 }
1937 
1938 static void
1940 {
1941  WRITE_NODE_TYPE("SORTPATH");
1942 
1943  _outPathInfo(str, (const Path *) node);
1944 
1946 }
1947 
1948 static void
1950 {
1951  WRITE_NODE_TYPE("GROUPPATH");
1952 
1953  _outPathInfo(str, (const Path *) node);
1954 
1956  WRITE_NODE_FIELD(groupClause);
1957  WRITE_NODE_FIELD(qual);
1958 }
1959 
1960 static void
1962 {
1963  WRITE_NODE_TYPE("UPPERUNIQUEPATH");
1964 
1965  _outPathInfo(str, (const Path *) node);
1966 
1968  WRITE_INT_FIELD(numkeys);
1969 }
1970 
1971 static void
1972 _outAggPath(StringInfo str, const AggPath *node)
1973 {
1974  WRITE_NODE_TYPE("AGGPATH");
1975 
1976  _outPathInfo(str, (const Path *) node);
1977 
1979  WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
1980  WRITE_ENUM_FIELD(aggsplit, AggSplit);
1981  WRITE_FLOAT_FIELD(numGroups, "%.0f");
1982  WRITE_NODE_FIELD(groupClause);
1983  WRITE_NODE_FIELD(qual);
1984 }
1985 
1986 static void
1988 {
1989  WRITE_NODE_TYPE("ROLLUP");
1990 
1991  WRITE_NODE_FIELD(groupClause);
1992  WRITE_NODE_FIELD(gsets);
1993  WRITE_NODE_FIELD(gsets_data);
1994  WRITE_FLOAT_FIELD(numGroups, "%.0f");
1995  WRITE_BOOL_FIELD(hashable);
1996  WRITE_BOOL_FIELD(is_hashed);
1997 }
1998 
1999 static void
2001 {
2002  WRITE_NODE_TYPE("GSDATA");
2003 
2004  WRITE_NODE_FIELD(set);
2005  WRITE_FLOAT_FIELD(numGroups, "%.0f");
2006 }
2007 
2008 static void
2010 {
2011  WRITE_NODE_TYPE("GROUPINGSETSPATH");
2012 
2013  _outPathInfo(str, (const Path *) node);
2014 
2016  WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
2017  WRITE_NODE_FIELD(rollups);
2018  WRITE_NODE_FIELD(qual);
2019 }
2020 
2021 static void
2023 {
2024  WRITE_NODE_TYPE("MINMAXAGGPATH");
2025 
2026  _outPathInfo(str, (const Path *) node);
2027 
2028  WRITE_NODE_FIELD(mmaggregates);
2029  WRITE_NODE_FIELD(quals);
2030 }
2031 
2032 static void
2034 {
2035  WRITE_NODE_TYPE("WINDOWAGGPATH");
2036 
2037  _outPathInfo(str, (const Path *) node);
2038 
2040  WRITE_NODE_FIELD(winclause);
2041  WRITE_NODE_FIELD(winpathkeys);
2042 }
2043 
2044 static void
2046 {
2047  WRITE_NODE_TYPE("SETOPPATH");
2048 
2049  _outPathInfo(str, (const Path *) node);
2050 
2052  WRITE_ENUM_FIELD(cmd, SetOpCmd);
2053  WRITE_ENUM_FIELD(strategy, SetOpStrategy);
2054  WRITE_NODE_FIELD(distinctList);
2055  WRITE_INT_FIELD(flagColIdx);
2056  WRITE_INT_FIELD(firstFlag);
2057  WRITE_FLOAT_FIELD(numGroups, "%.0f");
2058 }
2059 
2060 static void
2062 {
2063  WRITE_NODE_TYPE("RECURSIVEUNIONPATH");
2064 
2065  _outPathInfo(str, (const Path *) node);
2066 
2067  WRITE_NODE_FIELD(leftpath);
2068  WRITE_NODE_FIELD(rightpath);
2069  WRITE_NODE_FIELD(distinctList);
2070  WRITE_INT_FIELD(wtParam);
2071  WRITE_FLOAT_FIELD(numGroups, "%.0f");
2072 }
2073 
2074 static void
2076 {
2077  WRITE_NODE_TYPE("LOCKROWSPATH");
2078 
2079  _outPathInfo(str, (const Path *) node);
2080 
2082  WRITE_NODE_FIELD(rowMarks);
2083  WRITE_INT_FIELD(epqParam);
2084 }
2085 
2086 static void
2088 {
2089  WRITE_NODE_TYPE("MODIFYTABLEPATH");
2090 
2091  _outPathInfo(str, (const Path *) node);
2092 
2093  WRITE_ENUM_FIELD(operation, CmdType);
2094  WRITE_BOOL_FIELD(canSetTag);
2095  WRITE_UINT_FIELD(nominalRelation);
2096  WRITE_NODE_FIELD(partitioned_rels);
2097  WRITE_NODE_FIELD(resultRelations);
2098  WRITE_NODE_FIELD(subpaths);
2099  WRITE_NODE_FIELD(subroots);
2100  WRITE_NODE_FIELD(withCheckOptionLists);
2101  WRITE_NODE_FIELD(returningLists);
2102  WRITE_NODE_FIELD(rowMarks);
2103  WRITE_NODE_FIELD(onconflict);
2104  WRITE_INT_FIELD(epqParam);
2105 }
2106 
2107 static void
2109 {
2110  WRITE_NODE_TYPE("LIMITPATH");
2111 
2112  _outPathInfo(str, (const Path *) node);
2113 
2115  WRITE_NODE_FIELD(limitOffset);
2116  WRITE_NODE_FIELD(limitCount);
2117 }
2118 
2119 static void
2121 {
2122  WRITE_NODE_TYPE("GATHERMERGEPATH");
2123 
2124  _outPathInfo(str, (const Path *) node);
2125 
2127  WRITE_INT_FIELD(num_workers);
2128 }
2129 
2130 static void
2132 {
2133  WRITE_NODE_TYPE("NESTPATH");
2134 
2135  _outJoinPathInfo(str, (const JoinPath *) node);
2136 }
2137 
2138 static void
2140 {
2141  WRITE_NODE_TYPE("MERGEPATH");
2142 
2143  _outJoinPathInfo(str, (const JoinPath *) node);
2144 
2145  WRITE_NODE_FIELD(path_mergeclauses);
2146  WRITE_NODE_FIELD(outersortkeys);
2147  WRITE_NODE_FIELD(innersortkeys);
2148  WRITE_BOOL_FIELD(skip_mark_restore);
2149  WRITE_BOOL_FIELD(materialize_inner);
2150 }
2151 
2152 static void
2154 {
2155  WRITE_NODE_TYPE("HASHPATH");
2156 
2157  _outJoinPathInfo(str, (const JoinPath *) node);
2158 
2159  WRITE_NODE_FIELD(path_hashclauses);
2160  WRITE_INT_FIELD(num_batches);
2161 }
2162 
2163 static void
2165 {
2166  WRITE_NODE_TYPE("PLANNERGLOBAL");
2167 
2168  /* NB: this isn't a complete set of fields */
2169  WRITE_NODE_FIELD(subplans);
2170  WRITE_BITMAPSET_FIELD(rewindPlanIDs);
2171  WRITE_NODE_FIELD(finalrtable);
2172  WRITE_NODE_FIELD(finalrowmarks);
2173  WRITE_NODE_FIELD(resultRelations);
2174  WRITE_NODE_FIELD(nonleafResultRelations);
2175  WRITE_NODE_FIELD(rootResultRelations);
2176  WRITE_NODE_FIELD(relationOids);
2177  WRITE_NODE_FIELD(invalItems);
2178  WRITE_INT_FIELD(nParamExec);
2179  WRITE_UINT_FIELD(lastPHId);
2180  WRITE_UINT_FIELD(lastRowMarkId);
2181  WRITE_INT_FIELD(lastPlanNodeId);
2182  WRITE_BOOL_FIELD(transientPlan);
2183  WRITE_BOOL_FIELD(dependsOnRole);
2184  WRITE_BOOL_FIELD(parallelModeOK);
2185  WRITE_BOOL_FIELD(parallelModeNeeded);
2186  WRITE_CHAR_FIELD(maxParallelHazard);
2187 }
2188 
2189 static void
2191 {
2192  WRITE_NODE_TYPE("PLANNERINFO");
2193 
2194  /* NB: this isn't a complete set of fields */
2196  WRITE_NODE_FIELD(glob);
2197  WRITE_UINT_FIELD(query_level);
2198  WRITE_NODE_FIELD(plan_params);
2199  WRITE_BITMAPSET_FIELD(outer_params);
2200  WRITE_BITMAPSET_FIELD(all_baserels);
2201  WRITE_BITMAPSET_FIELD(nullable_baserels);
2202  WRITE_NODE_FIELD(join_rel_list);
2203  WRITE_INT_FIELD(join_cur_level);
2204  WRITE_NODE_FIELD(init_plans);
2205  WRITE_NODE_FIELD(cte_plan_ids);
2206  WRITE_NODE_FIELD(multiexpr_params);
2207  WRITE_NODE_FIELD(eq_classes);
2208  WRITE_NODE_FIELD(canon_pathkeys);
2209  WRITE_NODE_FIELD(left_join_clauses);
2210  WRITE_NODE_FIELD(right_join_clauses);
2211  WRITE_NODE_FIELD(full_join_clauses);
2212  WRITE_NODE_FIELD(join_info_list);
2213  WRITE_NODE_FIELD(append_rel_list);
2214  WRITE_NODE_FIELD(pcinfo_list);
2215  WRITE_NODE_FIELD(rowMarks);
2216  WRITE_NODE_FIELD(placeholder_list);
2217  WRITE_NODE_FIELD(fkey_list);
2218  WRITE_NODE_FIELD(query_pathkeys);
2219  WRITE_NODE_FIELD(group_pathkeys);
2220  WRITE_NODE_FIELD(window_pathkeys);
2221  WRITE_NODE_FIELD(distinct_pathkeys);
2222  WRITE_NODE_FIELD(sort_pathkeys);
2223  WRITE_NODE_FIELD(processed_tlist);
2224  WRITE_NODE_FIELD(minmax_aggs);
2225  WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
2226  WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
2227  WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
2228  WRITE_UINT_FIELD(qual_security_level);
2229  WRITE_BOOL_FIELD(hasInheritedTarget);
2230  WRITE_BOOL_FIELD(hasJoinRTEs);
2231  WRITE_BOOL_FIELD(hasLateralRTEs);
2232  WRITE_BOOL_FIELD(hasDeletedRTEs);
2233  WRITE_BOOL_FIELD(hasHavingQual);
2234  WRITE_BOOL_FIELD(hasPseudoConstantQuals);
2235  WRITE_BOOL_FIELD(hasRecursion);
2236  WRITE_INT_FIELD(wt_param_id);
2237  WRITE_BITMAPSET_FIELD(curOuterRels);
2238  WRITE_NODE_FIELD(curOuterParams);
2239 }
2240 
2241 static void
2243 {
2244  WRITE_NODE_TYPE("RELOPTINFO");
2245 
2246  /* NB: this isn't a complete set of fields */
2247  WRITE_ENUM_FIELD(reloptkind, RelOptKind);
2248  WRITE_BITMAPSET_FIELD(relids);
2249  WRITE_FLOAT_FIELD(rows, "%.0f");
2250  WRITE_BOOL_FIELD(consider_startup);
2251  WRITE_BOOL_FIELD(consider_param_startup);
2252  WRITE_BOOL_FIELD(consider_parallel);
2253  WRITE_NODE_FIELD(reltarget);
2254  WRITE_NODE_FIELD(pathlist);
2255  WRITE_NODE_FIELD(ppilist);
2256  WRITE_NODE_FIELD(partial_pathlist);
2257  WRITE_NODE_FIELD(cheapest_startup_path);
2258  WRITE_NODE_FIELD(cheapest_total_path);
2259  WRITE_NODE_FIELD(cheapest_unique_path);
2260  WRITE_NODE_FIELD(cheapest_parameterized_paths);
2261  WRITE_BITMAPSET_FIELD(direct_lateral_relids);
2262  WRITE_BITMAPSET_FIELD(lateral_relids);
2263  WRITE_UINT_FIELD(relid);
2264  WRITE_OID_FIELD(reltablespace);
2265  WRITE_ENUM_FIELD(rtekind, RTEKind);
2266  WRITE_INT_FIELD(min_attr);
2267  WRITE_INT_FIELD(max_attr);
2268  WRITE_NODE_FIELD(lateral_vars);
2269  WRITE_BITMAPSET_FIELD(lateral_referencers);
2270  WRITE_NODE_FIELD(indexlist);
2271  WRITE_NODE_FIELD(statlist);
2272  WRITE_UINT_FIELD(pages);
2273  WRITE_FLOAT_FIELD(tuples, "%.0f");
2274  WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
2275  WRITE_NODE_FIELD(subroot);
2276  WRITE_NODE_FIELD(subplan_params);
2277  WRITE_INT_FIELD(rel_parallel_workers);
2278  WRITE_OID_FIELD(serverid);
2279  WRITE_OID_FIELD(userid);
2280  WRITE_BOOL_FIELD(useridiscurrent);
2281  /* we don't try to print fdwroutine or fdw_private */
2282  /* can't print unique_for_rels/non_unique_for_rels; BMSes aren't Nodes */
2283  WRITE_NODE_FIELD(baserestrictinfo);
2284  WRITE_UINT_FIELD(baserestrict_min_security);
2285  WRITE_NODE_FIELD(joininfo);
2286  WRITE_BOOL_FIELD(has_eclass_joins);
2287  WRITE_BITMAPSET_FIELD(top_parent_relids);
2288 }
2289 
2290 static void
2292 {
2293  WRITE_NODE_TYPE("INDEXOPTINFO");
2294 
2295  /* NB: this isn't a complete set of fields */
2296  WRITE_OID_FIELD(indexoid);
2297  /* Do NOT print rel field, else infinite recursion */
2298  WRITE_UINT_FIELD(pages);
2299  WRITE_FLOAT_FIELD(tuples, "%.0f");
2300  WRITE_INT_FIELD(tree_height);
2301  WRITE_INT_FIELD(ncolumns);
2302  /* array fields aren't really worth the trouble to print */
2303  WRITE_OID_FIELD(relam);
2304  /* indexprs is redundant since we print indextlist */
2305  WRITE_NODE_FIELD(indpred);
2306  WRITE_NODE_FIELD(indextlist);
2307  WRITE_NODE_FIELD(indrestrictinfo);
2308  WRITE_BOOL_FIELD(predOK);
2309  WRITE_BOOL_FIELD(unique);
2310  WRITE_BOOL_FIELD(immediate);
2311  WRITE_BOOL_FIELD(hypothetical);
2312  /* we don't bother with fields copied from the index AM's API struct */
2313 }
2314 
2315 static void
2317 {
2318  int i;
2319 
2320  WRITE_NODE_TYPE("FOREIGNKEYOPTINFO");
2321 
2322  WRITE_UINT_FIELD(con_relid);
2323  WRITE_UINT_FIELD(ref_relid);
2324  WRITE_INT_FIELD(nkeys);
2325  appendStringInfoString(str, " :conkey");
2326  for (i = 0; i < node->nkeys; i++)
2327  appendStringInfo(str, " %d", node->conkey[i]);
2328  appendStringInfoString(str, " :confkey");
2329  for (i = 0; i < node->nkeys; i++)
2330  appendStringInfo(str, " %d", node->confkey[i]);
2331  appendStringInfoString(str, " :conpfeqop");
2332  for (i = 0; i < node->nkeys; i++)
2333  appendStringInfo(str, " %u", node->conpfeqop[i]);
2334  WRITE_INT_FIELD(nmatched_ec);
2335  WRITE_INT_FIELD(nmatched_rcols);
2336  WRITE_INT_FIELD(nmatched_ri);
2337  /* for compactness, just print the number of matches per column: */
2338  appendStringInfoString(str, " :eclass");
2339  for (i = 0; i < node->nkeys; i++)
2340  appendStringInfo(str, " %d", (node->eclass[i] != NULL));
2341  appendStringInfoString(str, " :rinfos");
2342  for (i = 0; i < node->nkeys; i++)
2343  appendStringInfo(str, " %d", list_length(node->rinfos[i]));
2344 }
2345 
2346 static void
2348 {
2349  WRITE_NODE_TYPE("STATISTICEXTINFO");
2350 
2351  /* NB: this isn't a complete set of fields */
2352  WRITE_OID_FIELD(statOid);
2353  /* don't write rel, leads to infinite recursion in plan tree dump */
2354  WRITE_CHAR_FIELD(kind);
2355  WRITE_BITMAPSET_FIELD(keys);
2356 }
2357 
2358 static void
2360 {
2361  /*
2362  * To simplify reading, we just chase up to the topmost merged EC and
2363  * print that, without bothering to show the merge-ees separately.
2364  */
2365  while (node->ec_merged)
2366  node = node->ec_merged;
2367 
2368  WRITE_NODE_TYPE("EQUIVALENCECLASS");
2369 
2370  WRITE_NODE_FIELD(ec_opfamilies);
2371  WRITE_OID_FIELD(ec_collation);
2372  WRITE_NODE_FIELD(ec_members);
2373  WRITE_NODE_FIELD(ec_sources);
2374  WRITE_NODE_FIELD(ec_derives);
2375  WRITE_BITMAPSET_FIELD(ec_relids);
2376  WRITE_BOOL_FIELD(ec_has_const);
2377  WRITE_BOOL_FIELD(ec_has_volatile);
2378  WRITE_BOOL_FIELD(ec_below_outer_join);
2379  WRITE_BOOL_FIELD(ec_broken);
2380  WRITE_UINT_FIELD(ec_sortref);
2381  WRITE_UINT_FIELD(ec_min_security);
2382  WRITE_UINT_FIELD(ec_max_security);
2383 }
2384 
2385 static void
2387 {
2388  WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
2389 
2390  WRITE_NODE_FIELD(em_expr);
2391  WRITE_BITMAPSET_FIELD(em_relids);
2392  WRITE_BITMAPSET_FIELD(em_nullable_relids);
2393  WRITE_BOOL_FIELD(em_is_const);
2394  WRITE_BOOL_FIELD(em_is_child);
2395  WRITE_OID_FIELD(em_datatype);
2396 }
2397 
2398 static void
2399 _outPathKey(StringInfo str, const PathKey *node)
2400 {
2401  WRITE_NODE_TYPE("PATHKEY");
2402 
2403  WRITE_NODE_FIELD(pk_eclass);
2404  WRITE_OID_FIELD(pk_opfamily);
2405  WRITE_INT_FIELD(pk_strategy);
2406  WRITE_BOOL_FIELD(pk_nulls_first);
2407 }
2408 
2409 static void
2411 {
2412  WRITE_NODE_TYPE("PATHTARGET");
2413 
2414  WRITE_NODE_FIELD(exprs);
2415  if (node->sortgrouprefs)
2416  {
2417  int i;
2418 
2419  appendStringInfoString(str, " :sortgrouprefs");
2420  for (i = 0; i < list_length(node->exprs); i++)
2421  appendStringInfo(str, " %u", node->sortgrouprefs[i]);
2422  }
2423  WRITE_FLOAT_FIELD(cost.startup, "%.2f");
2424  WRITE_FLOAT_FIELD(cost.per_tuple, "%.2f");
2425  WRITE_INT_FIELD(width);
2426 }
2427 
2428 static void
2430 {
2431  WRITE_NODE_TYPE("PARAMPATHINFO");
2432 
2433  WRITE_BITMAPSET_FIELD(ppi_req_outer);
2434  WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
2435  WRITE_NODE_FIELD(ppi_clauses);
2436 }
2437 
2438 static void
2440 {
2441  WRITE_NODE_TYPE("RESTRICTINFO");
2442 
2443  /* NB: this isn't a complete set of fields */
2444  WRITE_NODE_FIELD(clause);
2445  WRITE_BOOL_FIELD(is_pushed_down);
2446  WRITE_BOOL_FIELD(outerjoin_delayed);
2447  WRITE_BOOL_FIELD(can_join);
2448  WRITE_BOOL_FIELD(pseudoconstant);
2449  WRITE_BOOL_FIELD(leakproof);
2450  WRITE_UINT_FIELD(security_level);
2451  WRITE_BITMAPSET_FIELD(clause_relids);
2452  WRITE_BITMAPSET_FIELD(required_relids);
2453  WRITE_BITMAPSET_FIELD(outer_relids);
2454  WRITE_BITMAPSET_FIELD(nullable_relids);
2455  WRITE_BITMAPSET_FIELD(left_relids);
2456  WRITE_BITMAPSET_FIELD(right_relids);
2457  WRITE_NODE_FIELD(orclause);
2458  /* don't write parent_ec, leads to infinite recursion in plan tree dump */
2459  WRITE_FLOAT_FIELD(norm_selec, "%.4f");
2460  WRITE_FLOAT_FIELD(outer_selec, "%.4f");
2461  WRITE_NODE_FIELD(mergeopfamilies);
2462  /* don't write left_ec, leads to infinite recursion in plan tree dump */
2463  /* don't write right_ec, leads to infinite recursion in plan tree dump */
2464  WRITE_NODE_FIELD(left_em);
2465  WRITE_NODE_FIELD(right_em);
2466  WRITE_BOOL_FIELD(outer_is_left);
2467  WRITE_OID_FIELD(hashjoinoperator);
2468 }
2469 
2470 static void
2472 {
2473  WRITE_NODE_TYPE("PLACEHOLDERVAR");
2474 
2475  WRITE_NODE_FIELD(phexpr);
2476  WRITE_BITMAPSET_FIELD(phrels);
2477  WRITE_UINT_FIELD(phid);
2478  WRITE_UINT_FIELD(phlevelsup);
2479 }
2480 
2481 static void
2483 {
2484  WRITE_NODE_TYPE("SPECIALJOININFO");
2485 
2486  WRITE_BITMAPSET_FIELD(min_lefthand);
2487  WRITE_BITMAPSET_FIELD(min_righthand);
2488  WRITE_BITMAPSET_FIELD(syn_lefthand);
2489  WRITE_BITMAPSET_FIELD(syn_righthand);
2490  WRITE_ENUM_FIELD(jointype, JoinType);
2491  WRITE_BOOL_FIELD(lhs_strict);
2492  WRITE_BOOL_FIELD(delay_upper_joins);
2493  WRITE_BOOL_FIELD(semi_can_btree);
2494  WRITE_BOOL_FIELD(semi_can_hash);
2495  WRITE_NODE_FIELD(semi_operators);
2496  WRITE_NODE_FIELD(semi_rhs_exprs);
2497 }
2498 
2499 static void
2501 {
2502  WRITE_NODE_TYPE("APPENDRELINFO");
2503 
2504  WRITE_UINT_FIELD(parent_relid);
2505  WRITE_UINT_FIELD(child_relid);
2506  WRITE_OID_FIELD(parent_reltype);
2507  WRITE_OID_FIELD(child_reltype);
2508  WRITE_NODE_FIELD(translated_vars);
2509  WRITE_OID_FIELD(parent_reloid);
2510 }
2511 
2512 static void
2514 {
2515  WRITE_NODE_TYPE("PARTITIONEDCHILDRELINFO");
2516 
2517  WRITE_UINT_FIELD(parent_relid);
2518  WRITE_NODE_FIELD(child_rels);
2519 }
2520 
2521 static void
2523 {
2524  WRITE_NODE_TYPE("PLACEHOLDERINFO");
2525 
2526  WRITE_UINT_FIELD(phid);
2527  WRITE_NODE_FIELD(ph_var);
2528  WRITE_BITMAPSET_FIELD(ph_eval_at);
2529  WRITE_BITMAPSET_FIELD(ph_lateral);
2530  WRITE_BITMAPSET_FIELD(ph_needed);
2531  WRITE_INT_FIELD(ph_width);
2532 }
2533 
2534 static void
2536 {
2537  WRITE_NODE_TYPE("MINMAXAGGINFO");
2538 
2539  WRITE_OID_FIELD(aggfnoid);
2540  WRITE_OID_FIELD(aggsortop);
2541  WRITE_NODE_FIELD(target);
2542  /* We intentionally omit subroot --- too large, not interesting enough */
2543  WRITE_NODE_FIELD(path);
2544  WRITE_FLOAT_FIELD(pathcost, "%.2f");
2545  WRITE_NODE_FIELD(param);
2546 }
2547 
2548 static void
2550 {
2551  WRITE_NODE_TYPE("PLANNERPARAMITEM");
2552 
2553  WRITE_NODE_FIELD(item);
2554  WRITE_INT_FIELD(paramId);
2555 }
2556 
2557 /*****************************************************************************
2558  *
2559  * Stuff from extensible.h
2560  *
2561  *****************************************************************************/
2562 
2563 static void
2565 {
2566  const ExtensibleNodeMethods *methods;
2567 
2568  methods = GetExtensibleNodeMethods(node->extnodename, false);
2569 
2570  WRITE_NODE_TYPE("EXTENSIBLENODE");
2571 
2572  WRITE_STRING_FIELD(extnodename);
2573 
2574  /* serialize the private fields */
2575  methods->nodeOut(str, node);
2576 }
2577 
2578 /*****************************************************************************
2579  *
2580  * Stuff from parsenodes.h.
2581  *
2582  *****************************************************************************/
2583 
2584 /*
2585  * print the basic stuff of all nodes that inherit from CreateStmt
2586  */
2587 static void
2589 {
2590  WRITE_NODE_FIELD(relation);
2591  WRITE_NODE_FIELD(tableElts);
2592  WRITE_NODE_FIELD(inhRelations);
2593  WRITE_NODE_FIELD(partspec);
2594  WRITE_NODE_FIELD(partbound);
2595  WRITE_NODE_FIELD(ofTypename);
2596  WRITE_NODE_FIELD(constraints);
2598  WRITE_ENUM_FIELD(oncommit, OnCommitAction);
2599  WRITE_STRING_FIELD(tablespacename);
2600  WRITE_BOOL_FIELD(if_not_exists);
2601 }
2602 
2603 static void
2605 {
2606  WRITE_NODE_TYPE("CREATESTMT");
2607 
2608  _outCreateStmtInfo(str, (const CreateStmt *) node);
2609 }
2610 
2611 static void
2613 {
2614  WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
2615 
2616  _outCreateStmtInfo(str, (const CreateStmt *) node);
2617 
2618  WRITE_STRING_FIELD(servername);
2620 }
2621 
2622 static void
2624 {
2625  WRITE_NODE_TYPE("IMPORTFOREIGNSCHEMASTMT");
2626 
2627  WRITE_STRING_FIELD(server_name);
2628  WRITE_STRING_FIELD(remote_schema);
2629  WRITE_STRING_FIELD(local_schema);
2631  WRITE_NODE_FIELD(table_list);
2633 }
2634 
2635 static void
2637 {
2638  WRITE_NODE_TYPE("INDEXSTMT");
2639 
2640  WRITE_STRING_FIELD(idxname);
2641  WRITE_NODE_FIELD(relation);
2642  WRITE_STRING_FIELD(accessMethod);
2643  WRITE_STRING_FIELD(tableSpace);
2644  WRITE_NODE_FIELD(indexParams);
2646  WRITE_NODE_FIELD(whereClause);
2647  WRITE_NODE_FIELD(excludeOpNames);
2648  WRITE_STRING_FIELD(idxcomment);
2649  WRITE_OID_FIELD(indexOid);
2650  WRITE_OID_FIELD(oldNode);
2651  WRITE_BOOL_FIELD(unique);
2652  WRITE_BOOL_FIELD(primary);
2653  WRITE_BOOL_FIELD(isconstraint);
2654  WRITE_BOOL_FIELD(deferrable);
2655  WRITE_BOOL_FIELD(initdeferred);
2656  WRITE_BOOL_FIELD(transformed);
2657  WRITE_BOOL_FIELD(concurrent);
2658  WRITE_BOOL_FIELD(if_not_exists);
2659 }
2660 
2661 static void
2663 {
2664  WRITE_NODE_TYPE("CREATESTATSSTMT");
2665 
2666  WRITE_NODE_FIELD(defnames);
2667  WRITE_NODE_FIELD(stat_types);
2668  WRITE_NODE_FIELD(exprs);
2669  WRITE_NODE_FIELD(relations);
2670  WRITE_BOOL_FIELD(if_not_exists);
2671 }
2672 
2673 static void
2675 {
2676  WRITE_NODE_TYPE("NOTIFY");
2677 
2678  WRITE_STRING_FIELD(conditionname);
2679  WRITE_STRING_FIELD(payload);
2680 }
2681 
2682 static void
2684 {
2685  WRITE_NODE_TYPE("DECLARECURSOR");
2686 
2687  WRITE_STRING_FIELD(portalname);
2689  WRITE_NODE_FIELD(query);
2690 }
2691 
2692 static void
2694 {
2695  WRITE_NODE_TYPE("SELECT");
2696 
2697  WRITE_NODE_FIELD(distinctClause);
2698  WRITE_NODE_FIELD(intoClause);
2699  WRITE_NODE_FIELD(targetList);
2700  WRITE_NODE_FIELD(fromClause);
2701  WRITE_NODE_FIELD(whereClause);
2702  WRITE_NODE_FIELD(groupClause);
2703  WRITE_NODE_FIELD(havingClause);
2704  WRITE_NODE_FIELD(windowClause);
2705  WRITE_NODE_FIELD(valuesLists);
2706  WRITE_NODE_FIELD(sortClause);
2707  WRITE_NODE_FIELD(limitOffset);
2708  WRITE_NODE_FIELD(limitCount);
2709  WRITE_NODE_FIELD(lockingClause);
2710  WRITE_NODE_FIELD(withClause);
2712  WRITE_BOOL_FIELD(all);
2713  WRITE_NODE_FIELD(larg);
2714  WRITE_NODE_FIELD(rarg);
2715 }
2716 
2717 static void
2719 {
2720  WRITE_NODE_TYPE("FUNCCALL");
2721 
2722  WRITE_NODE_FIELD(funcname);
2724  WRITE_NODE_FIELD(agg_order);
2725  WRITE_NODE_FIELD(agg_filter);
2726  WRITE_BOOL_FIELD(agg_within_group);
2727  WRITE_BOOL_FIELD(agg_star);
2728  WRITE_BOOL_FIELD(agg_distinct);
2729  WRITE_BOOL_FIELD(func_variadic);
2730  WRITE_NODE_FIELD(over);
2731  WRITE_LOCATION_FIELD(location);
2732 }
2733 
2734 static void
2735 _outDefElem(StringInfo str, const DefElem *node)
2736 {
2737  WRITE_NODE_TYPE("DEFELEM");
2738 
2739  WRITE_STRING_FIELD(defnamespace);
2740  WRITE_STRING_FIELD(defname);
2742  WRITE_ENUM_FIELD(defaction, DefElemAction);
2743  WRITE_LOCATION_FIELD(location);
2744 }
2745 
2746 static void
2748 {
2749  WRITE_NODE_TYPE("TABLELIKECLAUSE");
2750 
2751  WRITE_NODE_FIELD(relation);
2753 }
2754 
2755 static void
2757 {
2758  WRITE_NODE_TYPE("LOCKINGCLAUSE");
2759 
2760  WRITE_NODE_FIELD(lockedRels);
2762  WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2763 }
2764 
2765 static void
2767 {
2768  WRITE_NODE_TYPE("XMLSERIALIZE");
2769 
2771  WRITE_NODE_FIELD(expr);
2772  WRITE_NODE_FIELD(typeName);
2773  WRITE_LOCATION_FIELD(location);
2774 }
2775 
2776 static void
2778 {
2779  WRITE_NODE_TYPE("TRIGGERTRANSITION");
2780 
2782  WRITE_BOOL_FIELD(isNew);
2783  WRITE_BOOL_FIELD(isTable);
2784 }
2785 
2786 static void
2788 {
2789  WRITE_NODE_TYPE("COLUMNDEF");
2790 
2791  WRITE_STRING_FIELD(colname);
2792  WRITE_NODE_FIELD(typeName);
2793  WRITE_INT_FIELD(inhcount);
2794  WRITE_BOOL_FIELD(is_local);
2795  WRITE_BOOL_FIELD(is_not_null);
2796  WRITE_BOOL_FIELD(is_from_type);
2797  WRITE_BOOL_FIELD(is_from_parent);
2798  WRITE_CHAR_FIELD(storage);
2799  WRITE_NODE_FIELD(raw_default);
2800  WRITE_NODE_FIELD(cooked_default);
2801  WRITE_CHAR_FIELD(identity);
2802  WRITE_NODE_FIELD(collClause);
2803  WRITE_OID_FIELD(collOid);
2804  WRITE_NODE_FIELD(constraints);
2805  WRITE_NODE_FIELD(fdwoptions);
2806  WRITE_LOCATION_FIELD(location);
2807 }
2808 
2809 static void
2811 {
2812  WRITE_NODE_TYPE("TYPENAME");
2813 
2814  WRITE_NODE_FIELD(names);
2815  WRITE_OID_FIELD(typeOid);
2816  WRITE_BOOL_FIELD(setof);
2817  WRITE_BOOL_FIELD(pct_type);
2818  WRITE_NODE_FIELD(typmods);
2819  WRITE_INT_FIELD(typemod);
2820  WRITE_NODE_FIELD(arrayBounds);
2821  WRITE_LOCATION_FIELD(location);
2822 }
2823 
2824 static void
2826 {
2827  WRITE_NODE_TYPE("TYPECAST");
2828 
2830  WRITE_NODE_FIELD(typeName);
2831  WRITE_LOCATION_FIELD(location);
2832 }
2833 
2834 static void
2836 {
2837  WRITE_NODE_TYPE("COLLATECLAUSE");
2838 
2840  WRITE_NODE_FIELD(collname);
2841  WRITE_LOCATION_FIELD(location);
2842 }
2843 
2844 static void
2846 {
2847  WRITE_NODE_TYPE("INDEXELEM");
2848 
2850  WRITE_NODE_FIELD(expr);
2851  WRITE_STRING_FIELD(indexcolname);
2852  WRITE_NODE_FIELD(collation);
2853  WRITE_NODE_FIELD(opclass);
2854  WRITE_ENUM_FIELD(ordering, SortByDir);
2855  WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2856 }
2857 
2858 static void
2859 _outQuery(StringInfo str, const Query *node)
2860 {
2861  WRITE_NODE_TYPE("QUERY");
2862 
2863  WRITE_ENUM_FIELD(commandType, CmdType);
2864  WRITE_ENUM_FIELD(querySource, QuerySource);
2865  /* we intentionally do not print the queryId field */
2866  WRITE_BOOL_FIELD(canSetTag);
2867 
2868  /*
2869  * Hack to work around missing outfuncs routines for a lot of the
2870  * utility-statement node types. (The only one we actually *need* for
2871  * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2872  * for the meantime do this to avoid getting lots of warnings when running
2873  * with debug_print_parse on.
2874  */
2875  if (node->utilityStmt)
2876  {
2877  switch (nodeTag(node->utilityStmt))
2878  {
2879  case T_CreateStmt:
2880  case T_IndexStmt:
2881  case T_NotifyStmt:
2882  case T_DeclareCursorStmt:
2883  WRITE_NODE_FIELD(utilityStmt);
2884  break;
2885  default:
2886  appendStringInfoString(str, " :utilityStmt ?");
2887  break;
2888  }
2889  }
2890  else
2891  appendStringInfoString(str, " :utilityStmt <>");
2892 
2893  WRITE_INT_FIELD(resultRelation);
2894  WRITE_BOOL_FIELD(hasAggs);
2895  WRITE_BOOL_FIELD(hasWindowFuncs);
2896  WRITE_BOOL_FIELD(hasTargetSRFs);
2897  WRITE_BOOL_FIELD(hasSubLinks);
2898  WRITE_BOOL_FIELD(hasDistinctOn);
2899  WRITE_BOOL_FIELD(hasRecursive);
2900  WRITE_BOOL_FIELD(hasModifyingCTE);
2901  WRITE_BOOL_FIELD(hasForUpdate);
2902  WRITE_BOOL_FIELD(hasRowSecurity);
2903  WRITE_NODE_FIELD(cteList);
2904  WRITE_NODE_FIELD(rtable);
2905  WRITE_NODE_FIELD(jointree);
2906  WRITE_NODE_FIELD(targetList);
2907  WRITE_ENUM_FIELD(override, OverridingKind);
2908  WRITE_NODE_FIELD(onConflict);
2909  WRITE_NODE_FIELD(returningList);
2910  WRITE_NODE_FIELD(groupClause);
2911  WRITE_NODE_FIELD(groupingSets);
2912  WRITE_NODE_FIELD(havingQual);
2913  WRITE_NODE_FIELD(windowClause);
2914  WRITE_NODE_FIELD(distinctClause);
2915  WRITE_NODE_FIELD(sortClause);
2916  WRITE_NODE_FIELD(limitOffset);
2917  WRITE_NODE_FIELD(limitCount);
2918  WRITE_NODE_FIELD(rowMarks);
2919  WRITE_NODE_FIELD(setOperations);
2920  WRITE_NODE_FIELD(constraintDeps);
2921  /* withCheckOptions intentionally omitted, see comment in parsenodes.h */
2922  WRITE_LOCATION_FIELD(stmt_location);
2923  WRITE_LOCATION_FIELD(stmt_len);
2924 }
2925 
2926 static void
2928 {
2929  WRITE_NODE_TYPE("WITHCHECKOPTION");
2930 
2931  WRITE_ENUM_FIELD(kind, WCOKind);
2932  WRITE_STRING_FIELD(relname);
2933  WRITE_STRING_FIELD(polname);
2934  WRITE_NODE_FIELD(qual);
2935  WRITE_BOOL_FIELD(cascaded);
2936 }
2937 
2938 static void
2940 {
2941  WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2942 
2943  WRITE_UINT_FIELD(tleSortGroupRef);
2944  WRITE_OID_FIELD(eqop);
2945  WRITE_OID_FIELD(sortop);
2946  WRITE_BOOL_FIELD(nulls_first);
2947  WRITE_BOOL_FIELD(hashable);
2948 }
2949 
2950 static void
2952 {
2953  WRITE_NODE_TYPE("GROUPINGSET");
2954 
2956  WRITE_NODE_FIELD(content);
2957  WRITE_LOCATION_FIELD(location);
2958 }
2959 
2960 static void
2962 {
2963  WRITE_NODE_TYPE("WINDOWCLAUSE");
2964 
2966  WRITE_STRING_FIELD(refname);
2967  WRITE_NODE_FIELD(partitionClause);
2968  WRITE_NODE_FIELD(orderClause);
2969  WRITE_INT_FIELD(frameOptions);
2970  WRITE_NODE_FIELD(startOffset);
2971  WRITE_NODE_FIELD(endOffset);
2972  WRITE_UINT_FIELD(winref);
2973  WRITE_BOOL_FIELD(copiedOrder);
2974 }
2975 
2976 static void
2978 {
2979  WRITE_NODE_TYPE("ROWMARKCLAUSE");
2980 
2981  WRITE_UINT_FIELD(rti);
2983  WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2984  WRITE_BOOL_FIELD(pushedDown);
2985 }
2986 
2987 static void
2989 {
2990  WRITE_NODE_TYPE("WITHCLAUSE");
2991 
2992  WRITE_NODE_FIELD(ctes);
2993  WRITE_BOOL_FIELD(recursive);
2994  WRITE_LOCATION_FIELD(location);
2995 }
2996 
2997 static void
2999 {
3000  WRITE_NODE_TYPE("COMMONTABLEEXPR");
3001 
3002  WRITE_STRING_FIELD(ctename);
3003  WRITE_NODE_FIELD(aliascolnames);
3004  WRITE_NODE_FIELD(ctequery);
3005  WRITE_LOCATION_FIELD(location);
3006  WRITE_BOOL_FIELD(cterecursive);
3007  WRITE_INT_FIELD(cterefcount);
3008  WRITE_NODE_FIELD(ctecolnames);
3009  WRITE_NODE_FIELD(ctecoltypes);
3010  WRITE_NODE_FIELD(ctecoltypmods);
3011  WRITE_NODE_FIELD(ctecolcollations);
3012 }
3013 
3014 static void
3016 {
3017  WRITE_NODE_TYPE("SETOPERATIONSTMT");
3018 
3020  WRITE_BOOL_FIELD(all);
3021  WRITE_NODE_FIELD(larg);
3022  WRITE_NODE_FIELD(rarg);
3023  WRITE_NODE_FIELD(colTypes);
3024  WRITE_NODE_FIELD(colTypmods);
3025  WRITE_NODE_FIELD(colCollations);
3026  WRITE_NODE_FIELD(groupClauses);
3027 }
3028 
3029 static void
3031 {
3032  WRITE_NODE_TYPE("RTE");
3033 
3034  /* put alias + eref first to make dump more legible */
3035  WRITE_NODE_FIELD(alias);
3036  WRITE_NODE_FIELD(eref);
3037  WRITE_ENUM_FIELD(rtekind, RTEKind);
3038 
3039  switch (node->rtekind)
3040  {
3041  case RTE_RELATION:
3042  WRITE_OID_FIELD(relid);
3043  WRITE_CHAR_FIELD(relkind);
3044  WRITE_NODE_FIELD(tablesample);
3045  break;
3046  case RTE_SUBQUERY:
3047  WRITE_NODE_FIELD(subquery);
3048  WRITE_BOOL_FIELD(security_barrier);
3049  break;
3050  case RTE_JOIN:
3051  WRITE_ENUM_FIELD(jointype, JoinType);
3052  WRITE_NODE_FIELD(joinaliasvars);
3053  break;
3054  case RTE_FUNCTION:
3056  WRITE_BOOL_FIELD(funcordinality);
3057  break;
3058  case RTE_TABLEFUNC:
3059  WRITE_NODE_FIELD(tablefunc);
3060  break;
3061  case RTE_VALUES:
3062  WRITE_NODE_FIELD(values_lists);
3063  WRITE_NODE_FIELD(coltypes);
3064  WRITE_NODE_FIELD(coltypmods);
3065  WRITE_NODE_FIELD(colcollations);
3066  break;
3067  case RTE_CTE:
3068  WRITE_STRING_FIELD(ctename);
3069  WRITE_UINT_FIELD(ctelevelsup);
3070  WRITE_BOOL_FIELD(self_reference);
3071  WRITE_NODE_FIELD(coltypes);
3072  WRITE_NODE_FIELD(coltypmods);
3073  WRITE_NODE_FIELD(colcollations);
3074  break;
3075  case RTE_NAMEDTUPLESTORE:
3076  WRITE_STRING_FIELD(enrname);
3077  WRITE_FLOAT_FIELD(enrtuples, "%.0f");
3078  WRITE_OID_FIELD(relid);
3079  WRITE_NODE_FIELD(coltypes);
3080  WRITE_NODE_FIELD(coltypmods);
3081  WRITE_NODE_FIELD(colcollations);
3082  break;
3083  default:
3084  elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
3085  break;
3086  }
3087 
3088  WRITE_BOOL_FIELD(lateral);
3089  WRITE_BOOL_FIELD(inh);
3090  WRITE_BOOL_FIELD(inFromCl);
3091  WRITE_UINT_FIELD(requiredPerms);
3092  WRITE_OID_FIELD(checkAsUser);
3093  WRITE_BITMAPSET_FIELD(selectedCols);
3094  WRITE_BITMAPSET_FIELD(insertedCols);
3095  WRITE_BITMAPSET_FIELD(updatedCols);
3096  WRITE_NODE_FIELD(securityQuals);
3097 }
3098 
3099 static void
3101 {
3102  WRITE_NODE_TYPE("RANGETBLFUNCTION");
3103 
3104  WRITE_NODE_FIELD(funcexpr);
3105  WRITE_INT_FIELD(funccolcount);
3106  WRITE_NODE_FIELD(funccolnames);
3107  WRITE_NODE_FIELD(funccoltypes);
3108  WRITE_NODE_FIELD(funccoltypmods);
3109  WRITE_NODE_FIELD(funccolcollations);
3110  WRITE_BITMAPSET_FIELD(funcparams);
3111 }
3112 
3113 static void
3115 {
3116  WRITE_NODE_TYPE("TABLESAMPLECLAUSE");
3117 
3118  WRITE_OID_FIELD(tsmhandler);
3120  WRITE_NODE_FIELD(repeatable);
3121 }
3122 
3123 static void
3124 _outAExpr(StringInfo str, const A_Expr *node)
3125 {
3126  WRITE_NODE_TYPE("AEXPR");
3127 
3128  switch (node->kind)
3129  {
3130  case AEXPR_OP:
3131  appendStringInfoChar(str, ' ');
3133  break;
3134  case AEXPR_OP_ANY:
3135  appendStringInfoChar(str, ' ');
3137  appendStringInfoString(str, " ANY ");
3138  break;
3139  case AEXPR_OP_ALL:
3140  appendStringInfoChar(str, ' ');
3142  appendStringInfoString(str, " ALL ");
3143  break;
3144  case AEXPR_DISTINCT:
3145  appendStringInfoString(str, " DISTINCT ");
3147  break;
3148  case AEXPR_NOT_DISTINCT:
3149  appendStringInfoString(str, " NOT_DISTINCT ");
3151  break;
3152  case AEXPR_NULLIF:
3153  appendStringInfoString(str, " NULLIF ");
3155  break;
3156  case AEXPR_OF:
3157  appendStringInfoString(str, " OF ");
3159  break;
3160  case AEXPR_IN:
3161  appendStringInfoString(str, " IN ");
3163  break;
3164  case AEXPR_LIKE:
3165  appendStringInfoString(str, " LIKE ");
3167  break;
3168  case AEXPR_ILIKE:
3169  appendStringInfoString(str, " ILIKE ");
3171  break;
3172  case AEXPR_SIMILAR:
3173  appendStringInfoString(str, " SIMILAR ");
3175  break;
3176  case AEXPR_BETWEEN:
3177  appendStringInfoString(str, " BETWEEN ");
3179  break;
3180  case AEXPR_NOT_BETWEEN:
3181  appendStringInfoString(str, " NOT_BETWEEN ");
3183  break;
3184  case AEXPR_BETWEEN_SYM:
3185  appendStringInfoString(str, " BETWEEN_SYM ");
3187  break;
3188  case AEXPR_NOT_BETWEEN_SYM:
3189  appendStringInfoString(str, " NOT_BETWEEN_SYM ");
3191  break;
3192  case AEXPR_PAREN:
3193  appendStringInfoString(str, " PAREN");
3194  break;
3195  default:
3196  appendStringInfoString(str, " ??");
3197  break;
3198  }
3199 
3200  WRITE_NODE_FIELD(lexpr);
3201  WRITE_NODE_FIELD(rexpr);
3202  WRITE_LOCATION_FIELD(location);
3203 }
3204 
3205 static void
3207 {
3208  switch (value->type)
3209  {
3210  case T_Integer:
3211  appendStringInfo(str, "%ld", value->val.ival);
3212  break;
3213  case T_Float:
3214 
3215  /*
3216  * We assume the value is a valid numeric literal and so does not
3217  * need quoting.
3218  */
3219  appendStringInfoString(str, value->val.str);
3220  break;
3221  case T_String:
3222 
3223  /*
3224  * We use outToken to provide escaping of the string's content,
3225  * but we don't want it to do anything with an empty string.
3226  */
3227  appendStringInfoChar(str, '"');
3228  if (value->val.str[0] != '\0')
3229  outToken(str, value->val.str);
3230  appendStringInfoChar(str, '"');
3231  break;
3232  case T_BitString:
3233  /* internal representation already has leading 'b' */
3234  appendStringInfoString(str, value->val.str);
3235  break;
3236  case T_Null:
3237  /* this is seen only within A_Const, not in transformed trees */
3238  appendStringInfoString(str, "NULL");
3239  break;
3240  default:
3241  elog(ERROR, "unrecognized node type: %d", (int) value->type);
3242  break;
3243  }
3244 }
3245 
3246 static void
3248 {
3249  WRITE_NODE_TYPE("COLUMNREF");
3250 
3251  WRITE_NODE_FIELD(fields);
3252  WRITE_LOCATION_FIELD(location);
3253 }
3254 
3255 static void
3257 {
3258  WRITE_NODE_TYPE("PARAMREF");
3259 
3260  WRITE_INT_FIELD(number);
3261  WRITE_LOCATION_FIELD(location);
3262 }
3263 
3264 static void
3265 _outAConst(StringInfo str, const A_Const *node)
3266 {
3267  WRITE_NODE_TYPE("A_CONST");
3268 
3269  appendStringInfoString(str, " :val ");
3270  _outValue(str, &(node->val));
3271  WRITE_LOCATION_FIELD(location);
3272 }
3273 
3274 static void
3275 _outA_Star(StringInfo str, const A_Star *node)
3276 {
3277  WRITE_NODE_TYPE("A_STAR");
3278 }
3279 
3280 static void
3282 {
3283  WRITE_NODE_TYPE("A_INDICES");
3284 
3285  WRITE_BOOL_FIELD(is_slice);
3286  WRITE_NODE_FIELD(lidx);
3287  WRITE_NODE_FIELD(uidx);
3288 }
3289 
3290 static void
3292 {
3293  WRITE_NODE_TYPE("A_INDIRECTION");
3294 
3296  WRITE_NODE_FIELD(indirection);
3297 }
3298 
3299 static void
3301 {
3302  WRITE_NODE_TYPE("A_ARRAYEXPR");
3303 
3304  WRITE_NODE_FIELD(elements);
3305  WRITE_LOCATION_FIELD(location);
3306 }
3307 
3308 static void
3310 {
3311  WRITE_NODE_TYPE("RESTARGET");
3312 
3314  WRITE_NODE_FIELD(indirection);
3316  WRITE_LOCATION_FIELD(location);
3317 }
3318 
3319 static void
3321 {
3322  WRITE_NODE_TYPE("MULTIASSIGNREF");
3323 
3324  WRITE_NODE_FIELD(source);
3325  WRITE_INT_FIELD(colno);
3326  WRITE_INT_FIELD(ncolumns);
3327 }
3328 
3329 static void
3330 _outSortBy(StringInfo str, const SortBy *node)
3331 {
3332  WRITE_NODE_TYPE("SORTBY");
3333 
3334  WRITE_NODE_FIELD(node);
3335  WRITE_ENUM_FIELD(sortby_dir, SortByDir);
3336  WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
3337  WRITE_NODE_FIELD(useOp);
3338  WRITE_LOCATION_FIELD(location);
3339 }
3340 
3341 static void
3343 {
3344  WRITE_NODE_TYPE("WINDOWDEF");
3345 
3347  WRITE_STRING_FIELD(refname);
3348  WRITE_NODE_FIELD(partitionClause);
3349  WRITE_NODE_FIELD(orderClause);
3350  WRITE_INT_FIELD(frameOptions);
3351  WRITE_NODE_FIELD(startOffset);
3352  WRITE_NODE_FIELD(endOffset);
3353  WRITE_LOCATION_FIELD(location);
3354 }
3355 
3356 static void
3358 {
3359  WRITE_NODE_TYPE("RANGESUBSELECT");
3360 
3361  WRITE_BOOL_FIELD(lateral);
3362  WRITE_NODE_FIELD(subquery);
3363  WRITE_NODE_FIELD(alias);
3364 }
3365 
3366 static void
3368 {
3369  WRITE_NODE_TYPE("RANGEFUNCTION");
3370 
3371  WRITE_BOOL_FIELD(lateral);
3372  WRITE_BOOL_FIELD(ordinality);
3373  WRITE_BOOL_FIELD(is_rowsfrom);
3375  WRITE_NODE_FIELD(alias);
3376  WRITE_NODE_FIELD(coldeflist);
3377 }
3378 
3379 static void
3381 {
3382  WRITE_NODE_TYPE("RANGETABLESAMPLE");
3383 
3384  WRITE_NODE_FIELD(relation);
3385  WRITE_NODE_FIELD(method);
3387  WRITE_NODE_FIELD(repeatable);
3388  WRITE_LOCATION_FIELD(location);
3389 }
3390 
3391 static void
3393 {
3394  WRITE_NODE_TYPE("RANGETABLEFUNC");
3395 
3396  WRITE_BOOL_FIELD(lateral);
3397  WRITE_NODE_FIELD(docexpr);
3398  WRITE_NODE_FIELD(rowexpr);
3399  WRITE_NODE_FIELD(namespaces);
3400  WRITE_NODE_FIELD(columns);
3401  WRITE_NODE_FIELD(alias);
3402  WRITE_LOCATION_FIELD(location);
3403 }
3404 
3405 static void
3407 {
3408  WRITE_NODE_TYPE("RANGETABLEFUNCCOL");
3409 
3410  WRITE_STRING_FIELD(colname);
3411  WRITE_NODE_FIELD(typeName);
3412  WRITE_BOOL_FIELD(for_ordinality);
3413  WRITE_BOOL_FIELD(is_not_null);
3414  WRITE_NODE_FIELD(colexpr);
3415  WRITE_NODE_FIELD(coldefexpr);
3416  WRITE_LOCATION_FIELD(location);
3417 }
3418 
3419 static void
3421 {
3422  WRITE_NODE_TYPE("CONSTRAINT");
3423 
3424  WRITE_STRING_FIELD(conname);
3425  WRITE_BOOL_FIELD(deferrable);
3426  WRITE_BOOL_FIELD(initdeferred);
3427  WRITE_LOCATION_FIELD(location);
3428 
3429  appendStringInfoString(str, " :contype ");
3430  switch (node->contype)
3431  {
3432  case CONSTR_NULL:
3433  appendStringInfoString(str, "NULL");
3434  break;
3435 
3436  case CONSTR_NOTNULL:
3437  appendStringInfoString(str, "NOT_NULL");
3438  break;
3439 
3440  case CONSTR_DEFAULT:
3441  appendStringInfoString(str, "DEFAULT");
3442  WRITE_NODE_FIELD(raw_expr);
3443  WRITE_STRING_FIELD(cooked_expr);
3444  break;
3445 
3446  case CONSTR_IDENTITY:
3447  appendStringInfoString(str, "IDENTITY");
3448  WRITE_NODE_FIELD(raw_expr);
3449  WRITE_STRING_FIELD(cooked_expr);
3450  WRITE_CHAR_FIELD(generated_when);
3451  break;
3452 
3453  case CONSTR_CHECK:
3454  appendStringInfoString(str, "CHECK");
3455  WRITE_BOOL_FIELD(is_no_inherit);
3456  WRITE_NODE_FIELD(raw_expr);
3457  WRITE_STRING_FIELD(cooked_expr);
3458  break;
3459 
3460  case CONSTR_PRIMARY:
3461  appendStringInfoString(str, "PRIMARY_KEY");
3462  WRITE_NODE_FIELD(keys);
3464  WRITE_STRING_FIELD(indexname);
3465  WRITE_STRING_FIELD(indexspace);
3466  /* access_method and where_clause not currently used */
3467  break;
3468 
3469  case CONSTR_UNIQUE:
3470  appendStringInfoString(str, "UNIQUE");
3471  WRITE_NODE_FIELD(keys);
3473  WRITE_STRING_FIELD(indexname);
3474  WRITE_STRING_FIELD(indexspace);
3475  /* access_method and where_clause not currently used */
3476  break;
3477 
3478  case CONSTR_EXCLUSION:
3479  appendStringInfoString(str, "EXCLUSION");
3480  WRITE_NODE_FIELD(exclusions);
3482  WRITE_STRING_FIELD(indexname);
3483  WRITE_STRING_FIELD(indexspace);
3484  WRITE_STRING_FIELD(access_method);
3485  WRITE_NODE_FIELD(where_clause);
3486  break;
3487 
3488  case CONSTR_FOREIGN:
3489  appendStringInfoString(str, "FOREIGN_KEY");
3490  WRITE_NODE_FIELD(pktable);
3491  WRITE_NODE_FIELD(fk_attrs);
3492  WRITE_NODE_FIELD(pk_attrs);
3493  WRITE_CHAR_FIELD(fk_matchtype);
3494  WRITE_CHAR_FIELD(fk_upd_action);
3495  WRITE_CHAR_FIELD(fk_del_action);
3496  WRITE_NODE_FIELD(old_conpfeqop);
3497  WRITE_OID_FIELD(old_pktable_oid);
3498  WRITE_BOOL_FIELD(skip_validation);
3499  WRITE_BOOL_FIELD(initially_valid);
3500  break;
3501 
3503  appendStringInfoString(str, "ATTR_DEFERRABLE");
3504  break;
3505 
3507  appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
3508  break;
3509 
3510  case CONSTR_ATTR_DEFERRED:
3511  appendStringInfoString(str, "ATTR_DEFERRED");
3512  break;
3513 
3514  case CONSTR_ATTR_IMMEDIATE:
3515  appendStringInfoString(str, "ATTR_IMMEDIATE");
3516  break;
3517 
3518  default:
3519  appendStringInfo(str, "<unrecognized_constraint %d>",
3520  (int) node->contype);
3521  break;
3522  }
3523 }
3524 
3525 static void
3527 {
3528  int i;
3529 
3530  WRITE_NODE_TYPE("FOREIGNKEYCACHEINFO");
3531 
3532  WRITE_OID_FIELD(conrelid);
3533  WRITE_OID_FIELD(confrelid);
3534  WRITE_INT_FIELD(nkeys);
3535  appendStringInfoString(str, " :conkey");
3536  for (i = 0; i < node->nkeys; i++)
3537  appendStringInfo(str, " %d", node->conkey[i]);
3538  appendStringInfoString(str, " :confkey");
3539  for (i = 0; i < node->nkeys; i++)
3540  appendStringInfo(str, " %d", node->confkey[i]);
3541  appendStringInfoString(str, " :conpfeqop");
3542  for (i = 0; i < node->nkeys; i++)
3543  appendStringInfo(str, " %u", node->conpfeqop[i]);
3544 }
3545 
3546 static void
3548 {
3549  WRITE_NODE_TYPE("PARTITIONELEM");
3550 
3552  WRITE_NODE_FIELD(expr);
3553  WRITE_NODE_FIELD(collation);
3554  WRITE_NODE_FIELD(opclass);
3555  WRITE_LOCATION_FIELD(location);
3556 }
3557 
3558 static void
3560 {
3561  WRITE_NODE_TYPE("PARTITIONSPEC");
3562 
3563  WRITE_STRING_FIELD(strategy);
3564  WRITE_NODE_FIELD(partParams);
3565  WRITE_LOCATION_FIELD(location);
3566 }
3567 
3568 static void
3570 {
3571  WRITE_NODE_TYPE("PARTITIONBOUNDSPEC");
3572 
3573  WRITE_CHAR_FIELD(strategy);
3574  WRITE_NODE_FIELD(listdatums);
3575  WRITE_NODE_FIELD(lowerdatums);
3576  WRITE_NODE_FIELD(upperdatums);
3577  WRITE_LOCATION_FIELD(location);
3578 }
3579 
3580 static void
3582 {
3583  WRITE_NODE_TYPE("PARTITIONRANGEDATUM");
3584 
3587  WRITE_LOCATION_FIELD(location);
3588 }
3589 
3590 /*
3591  * outNode -
3592  * converts a Node into ascii string and append it to 'str'
3593  */
3594 void
3595 outNode(StringInfo str, const void *obj)
3596 {
3597  if (obj == NULL)
3598  appendStringInfoString(str, "<>");
3599  else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
3600  _outList(str, obj);
3601  else if (IsA(obj, Integer) ||
3602  IsA(obj, Float) ||
3603  IsA(obj, String) ||
3604  IsA(obj, BitString))
3605  {
3606  /* nodeRead does not want to see { } around these! */
3607  _outValue(str, obj);
3608  }
3609  else
3610  {
3611  appendStringInfoChar(str, '{');
3612  switch (nodeTag(obj))
3613  {
3614  case T_PlannedStmt:
3615  _outPlannedStmt(str, obj);
3616  break;
3617  case T_Plan:
3618  _outPlan(str, obj);
3619  break;
3620  case T_Result:
3621  _outResult(str, obj);
3622  break;
3623  case T_ProjectSet:
3624  _outProjectSet(str, obj);
3625  break;
3626  case T_ModifyTable:
3627  _outModifyTable(str, obj);
3628  break;
3629  case T_Append:
3630  _outAppend(str, obj);
3631  break;
3632  case T_MergeAppend:
3633  _outMergeAppend(str, obj);
3634  break;
3635  case T_RecursiveUnion:
3636  _outRecursiveUnion(str, obj);
3637  break;
3638  case T_BitmapAnd:
3639  _outBitmapAnd(str, obj);
3640  break;
3641  case T_BitmapOr:
3642  _outBitmapOr(str, obj);
3643  break;
3644  case T_Gather:
3645  _outGather(str, obj);
3646  break;
3647  case T_GatherMerge:
3648  _outGatherMerge(str, obj);
3649  break;
3650  case T_Scan:
3651  _outScan(str, obj);
3652  break;
3653  case T_SeqScan:
3654  _outSeqScan(str, obj);
3655  break;
3656  case T_SampleScan:
3657  _outSampleScan(str, obj);
3658  break;
3659  case T_IndexScan:
3660  _outIndexScan(str, obj);
3661  break;
3662  case T_IndexOnlyScan:
3663  _outIndexOnlyScan(str, obj);
3664  break;
3665  case T_BitmapIndexScan:
3666  _outBitmapIndexScan(str, obj);
3667  break;
3668  case T_BitmapHeapScan:
3669  _outBitmapHeapScan(str, obj);
3670  break;
3671  case T_TidScan:
3672  _outTidScan(str, obj);
3673  break;
3674  case T_SubqueryScan:
3675  _outSubqueryScan(str, obj);
3676  break;
3677  case T_FunctionScan:
3678  _outFunctionScan(str, obj);
3679  break;
3680  case T_TableFuncScan:
3681  _outTableFuncScan(str, obj);
3682  break;
3683  case T_ValuesScan:
3684  _outValuesScan(str, obj);
3685  break;
3686  case T_CteScan:
3687  _outCteScan(str, obj);
3688  break;
3689  case T_NamedTuplestoreScan:
3690  _outNamedTuplestoreScan(str, obj);
3691  break;
3692  case T_WorkTableScan:
3693  _outWorkTableScan(str, obj);
3694  break;
3695  case T_ForeignScan:
3696  _outForeignScan(str, obj);
3697  break;
3698  case T_CustomScan:
3699  _outCustomScan(str, obj);
3700  break;
3701  case T_Join:
3702  _outJoin(str, obj);
3703  break;
3704  case T_NestLoop:
3705  _outNestLoop(str, obj);
3706  break;
3707  case T_MergeJoin:
3708  _outMergeJoin(str, obj);
3709  break;
3710  case T_HashJoin:
3711  _outHashJoin(str, obj);
3712  break;
3713  case T_Agg:
3714  _outAgg(str, obj);
3715  break;
3716  case T_WindowAgg:
3717  _outWindowAgg(str, obj);
3718  break;
3719  case T_Group:
3720  _outGroup(str, obj);
3721  break;
3722  case T_Material:
3723  _outMaterial(str, obj);
3724  break;
3725  case T_Sort:
3726  _outSort(str, obj);
3727  break;
3728  case T_Unique:
3729  _outUnique(str, obj);
3730  break;
3731  case T_Hash:
3732  _outHash(str, obj);
3733  break;
3734  case T_SetOp:
3735  _outSetOp(str, obj);
3736  break;
3737  case T_LockRows:
3738  _outLockRows(str, obj);
3739  break;
3740  case T_Limit:
3741  _outLimit(str, obj);
3742  break;
3743  case T_NestLoopParam:
3744  _outNestLoopParam(str, obj);
3745  break;
3746  case T_PlanRowMark:
3747  _outPlanRowMark(str, obj);
3748  break;
3749  case T_PlanInvalItem:
3750  _outPlanInvalItem(str, obj);
3751  break;
3752  case T_Alias:
3753  _outAlias(str, obj);
3754  break;
3755  case T_RangeVar:
3756  _outRangeVar(str, obj);
3757  break;
3758  case T_TableFunc:
3759  _outTableFunc(str, obj);
3760  break;
3761  case T_IntoClause:
3762  _outIntoClause(str, obj);
3763  break;
3764  case T_Var:
3765  _outVar(str, obj);
3766  break;
3767  case T_Const:
3768  _outConst(str, obj);
3769  break;
3770  case T_Param:
3771  _outParam(str, obj);
3772  break;
3773  case T_Aggref:
3774  _outAggref(str, obj);
3775  break;
3776  case T_GroupingFunc:
3777  _outGroupingFunc(str, obj);
3778  break;
3779  case T_WindowFunc:
3780  _outWindowFunc(str, obj);
3781  break;
3782  case T_ArrayRef:
3783  _outArrayRef(str, obj);
3784  break;
3785  case T_FuncExpr:
3786  _outFuncExpr(str, obj);
3787  break;
3788  case T_NamedArgExpr:
3789  _outNamedArgExpr(str, obj);
3790  break;
3791  case T_OpExpr:
3792  _outOpExpr(str, obj);
3793  break;
3794  case T_DistinctExpr:
3795  _outDistinctExpr(str, obj);
3796  break;
3797  case T_NullIfExpr:
3798  _outNullIfExpr(str, obj);
3799  break;
3800  case T_ScalarArrayOpExpr:
3801  _outScalarArrayOpExpr(str, obj);
3802  break;
3803  case T_BoolExpr:
3804  _outBoolExpr(str, obj);
3805  break;
3806  case T_SubLink:
3807  _outSubLink(str, obj);
3808  break;
3809  case T_SubPlan:
3810  _outSubPlan(str, obj);
3811  break;
3812  case T_AlternativeSubPlan:
3813  _outAlternativeSubPlan(str, obj);
3814  break;
3815  case T_FieldSelect:
3816  _outFieldSelect(str, obj);
3817  break;
3818  case T_FieldStore:
3819  _outFieldStore(str, obj);
3820  break;
3821  case T_RelabelType:
3822  _outRelabelType(str, obj);
3823  break;
3824  case T_CoerceViaIO:
3825  _outCoerceViaIO(str, obj);
3826  break;
3827  case T_ArrayCoerceExpr:
3828  _outArrayCoerceExpr(str, obj);
3829  break;
3830  case T_ConvertRowtypeExpr:
3831  _outConvertRowtypeExpr(str, obj);
3832  break;
3833  case T_CollateExpr:
3834  _outCollateExpr(str, obj);
3835  break;
3836  case T_CaseExpr:
3837  _outCaseExpr(str, obj);
3838  break;
3839  case T_CaseWhen:
3840  _outCaseWhen(str, obj);
3841  break;
3842  case T_CaseTestExpr:
3843  _outCaseTestExpr(str, obj);
3844  break;
3845  case T_ArrayExpr:
3846  _outArrayExpr(str, obj);
3847  break;
3848  case T_RowExpr:
3849  _outRowExpr(str, obj);
3850  break;
3851  case T_RowCompareExpr:
3852  _outRowCompareExpr(str, obj);
3853  break;
3854  case T_CoalesceExpr:
3855  _outCoalesceExpr(str, obj);
3856  break;
3857  case T_MinMaxExpr:
3858  _outMinMaxExpr(str, obj);
3859  break;
3860  case T_SQLValueFunction:
3861  _outSQLValueFunction(str, obj);
3862  break;
3863  case T_XmlExpr:
3864  _outXmlExpr(str, obj);
3865  break;
3866  case T_NullTest:
3867  _outNullTest(str, obj);
3868  break;
3869  case T_BooleanTest:
3870  _outBooleanTest(str, obj);
3871  break;
3872  case T_CoerceToDomain:
3873  _outCoerceToDomain(str, obj);
3874  break;
3875  case T_CoerceToDomainValue:
3876  _outCoerceToDomainValue(str, obj);
3877  break;
3878  case T_SetToDefault:
3879  _outSetToDefault(str, obj);
3880  break;
3881  case T_CurrentOfExpr:
3882  _outCurrentOfExpr(str, obj);
3883  break;
3884  case T_NextValueExpr:
3885  _outNextValueExpr(str, obj);
3886  break;
3887  case T_InferenceElem:
3888  _outInferenceElem(str, obj);
3889  break;
3890  case T_TargetEntry:
3891  _outTargetEntry(str, obj);
3892  break;
3893  case T_RangeTblRef:
3894  _outRangeTblRef(str, obj);
3895  break;
3896  case T_JoinExpr:
3897  _outJoinExpr(str, obj);
3898  break;
3899  case T_FromExpr:
3900  _outFromExpr(str, obj);
3901  break;
3902  case T_OnConflictExpr:
3903  _outOnConflictExpr(str, obj);
3904  break;
3905  case T_Path:
3906  _outPath(str, obj);
3907  break;
3908  case T_IndexPath:
3909  _outIndexPath(str, obj);
3910  break;
3911  case T_BitmapHeapPath:
3912  _outBitmapHeapPath(str, obj);
3913  break;
3914  case T_BitmapAndPath:
3915  _outBitmapAndPath(str, obj);
3916  break;
3917  case T_BitmapOrPath:
3918  _outBitmapOrPath(str, obj);
3919  break;
3920  case T_TidPath:
3921  _outTidPath(str, obj);
3922  break;
3923  case T_SubqueryScanPath:
3924  _outSubqueryScanPath(str, obj);
3925  break;
3926  case T_ForeignPath:
3927  _outForeignPath(str, obj);
3928  break;
3929  case T_CustomPath:
3930  _outCustomPath(str, obj);
3931  break;
3932  case T_AppendPath:
3933  _outAppendPath(str, obj);
3934  break;
3935  case T_MergeAppendPath:
3936  _outMergeAppendPath(str, obj);
3937  break;
3938  case T_ResultPath:
3939  _outResultPath(str, obj);
3940  break;
3941  case T_MaterialPath:
3942  _outMaterialPath(str, obj);
3943  break;
3944  case T_UniquePath:
3945  _outUniquePath(str, obj);
3946  break;
3947  case T_GatherPath:
3948  _outGatherPath(str, obj);
3949  break;
3950  case T_ProjectionPath:
3951  _outProjectionPath(str, obj);
3952  break;
3953  case T_ProjectSetPath:
3954  _outProjectSetPath(str, obj);
3955  break;
3956  case T_SortPath:
3957  _outSortPath(str, obj);
3958  break;
3959  case T_GroupPath:
3960  _outGroupPath(str, obj);
3961  break;
3962  case T_UpperUniquePath:
3963  _outUpperUniquePath(str, obj);
3964  break;
3965  case T_AggPath:
3966  _outAggPath(str, obj);
3967  break;
3968  case T_GroupingSetsPath:
3969  _outGroupingSetsPath(str, obj);
3970  break;
3971  case T_MinMaxAggPath:
3972  _outMinMaxAggPath(str, obj);
3973  break;
3974  case T_WindowAggPath:
3975  _outWindowAggPath(str, obj);
3976  break;
3977  case T_SetOpPath:
3978  _outSetOpPath(str, obj);
3979  break;
3980  case T_RecursiveUnionPath:
3981  _outRecursiveUnionPath(str, obj);
3982  break;
3983  case T_LockRowsPath:
3984  _outLockRowsPath(str, obj);
3985  break;
3986  case T_ModifyTablePath:
3987  _outModifyTablePath(str, obj);
3988  break;
3989  case T_LimitPath:
3990  _outLimitPath(str, obj);
3991  break;
3992  case T_GatherMergePath:
3993  _outGatherMergePath(str, obj);
3994  break;
3995  case T_NestPath:
3996  _outNestPath(str, obj);
3997  break;
3998  case T_MergePath:
3999  _outMergePath(str, obj);
4000  break;
4001  case T_HashPath:
4002  _outHashPath(str, obj);
4003  break;
4004  case T_PlannerGlobal:
4005  _outPlannerGlobal(str, obj);
4006  break;
4007  case T_PlannerInfo:
4008  _outPlannerInfo(str, obj);
4009  break;
4010  case T_RelOptInfo:
4011  _outRelOptInfo(str, obj);
4012  break;
4013  case T_IndexOptInfo:
4014  _outIndexOptInfo(str, obj);
4015  break;
4016  case T_ForeignKeyOptInfo:
4017  _outForeignKeyOptInfo(str, obj);
4018  break;
4019  case T_EquivalenceClass:
4020  _outEquivalenceClass(str, obj);
4021  break;
4022  case T_EquivalenceMember:
4023  _outEquivalenceMember(str, obj);
4024  break;
4025  case T_PathKey:
4026  _outPathKey(str, obj);
4027  break;
4028  case T_PathTarget:
4029  _outPathTarget(str, obj);
4030  break;
4031  case T_ParamPathInfo:
4032  _outParamPathInfo(str, obj);
4033  break;
4034  case T_RestrictInfo:
4035  _outRestrictInfo(str, obj);
4036  break;
4037  case T_PlaceHolderVar:
4038  _outPlaceHolderVar(str, obj);
4039  break;
4040  case T_SpecialJoinInfo:
4041  _outSpecialJoinInfo(str, obj);
4042  break;
4043  case T_AppendRelInfo:
4044  _outAppendRelInfo(str, obj);
4045  break;
4047  _outPartitionedChildRelInfo(str, obj);
4048  break;
4049  case T_PlaceHolderInfo:
4050  _outPlaceHolderInfo(str, obj);
4051  break;
4052  case T_MinMaxAggInfo:
4053  _outMinMaxAggInfo(str, obj);
4054  break;
4055  case T_PlannerParamItem:
4056  _outPlannerParamItem(str, obj);
4057  break;
4058  case T_RollupData:
4059  _outRollupData(str, obj);
4060  break;
4061  case T_GroupingSetData:
4062  _outGroupingSetData(str, obj);
4063  break;
4064  case T_StatisticExtInfo:
4065  _outStatisticExtInfo(str, obj);
4066  break;
4067  case T_ExtensibleNode:
4068  _outExtensibleNode(str, obj);
4069  break;
4070  case T_CreateStmt:
4071  _outCreateStmt(str, obj);
4072  break;
4074  _outCreateForeignTableStmt(str, obj);
4075  break;
4077  _outImportForeignSchemaStmt(str, obj);
4078  break;
4079  case T_IndexStmt:
4080  _outIndexStmt(str, obj);
4081  break;
4082  case T_CreateStatsStmt:
4083  _outCreateStatsStmt(str, obj);
4084  break;
4085  case T_NotifyStmt:
4086  _outNotifyStmt(str, obj);
4087  break;
4088  case T_DeclareCursorStmt:
4089  _outDeclareCursorStmt(str, obj);
4090  break;
4091  case T_SelectStmt:
4092  _outSelectStmt(str, obj);
4093  break;
4094  case T_ColumnDef:
4095  _outColumnDef(str, obj);
4096  break;
4097  case T_TypeName:
4098  _outTypeName(str, obj);
4099  break;
4100  case T_TypeCast:
4101  _outTypeCast(str, obj);
4102  break;
4103  case T_CollateClause:
4104  _outCollateClause(str, obj);
4105  break;
4106  case T_IndexElem:
4107  _outIndexElem(str, obj);
4108  break;
4109  case T_Query:
4110  _outQuery(str, obj);
4111  break;
4112  case T_WithCheckOption:
4113  _outWithCheckOption(str, obj);
4114  break;
4115  case T_SortGroupClause:
4116  _outSortGroupClause(str, obj);
4117  break;
4118  case T_GroupingSet:
4119  _outGroupingSet(str, obj);
4120  break;
4121  case T_WindowClause:
4122  _outWindowClause(str, obj);
4123  break;
4124  case T_RowMarkClause:
4125  _outRowMarkClause(str, obj);
4126  break;
4127  case T_WithClause:
4128  _outWithClause(str, obj);
4129  break;
4130  case T_CommonTableExpr:
4131  _outCommonTableExpr(str, obj);
4132  break;
4133  case T_SetOperationStmt:
4134  _outSetOperationStmt(str, obj);
4135  break;
4136  case T_RangeTblEntry:
4137  _outRangeTblEntry(str, obj);
4138  break;
4139  case T_RangeTblFunction:
4140  _outRangeTblFunction(str, obj);
4141  break;
4142  case T_TableSampleClause:
4143  _outTableSampleClause(str, obj);
4144  break;
4145  case T_A_Expr:
4146  _outAExpr(str, obj);
4147  break;
4148  case T_ColumnRef:
4149  _outColumnRef(str, obj);
4150  break;
4151  case T_ParamRef:
4152  _outParamRef(str, obj);
4153  break;
4154  case T_A_Const:
4155  _outAConst(str, obj);
4156  break;
4157  case T_A_Star:
4158  _outA_Star(str, obj);
4159  break;
4160  case T_A_Indices:
4161  _outA_Indices(str, obj);
4162  break;
4163  case T_A_Indirection:
4164  _outA_Indirection(str, obj);
4165  break;
4166  case T_A_ArrayExpr:
4167  _outA_ArrayExpr(str, obj);
4168  break;
4169  case T_ResTarget:
4170  _outResTarget(str, obj);
4171  break;
4172  case T_MultiAssignRef:
4173  _outMultiAssignRef(str, obj);
4174  break;
4175  case T_SortBy:
4176  _outSortBy(str, obj);
4177  break;
4178  case T_WindowDef:
4179  _outWindowDef(str, obj);
4180  break;
4181  case T_RangeSubselect:
4182  _outRangeSubselect(str, obj);
4183  break;
4184  case T_RangeFunction:
4185  _outRangeFunction(str, obj);
4186  break;
4187  case T_RangeTableSample:
4188  _outRangeTableSample(str, obj);
4189  break;
4190  case T_RangeTableFunc:
4191  _outRangeTableFunc(str, obj);
4192  break;
4193  case T_RangeTableFuncCol:
4194  _outRangeTableFuncCol(str, obj);
4195  break;
4196  case T_Constraint:
4197  _outConstraint(str, obj);
4198  break;
4199  case T_FuncCall:
4200  _outFuncCall(str, obj);
4201  break;
4202  case T_DefElem:
4203  _outDefElem(str, obj);
4204  break;
4205  case T_TableLikeClause:
4206  _outTableLikeClause(str, obj);
4207  break;
4208  case T_LockingClause:
4209  _outLockingClause(str, obj);
4210  break;
4211  case T_XmlSerialize:
4212  _outXmlSerialize(str, obj);
4213  break;
4214  case T_ForeignKeyCacheInfo:
4215  _outForeignKeyCacheInfo(str, obj);
4216  break;
4217  case T_TriggerTransition:
4218  _outTriggerTransition(str, obj);
4219  break;
4220  case T_PartitionElem:
4221  _outPartitionElem(str, obj);
4222  break;
4223  case T_PartitionSpec:
4224  _outPartitionSpec(str, obj);
4225  break;
4226  case T_PartitionBoundSpec:
4227  _outPartitionBoundSpec(str, obj);
4228  break;
4229  case T_PartitionRangeDatum:
4230  _outPartitionRangeDatum(str, obj);
4231  break;
4232 
4233  default:
4234 
4235  /*
4236  * This should be an ERROR, but it's too useful to be able to
4237  * dump structures that outNode only understands part of.
4238  */
4239  elog(WARNING, "could not dump unrecognized node type: %d",
4240  (int) nodeTag(obj));
4241  break;
4242  }
4243  appendStringInfoChar(str, '}');
4244  }
4245 }
4246 
4247 /*
4248  * nodeToString -
4249  * returns the ascii representation of the Node as a palloc'd string
4250  */
4251 char *
4252 nodeToString(const void *obj)
4253 {
4254  StringInfoData str;
4255 
4256  /* see stringinfo.h for an explanation of this maneuver */
4257  initStringInfo(&str);
4258  outNode(&str, obj);
4259  return str.data;
4260 }
4261 
4262 /*
4263  * bmsToString -
4264  * returns the ascii representation of the Bitmapset as a palloc'd string
4265  */
4266 char *
4268 {
4269  StringInfoData str;
4270 
4271  /* see stringinfo.h for an explanation of this maneuver */
4272  initStringInfo(&str);
4273  outBitmapset(&str, bms);
4274  return str.data;
4275 }
Datum constvalue
Definition: primnodes.h:196
static void _outRangeTableFunc(StringInfo str, const RangeTableFunc *node)
Definition: outfuncs.c:3392
static void _outA_Indices(StringInfo str, const A_Indices *node)
Definition: outfuncs.c:3281
int numCols
Definition: plannodes.h:821
static void _outValue(StringInfo str, const Value *value)
Definition: outfuncs.c:3206
static void _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
Definition: outfuncs.c:2522
SortByDir
Definition: parsenodes.h:48
static void _outCaseExpr(StringInfo str, const CaseExpr *node)
Definition: outfuncs.c:1426
int ordNumCols
Definition: plannodes.h:806
static void _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
Definition: outfuncs.c:2482
static void _outAppend(StringInfo str, const Append *node)
Definition: outfuncs.c:389
int length(const List *list)
Definition: list.c:1271
int numCols
Definition: plannodes.h:785
static void _outWindowAgg(StringInfo str, const WindowAgg *node)
Definition: outfuncs.c:799
Definition: nodes.h:77
static void _outProjectionPath(StringInfo str, const ProjectionPath *node)
Definition: outfuncs.c:1918
#define IsA(nodeptr, _type_)
Definition: nodes.h:560
static void _outRowExpr(StringInfo str, const RowExpr *node)
Definition: outfuncs.c:1472
PathTarget * pathtarget
Definition: relation.h:955
static void _outRangeSubselect(StringInfo str, const RangeSubselect *node)
Definition: outfuncs.c:3357
static void _outParam(StringInfo str, const Param *node)
Definition: outfuncs.c:1105
static void _outScalarArrayOpExpr(StringInfo str, const ScalarArrayOpExpr *node)
Definition: outfuncs.c:1258
static void _outCommonTableExpr(StringInfo str, const CommonTableExpr *node)
Definition: outfuncs.c:2998
#define WRITE_INT_FIELD(fldname)
Definition: outfuncs.c:50
static void _outForeignPath(StringInfo str, const ForeignPath *node)
Definition: outfuncs.c:1825
Oid * collations
Definition: plannodes.h:850
static void _outBitmapAnd(StringInfo str, const BitmapAnd *node)
Definition: outfuncs.c:454
static void _outGatherMergePath(StringInfo str, const GatherMergePath *node)
Definition: outfuncs.c:2120
static void _outTableFunc(StringInfo str, const TableFunc *node)
Definition: outfuncs.c:1035
Definition: nodes.h:79
static void _outIndexStmt(StringInfo str, const IndexStmt *node)
Definition: outfuncs.c:2636
AttrNumber * grpColIdx
Definition: plannodes.h:786
ParamKind
Definition: primnodes.h:233
A_Expr_Kind kind
Definition: parsenodes.h:274
bool constbyval
Definition: primnodes.h:199
static void _outTargetEntry(StringInfo str, const TargetEntry *node)
Definition: outfuncs.c:1633
Definition: nodes.h:53
#define WRITE_LOCATION_FIELD(fldname)
Definition: outfuncs.c:90
void outToken(StringInfo str, const char *s)
Definition: outfuncs.c:115
static void _outFunctionScan(StringInfo str, const FunctionScan *node)
Definition: outfuncs.c:615
static void _outMergeJoin(StringInfo str, const MergeJoin *node)
Definition: outfuncs.c:730
static void _outNullTest(StringInfo str, const NullTest *node)
Definition: outfuncs.c:1548
static void _outDefElem(StringInfo str, const DefElem *node)
Definition: outfuncs.c:2735
static void _outJoinExpr(StringInfo str, const JoinExpr *node)
Definition: outfuncs.c:1655
static void _outA_Indirection(StringInfo str, const A_Indirection *node)
Definition: outfuncs.c:3291
static void _outScan(StringInfo str, const Scan *node)
Definition: outfuncs.c:516
Oid * collations
Definition: plannodes.h:268
static void _outPartitionElem(StringInfo str, const PartitionElem *node)
Definition: outfuncs.c:3547
static void _outUnique(StringInfo str, const Unique *node)
Definition: outfuncs.c:890
long ival
Definition: value.h:47
static void _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
Definition: outfuncs.c:2549
static void _outGroupPath(StringInfo str, const GroupPath *node)
Definition: outfuncs.c:1949
AttrNumber * sortColIdx
Definition: plannodes.h:848
static void _outRelOptInfo(StringInfo str, const RelOptInfo *node)
Definition: outfuncs.c:2242
#define WRITE_BITMAPSET_FIELD(fldname)
Definition: outfuncs.c:99
#define booltostr(x)
Definition: outfuncs.c:104
PartitionRangeDatumKind
Definition: parsenodes.h:816
static void _outWindowDef(StringInfo str, const WindowDef *node)
Definition: outfuncs.c:3342
static void _outRowMarkClause(StringInfo str, const RowMarkClause *node)
Definition: outfuncs.c:2977
static void _outStatisticExtInfo(StringInfo str, const StatisticExtInfo *node)
Definition: outfuncs.c:2347
BoolTestType
Definition: primnodes.h:1195
static void _outCreateStmt(StringInfo str, const CreateStmt *node)
Definition: outfuncs.c:2604
#define WRITE_ENUM_FIELD(fldname, enumtype)
Definition: outfuncs.c:71
AttrNumber * ordColIdx
Definition: plannodes.h:807
static void _outSampleScan(StringInfo str, const SampleScan *node)
Definition: outfuncs.c:532
AttrNumber conkey[INDEX_MAX_KEYS]
Definition: rel.h:243
XmlExprOp
Definition: primnodes.h:1121
int bms_next_member(const Bitmapset *a, int prevbit)
Definition: bitmapset.c:937
static void _outForeignScan(StringInfo str, const ForeignScan *node)
Definition: outfuncs.c:677
RelOptKind
Definition: relation.h:492
static void _outRelabelType(StringInfo str, const RelabelType *node)
Definition: outfuncs.c:1365
QuerySource
Definition: parsenodes.h:38
ParamPathInfo * param_info
Definition: relation.h:957
static void _outTableFuncScan(StringInfo str, const TableFuncScan *node)
Definition: outfuncs.c:626
#define WRITE_LONG_FIELD(fldname)
Definition: outfuncs.c:62
static void _outCustomPath(StringInfo str, const CustomPath *node)
Definition: outfuncs.c:1836
static void _outMaterial(StringInfo str, const Material *node)
Definition: outfuncs.c:854
bool * nullsFirst
Definition: plannodes.h:851
static void _outPartitionRangeDatum(StringInfo str, const PartitionRangeDatum *node)
Definition: outfuncs.c:3581
static void _outTableLikeClause(StringInfo str, const TableLikeClause *node)
Definition: outfuncs.c:2747
static void _outSetOp(StringInfo str, const SetOp *node)
Definition: outfuncs.c:922
bool * nullsFirst
Definition: plannodes.h:749
static void _outRangeTblRef(StringInfo str, const RangeTblRef *node)
Definition: outfuncs.c:1647
Definition: nodes.h:48
static void _outOpExpr(StringInfo str, const OpExpr *node)
Definition: outfuncs.c:1213
static void _outTidScan(StringInfo str, const TidScan *node)
Definition: outfuncs.c:595
AttrNumber * dupColIdx
Definition: plannodes.h:882
static void _outNestLoop(StringInfo str, const NestLoop *node)
Definition: outfuncs.c:720
static void _outWithClause(StringInfo str, const WithClause *node)
Definition: outfuncs.c:2988
static void _outCteScan(StringInfo str, const CteScan *node)
Definition: outfuncs.c:646
return result
Definition: formatting.c:1633
static void _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
Definition: outfuncs.c:2683
Definition: nodes.h:75
void outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
Definition: outfuncs.c:221
NullTestType
Definition: primnodes.h:1172
static void _outA_Star(StringInfo str, const A_Star *node)
Definition: outfuncs.c:3275
static void _outProjectSet(StringInfo str, const ProjectSet *node)
Definition: outfuncs.c:352
#define WRITE_OID_FIELD(fldname)
Definition: outfuncs.c:58
NodeTag
Definition: nodes.h:26
static void _outCurrentOfExpr(StringInfo str, const CurrentOfExpr *node)
Definition: outfuncs.c:1604
static void _outRollupData(StringInfo str, const RollupData *node)
Definition: outfuncs.c:1987
Node * utilityStmt
Definition: parsenodes.h:118
static void _outRowCompareExpr(StringInfo str, const RowCompareExpr *node)
Definition: outfuncs.c:1484
Definition: primnodes.h:163
#define WRITE_UINT_FIELD(fldname)
Definition: outfuncs.c:54
static void _outParamRef(StringInfo str, const ParamRef *node)
Definition: outfuncs.c:3256
static void _outRangeTableSample(StringInfo str, const RangeTableSample *node)
Definition: outfuncs.c:3380
static void _outConst(StringInfo str, const Const *node)
Definition: outfuncs.c:1085
int numCols
Definition: plannodes.h:880
static void _outGroupingSetsPath(StringInfo str, const GroupingSetsPath *node)
Definition: outfuncs.c:2009
SetOpStrategy
Definition: nodes.h:787
Oid * ordOperators
Definition: plannodes.h:808
Oid * sortOperators
Definition: plannodes.h:747
static void _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
Definition: outfuncs.c:2291
OnCommitAction
Definition: primnodes.h:47
static void _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
Definition: outfuncs.c:2588
static void _outPlanInfo(StringInfo str, const Plan *node)
Definition: outfuncs.c:290
JoinType
Definition: nodes.h:673
static void _outFieldSelect(StringInfo str, const FieldSelect *node)
Definition: outfuncs.c:1342
List * mergeclauses
Definition: plannodes.h:711
static void outChar(StringInfo str, char c)
Definition: outfuncs.c:151
static void _outJoinPlanInfo(StringInfo str, const Join *node)
Definition: outfuncs.c:323
static void _outBitmapOr(StringInfo str, const BitmapOr *node)
Definition: outfuncs.c:464
Oid * uniqOperators
Definition: plannodes.h:823
static void _outLockRows(StringInfo str, const LockRows *node)
Definition: outfuncs.c:948
static void _outIndexElem(StringInfo str, const IndexElem *node)
Definition: outfuncs.c:2845
int constlen
Definition: primnodes.h:195
static void _outBoolExpr(StringInfo str, const BoolExpr *node)
Definition: outfuncs.c:1271
static void _outWorkTableScan(StringInfo str, const WorkTableScan *node)
Definition: outfuncs.c:667
const struct CustomPathMethods * methods
Definition: relation.h:1163
static void _outNestLoopParam(StringInfo str, const NestLoopParam *node)
Definition: outfuncs.c:970
static void _outMergeAppendPath(StringInfo str, const MergeAppendPath *node)
Definition: outfuncs.c:1861
static void _outHashJoin(StringInfo str, const HashJoin *node)
Definition: outfuncs.c:762
SetOperation
Definition: parsenodes.h:1490
MinMaxOp
Definition: primnodes.h:1054
static void _outGroupingFunc(StringInfo str, const GroupingFunc *node)
Definition: outfuncs.c:1142
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
static void _outFuncExpr(StringInfo str, const FuncExpr *node)
Definition: outfuncs.c:1186
Definition: nodes.h:45
static void _outQuery(StringInfo str, const Query *node)
Definition: outfuncs.c:2859
#define ERROR
Definition: elog.h:43
static void _outSQLValueFunction(StringInfo str, const SQLValueFunction *node)
Definition: outfuncs.c:1521
static void _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
Definition: outfuncs.c:2500
static void _outTypeName(StringInfo str, const TypeName *node)
Definition: outfuncs.c:2810
static void _outLimitPath(StringInfo str, const LimitPath *node)
Definition: outfuncs.c:2108
static void _outPlannerInfo(StringInfo str, const PlannerInfo *node)
Definition: outfuncs.c:2190
#define lfirst_int(lc)
Definition: pg_list.h:107
static void _outBitmapAndPath(StringInfo str, const BitmapAndPath *node)
Definition: outfuncs.c:1783
Oid conpfeqop[INDEX_MAX_KEYS]
Definition: relation.h:699
BoolExprType boolop
Definition: primnodes.h:562
Oid * dupOperators
Definition: plannodes.h:883
static void _outPlanRowMark(StringInfo str, const PlanRowMark *node)
Definition: outfuncs.c:979
AttrNumber * dupColIdx
Definition: plannodes.h:287
static void _outGatherMerge(StringInfo str, const GatherMerge *node)
Definition: outfuncs.c:487
static struct @121 value
static void _outExtensibleNode(StringInfo str, const ExtensibleNode *node)
Definition: outfuncs.c:2564
RTEKind
Definition: parsenodes.h:928
RelOptInfo * parent
Definition: relation.h:954
static void _outNextValueExpr(StringInfo str, const NextValueExpr *node)
Definition: outfuncs.c:1614
Definition: nodes.h:76
static void _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
Definition: outfuncs.c:2535
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:157
char * c
static void _outSortBy(StringInfo str, const SortBy *node)
Definition: outfuncs.c:3330
static void _outCollateExpr(StringInfo str, const CollateExpr *node)
Definition: outfuncs.c:1416
static void _outLimit(StringInfo str, const Limit *node)
Definition: outfuncs.c:959
static void _outRangeVar(StringInfo str, const RangeVar *node)
Definition: outfuncs.c:1018
static void _outIndexOnlyScan(StringInfo str, const IndexOnlyScan *node)
Definition: outfuncs.c:558
static void _outMinMaxExpr(StringInfo str, const MinMaxExpr *node)
Definition: outfuncs.c:1508
#define WRITE_BOOL_FIELD(fldname)
Definition: outfuncs.c:80
Definition: nodes.h:142
static void _outSetOpPath(StringInfo str, const SetOpPath *node)
Definition: outfuncs.c:2045
static void _outArrayRef(StringInfo str, const ArrayRef *node)
Definition: outfuncs.c:1171
static void _outResultPath(StringInfo str, const ResultPath *node)
Definition: outfuncs.c:1873
union Value::ValUnion val
static void _outMergeAppend(StringInfo str, const MergeAppend *node)
Definition: outfuncs.c:400
static void _outConstraint(StringInfo str, const Constraint *node)
Definition: outfuncs.c:3420
static void _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
Definition: outfuncs.c:431
ScanDirection
Definition: sdir.h:22
static void _outHash(StringInfo str, const Hash *node)
Definition: outfuncs.c:910
const struct CustomScanMethods * methods
Definition: plannodes.h:633
static void _outUniquePath(StringInfo str, const UniquePath *node)
Definition: outfuncs.c:1893
static void _outGroupingSet(StringInfo str, const GroupingSet *node)
Definition: outfuncs.c:2951
Index * sortgrouprefs
Definition: relation.h:885
static void _outPath(StringInfo str, const Path *node)
Definition: outfuncs.c:1747
static void _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
Definition: outfuncs.c:2612
static void _outRecursiveUnionPath(StringInfo str, const RecursiveUnionPath *node)
Definition: outfuncs.c:2061
Relids relids
Definition: relation.h:525
int partNumCols
Definition: plannodes.h:803
int numCols
Definition: plannodes.h:761
static void _outPathKey(StringInfo str, const PathKey *node)
Definition: outfuncs.c:2399
const char * CustomName
Definition: extensible.h:107
static void _outValuesScan(StringInfo str, const ValuesScan *node)
Definition: outfuncs.c:636
#define WRITE_FLOAT_FIELD(fldname, format)
Definition: outfuncs.c:76
WCOKind
Definition: parsenodes.h:1105
#define lnext(lc)
Definition: pg_list.h:105
static void _outSetToDefault(StringInfo str, const SetToDefault *node)
Definition: outfuncs.c:1593
SQLValueFunctionOp
Definition: primnodes.h:1082
static void _outJoinPathInfo(StringInfo str, const JoinPath *node)
Definition: outfuncs.c:1735
static void _outIndexScan(StringInfo str, const IndexScan *node)
Definition: outfuncs.c:542
static void _outUpperUniquePath(StringInfo str, const UpperUniquePath *node)
Definition: outfuncs.c:1961
Definition: nodes.h:147
SubLinkType
Definition: primnodes.h:618
AttrNumber * uniqColIdx
Definition: plannodes.h:822
static void _outSeqScan(StringInfo str, const SeqScan *node)
Definition: outfuncs.c:524
void appendStringInfoChar(StringInfo str, char ch)
Definition: stringinfo.c:169
void initStringInfo(StringInfo str)
Definition: stringinfo.c:46
static void _outTypeCast(StringInfo str, const TypeCast *node)
Definition: outfuncs.c:2825
struct EquivalenceClass * eclass[INDEX_MAX_KEYS]
Definition: relation.h:706
Oid * sortOperators
Definition: plannodes.h:849
static void _outRangeFunction(StringInfo str, const RangeFunction *node)
Definition: outfuncs.c:3367
void outNode(StringInfo str, const void *obj)
Definition: outfuncs.c:3595
#define WARNING
Definition: elog.h:40
int numCols
Definition: plannodes.h:745
Definition: nodes.h:146
List * exprs
Definition: relation.h:884
static void _outSelectStmt(StringInfo str, const SelectStmt *node)
Definition: outfuncs.c:2693
static void _outResult(StringInfo str, const Result *node)
Definition: outfuncs.c:342
static void _outModifyTable(StringInfo str, const ModifyTable *node)
Definition: outfuncs.c:360
static void _outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
Definition: outfuncs.c:585
static void _outJoin(StringInfo str, const Join *node)
Definition: outfuncs.c:712
Definition: nodes.h:304
static void _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
Definition: outfuncs.c:2386
static void _outAggref(StringInfo str, const Aggref *node)
Definition: outfuncs.c:1118
void(* nodeOut)(struct StringInfoData *str, const struct ExtensibleNode *node)
Definition: extensible.h:68
LockClauseStrength
Definition: lockoptions.h:21
static void _outNestPath(StringInfo str, const NestPath *node)
Definition: outfuncs.c:2131
static void _outWindowClause(StringInfo str, const WindowClause *node)
Definition: outfuncs.c:2961
AttrNumber conkey[INDEX_MAX_KEYS]
Definition: relation.h:697
uintptr_t Datum
Definition: postgres.h:372
static void _outFromExpr(StringInfo str, const FromExpr *node)
Definition: outfuncs.c:1670
static void _outSortGroupClause(StringInfo str, const SortGroupClause *node)
Definition: outfuncs.c:2939
static void _outAgg(StringInfo str, const Agg *node)
Definition: outfuncs.c:772
static void _outDistinctExpr(StringInfo str, const DistinctExpr *node)
Definition: outfuncs.c:1228
static void _outCoerceViaIO(StringInfo str, const CoerceViaIO *node)
Definition: outfuncs.c:1378
static void _outIndexPath(StringInfo str, const IndexPath *node)
Definition: outfuncs.c:1755
Oid * mergeFamilies
Definition: plannodes.h:713
static void _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
Definition: outfuncs.c:1390
Oid * mergeCollations
Definition: plannodes.h:714
#define WRITE_CHAR_FIELD(fldname)
Definition: outfuncs.c:66
static void _outTableSampleClause(StringInfo str, const TableSampleClause *node)
Definition: outfuncs.c:3114
AttrNumber * partColIdx
Definition: plannodes.h:804
static void _outAlternativeSubPlan(StringInfo str, const AlternativeSubPlan *node)
Definition: outfuncs.c:1334
const char * extnodename
Definition: extensible.h:35
static void _outScanInfo(StringInfo str, const Scan *node)
Definition: outfuncs.c:312
static void _outPlannerGlobal(StringInfo str, const PlannerGlobal *node)
Definition: outfuncs.c:2164
Definition: nodes.h:82
static void _outIntoClause(StringInfo str, const IntoClause *node)
Definition: outfuncs.c:1055
static void _outNamedArgExpr(StringInfo str, const NamedArgExpr *node)
Definition: outfuncs.c:1202
ImportForeignSchemaType
Definition: parsenodes.h:2279
static void _outColumnRef(StringInfo str, const ColumnRef *node)
Definition: outfuncs.c:3247
static void _outAggPath(StringInfo str, const AggPath *node)
Definition: outfuncs.c:1972
static void _outSortPath(StringInfo str, const SortPath *node)
Definition: outfuncs.c:1939
RowCompareType
Definition: primnodes.h:1017
static void _outNotifyStmt(StringInfo str, const NotifyStmt *node)
Definition: outfuncs.c:2674
static void _outHashPath(StringInfo str, const HashPath *node)
Definition: outfuncs.c:2153
static void _outBooleanTest(StringInfo str, const BooleanTest *node)
Definition: outfuncs.c:1559
Oid * partOperators
Definition: plannodes.h:805
bool * mergeNullsFirst
Definition: plannodes.h:716
static void _outSubqueryScanPath(StringInfo str, const SubqueryScanPath *node)
Definition: outfuncs.c:1815
Oid conpfeqop[INDEX_MAX_KEYS]
Definition: rel.h:245
static void _outVar(StringInfo str, const Var *node)
Definition: outfuncs.c:1069
static void _outForeignKeyOptInfo(StringInfo str, const ForeignKeyOptInfo *node)
Definition: outfuncs.c:2316
static void _outList(StringInfo str, const List *node)
Definition: outfuncs.c:162
#define NULL
Definition: c.h:229
int * mergeStrategies
Definition: plannodes.h:715
SortByNulls
Definition: parsenodes.h:56
static void _outPlanInvalItem(StringInfo str, const PlanInvalItem *node)
Definition: outfuncs.c:994
#define lfirst(lc)
Definition: pg_list.h:106
const char * CustomName
Definition: extensible.h:90
static void _outGroupingSetData(StringInfo str, const GroupingSetData *node)
Definition: outfuncs.c:2000
static void _outResTarget(StringInfo str, const ResTarget *node)
Definition: outfuncs.c:3309
Definition: value.h:42
static void _outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
Definition: outfuncs.c:3320
#define WRITE_NODE_TYPE(nodelabel)
Definition: outfuncs.c:46
static void _outWithCheckOption(StringInfo str, const WithCheckOption *node)
Definition: outfuncs.c:2927
static void _outSubLink(StringInfo str, const SubLink *node)
Definition: outfuncs.c:1298
static void _outCaseWhen(StringInfo str, const CaseWhen *node)
Definition: outfuncs.c:1439
AttrNumber * sortColIdx
Definition: plannodes.h:266
XmlOptionType
Definition: primnodes.h:1133
static void _outProjectSetPath(StringInfo str, const ProjectSetPath *node)
Definition: outfuncs.c:1929
size_t Size
Definition: c.h:356
static void _outBitmapHeapPath(StringInfo str, const BitmapHeapPath *node)
Definition: outfuncs.c:1773
AggSplit
Definition: nodes.h:757
static void _outInferenceElem(StringInfo str, const InferenceElem *node)
Definition: outfuncs.c:1623
static int list_length(const List *l)
Definition: pg_list.h:89
RowMarkType
Definition: plannodes.h:950
Oid * dupOperators
Definition: plannodes.h:288
static const struct fns functions
Definition: regcomp.c:299
static void _outPlannedStmt(StringInfo str, const PlannedStmt *node)
Definition: outfuncs.c:258
static void _outPartitionSpec(StringInfo str, const PartitionSpec *node)
Definition: outfuncs.c:3559
static void _outCreateStatsStmt(StringInfo str, const CreateStatsStmt *node)
Definition: outfuncs.c:2662
static void _outAExpr(StringInfo str, const A_Expr *node)
Definition: outfuncs.c:3124
static void _outAlias(StringInfo str, const Alias *node)
Definition: outfuncs.c:1009
static void _outSubPlan(StringInfo str, const SubPlan *node)
Definition: outfuncs.c:1311
static void _outCollateClause(StringInfo str, const CollateClause *node)
Definition: outfuncs.c:2835
static void _outFieldStore(StringInfo str, const FieldStore *node)
Definition: outfuncs.c:1354
void outBitmapset(StringInfo str, const Bitmapset *bms)
Definition: outfuncs.c:205
static void _outRangeTableFuncCol(StringInfo str, const RangeTableFuncCol *node)
Definition: outfuncs.c:3406
const char * name
Definition: encode.c:521
static void _outAConst(StringInfo str, const A_Const *node)
Definition: outfuncs.c:3265
#define nodeTag(nodeptr)
Definition: nodes.h:514
Definition: nodes.h:44
static void _outCoerceToDomainValue(StringInfo str, const CoerceToDomainValue *node)
Definition: outfuncs.c:1582
bool * nullsFirst
Definition: plannodes.h:269
static void _outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
Definition: outfuncs.c:2623
#define DatumGetPointer(X)
Definition: postgres.h:555
Definition: nodes.h:70
static void _outCoalesceExpr(StringInfo str, const CoalesceExpr *node)
Definition: outfuncs.c:1497
AttrNumber * sortColIdx
Definition: plannodes.h:746
RTEKind rtekind
Definition: parsenodes.h:944
static void _outPathInfo(StringInfo str, const Path *node)
Definition: outfuncs.c:1710
Definition: nodes.h:286
#define WRITE_STRING_FIELD(fldname)
Definition: outfuncs.c:85
char * bmsToString(const Bitmapset *bms)
Definition: outfuncs.c:4267
Definition: nodes.h:83
Definition: nodes.h:283
static void _outTriggerTransition(StringInfo str, const TriggerTransition *node)
Definition: outfuncs.c:2777
NodeTag type
Definition: pg_list.h:47
AggStrategy
Definition: nodes.h:735
static void _outMaterialPath(StringInfo str, const MaterialPath *node)
Definition: outfuncs.c:1883
static void _outColumnDef(StringInfo str, const ColumnDef *node)
Definition: outfuncs.c:2787
Oid * grpOperators
Definition: plannodes.h:787
static void _outGroup(StringInfo str, const Group *node)
Definition: outfuncs.c:834
int xmloption
Definition: xml.c:97
SetOpCmd
Definition: nodes.h:779
static void _outXmlSerialize(StringInfo str, const XmlSerialize *node)
Definition: outfuncs.c:2766
Definition: nodes.h:80
char * str
Definition: value.h:48
AttrNumber confkey[INDEX_MAX_KEYS]
Definition: rel.h:244
int i
AttrNumber * grpColIdx
Definition: plannodes.h:762
static void _outTidPath(StringInfo str, const TidPath *node)
Definition: outfuncs.c:1805
static void _outConvertRowtypeExpr(StringInfo str, const ConvertRowtypeExpr *node)
Definition: outfuncs.c:1405
static void _outGatherPath(StringInfo str, const GatherPath *node)
Definition: outfuncs.c:1906
static void _outBitmapOrPath(StringInfo str, const BitmapOrPath *node)
Definition: outfuncs.c:1794
static void _outBitmapIndexScan(StringInfo str, const BitmapIndexScan *node)
Definition: outfuncs.c:572
char * nodeToString(const void *obj)
Definition: outfuncs.c:4252
ConstrType contype
Definition: parsenodes.h:2073