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