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