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