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