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