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