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(rootResultRelations);
257  WRITE_NODE_FIELD(subplans);
258  WRITE_BITMAPSET_FIELD(rewindPlanIDs);
259  WRITE_NODE_FIELD(rowMarks);
260  WRITE_NODE_FIELD(relationOids);
261  WRITE_NODE_FIELD(invalItems);
262  WRITE_INT_FIELD(nParamExec);
263  WRITE_NODE_FIELD(utilityStmt);
264  WRITE_LOCATION_FIELD(stmt_location);
265  WRITE_LOCATION_FIELD(stmt_len);
266 }
267 
268 /*
269  * print the basic stuff of all nodes that inherit from Plan
270  */
271 static void
272 _outPlanInfo(StringInfo str, const Plan *node)
273 {
274  WRITE_FLOAT_FIELD(startup_cost, "%.2f");
275  WRITE_FLOAT_FIELD(total_cost, "%.2f");
276  WRITE_FLOAT_FIELD(plan_rows, "%.0f");
277  WRITE_INT_FIELD(plan_width);
278  WRITE_BOOL_FIELD(parallel_aware);
279  WRITE_BOOL_FIELD(parallel_safe);
280  WRITE_INT_FIELD(plan_node_id);
281  WRITE_NODE_FIELD(targetlist);
282  WRITE_NODE_FIELD(qual);
283  WRITE_NODE_FIELD(lefttree);
284  WRITE_NODE_FIELD(righttree);
285  WRITE_NODE_FIELD(initPlan);
286  WRITE_BITMAPSET_FIELD(extParam);
287  WRITE_BITMAPSET_FIELD(allParam);
288 }
289 
290 /*
291  * print the basic stuff of all nodes that inherit from Scan
292  */
293 static void
294 _outScanInfo(StringInfo str, const Scan *node)
295 {
296  _outPlanInfo(str, (const Plan *) node);
297 
298  WRITE_UINT_FIELD(scanrelid);
299 }
300 
301 /*
302  * print the basic stuff of all nodes that inherit from Join
303  */
304 static void
306 {
307  _outPlanInfo(str, (const Plan *) node);
308 
309  WRITE_ENUM_FIELD(jointype, JoinType);
310  WRITE_BOOL_FIELD(inner_unique);
311  WRITE_NODE_FIELD(joinqual);
312 }
313 
314 
315 static void
316 _outPlan(StringInfo str, const Plan *node)
317 {
318  WRITE_NODE_TYPE("PLAN");
319 
320  _outPlanInfo(str, (const Plan *) node);
321 }
322 
323 static void
324 _outResult(StringInfo str, const Result *node)
325 {
326  WRITE_NODE_TYPE("RESULT");
327 
328  _outPlanInfo(str, (const Plan *) node);
329 
330  WRITE_NODE_FIELD(resconstantqual);
331 }
332 
333 static void
335 {
336  WRITE_NODE_TYPE("PROJECTSET");
337 
338  _outPlanInfo(str, (const Plan *) node);
339 }
340 
341 static void
343 {
344  WRITE_NODE_TYPE("MODIFYTABLE");
345 
346  _outPlanInfo(str, (const Plan *) node);
347 
348  WRITE_ENUM_FIELD(operation, CmdType);
349  WRITE_BOOL_FIELD(canSetTag);
350  WRITE_UINT_FIELD(nominalRelation);
351  WRITE_NODE_FIELD(partitioned_rels);
352  WRITE_NODE_FIELD(resultRelations);
353  WRITE_INT_FIELD(resultRelIndex);
354  WRITE_INT_FIELD(rootResultRelIndex);
355  WRITE_NODE_FIELD(plans);
356  WRITE_NODE_FIELD(withCheckOptionLists);
357  WRITE_NODE_FIELD(returningLists);
358  WRITE_NODE_FIELD(fdwPrivLists);
359  WRITE_BITMAPSET_FIELD(fdwDirectModifyPlans);
360  WRITE_NODE_FIELD(rowMarks);
361  WRITE_INT_FIELD(epqParam);
362  WRITE_ENUM_FIELD(onConflictAction, OnConflictAction);
363  WRITE_NODE_FIELD(arbiterIndexes);
364  WRITE_NODE_FIELD(onConflictSet);
365  WRITE_NODE_FIELD(onConflictWhere);
366  WRITE_UINT_FIELD(exclRelRTI);
367  WRITE_NODE_FIELD(exclRelTlist);
368 }
369 
370 static void
371 _outAppend(StringInfo str, const Append *node)
372 {
373  WRITE_NODE_TYPE("APPEND");
374 
375  _outPlanInfo(str, (const Plan *) node);
376 
377  WRITE_NODE_FIELD(partitioned_rels);
378  WRITE_NODE_FIELD(appendplans);
379 }
380 
381 static void
383 {
384  int i;
385 
386  WRITE_NODE_TYPE("MERGEAPPEND");
387 
388  _outPlanInfo(str, (const Plan *) node);
389 
390  WRITE_NODE_FIELD(partitioned_rels);
391  WRITE_NODE_FIELD(mergeplans);
392 
393  WRITE_INT_FIELD(numCols);
394 
395  appendStringInfoString(str, " :sortColIdx");
396  for (i = 0; i < node->numCols; i++)
397  appendStringInfo(str, " %d", node->sortColIdx[i]);
398 
399  appendStringInfoString(str, " :sortOperators");
400  for (i = 0; i < node->numCols; i++)
401  appendStringInfo(str, " %u", node->sortOperators[i]);
402 
403  appendStringInfoString(str, " :collations");
404  for (i = 0; i < node->numCols; i++)
405  appendStringInfo(str, " %u", node->collations[i]);
406 
407  appendStringInfoString(str, " :nullsFirst");
408  for (i = 0; i < node->numCols; i++)
409  appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
410 }
411 
412 static void
414 {
415  int i;
416 
417  WRITE_NODE_TYPE("RECURSIVEUNION");
418 
419  _outPlanInfo(str, (const Plan *) node);
420 
421  WRITE_INT_FIELD(wtParam);
422  WRITE_INT_FIELD(numCols);
423 
424  appendStringInfoString(str, " :dupColIdx");
425  for (i = 0; i < node->numCols; i++)
426  appendStringInfo(str, " %d", node->dupColIdx[i]);
427 
428  appendStringInfoString(str, " :dupOperators");
429  for (i = 0; i < node->numCols; i++)
430  appendStringInfo(str, " %u", node->dupOperators[i]);
431 
432  WRITE_LONG_FIELD(numGroups);
433 }
434 
435 static void
437 {
438  WRITE_NODE_TYPE("BITMAPAND");
439 
440  _outPlanInfo(str, (const Plan *) node);
441 
442  WRITE_NODE_FIELD(bitmapplans);
443 }
444 
445 static void
447 {
448  WRITE_NODE_TYPE("BITMAPOR");
449 
450  _outPlanInfo(str, (const Plan *) node);
451 
452  WRITE_BOOL_FIELD(isshared);
453  WRITE_NODE_FIELD(bitmapplans);
454 }
455 
456 static void
457 _outGather(StringInfo str, const Gather *node)
458 {
459  WRITE_NODE_TYPE("GATHER");
460 
461  _outPlanInfo(str, (const Plan *) node);
462 
463  WRITE_INT_FIELD(num_workers);
464  WRITE_BOOL_FIELD(single_copy);
465  WRITE_BOOL_FIELD(invisible);
466 }
467 
468 static void
470 {
471  int i;
472 
473  WRITE_NODE_TYPE("GATHERMERGE");
474 
475  _outPlanInfo(str, (const Plan *) node);
476 
477  WRITE_INT_FIELD(num_workers);
478  WRITE_INT_FIELD(numCols);
479 
480  appendStringInfoString(str, " :sortColIdx");
481  for (i = 0; i < node->numCols; i++)
482  appendStringInfo(str, " %d", node->sortColIdx[i]);
483 
484  appendStringInfoString(str, " :sortOperators");
485  for (i = 0; i < node->numCols; i++)
486  appendStringInfo(str, " %u", node->sortOperators[i]);
487 
488  appendStringInfoString(str, " :collations");
489  for (i = 0; i < node->numCols; i++)
490  appendStringInfo(str, " %u", node->collations[i]);
491 
492  appendStringInfoString(str, " :nullsFirst");
493  for (i = 0; i < node->numCols; i++)
494  appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
495 }
496 
497 static void
498 _outScan(StringInfo str, const Scan *node)
499 {
500  WRITE_NODE_TYPE("SCAN");
501 
502  _outScanInfo(str, node);
503 }
504 
505 static void
506 _outSeqScan(StringInfo str, const SeqScan *node)
507 {
508  WRITE_NODE_TYPE("SEQSCAN");
509 
510  _outScanInfo(str, (const Scan *) node);
511 }
512 
513 static void
515 {
516  WRITE_NODE_TYPE("SAMPLESCAN");
517 
518  _outScanInfo(str, (const Scan *) node);
519 
520  WRITE_NODE_FIELD(tablesample);
521 }
522 
523 static void
525 {
526  WRITE_NODE_TYPE("INDEXSCAN");
527 
528  _outScanInfo(str, (const Scan *) node);
529 
530  WRITE_OID_FIELD(indexid);
531  WRITE_NODE_FIELD(indexqual);
532  WRITE_NODE_FIELD(indexqualorig);
533  WRITE_NODE_FIELD(indexorderby);
534  WRITE_NODE_FIELD(indexorderbyorig);
535  WRITE_NODE_FIELD(indexorderbyops);
536  WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
537 }
538 
539 static void
541 {
542  WRITE_NODE_TYPE("INDEXONLYSCAN");
543 
544  _outScanInfo(str, (const Scan *) node);
545 
546  WRITE_OID_FIELD(indexid);
547  WRITE_NODE_FIELD(indexqual);
548  WRITE_NODE_FIELD(indexorderby);
549  WRITE_NODE_FIELD(indextlist);
550  WRITE_ENUM_FIELD(indexorderdir, ScanDirection);
551 }
552 
553 static void
555 {
556  WRITE_NODE_TYPE("BITMAPINDEXSCAN");
557 
558  _outScanInfo(str, (const Scan *) node);
559 
560  WRITE_OID_FIELD(indexid);
561  WRITE_BOOL_FIELD(isshared);
562  WRITE_NODE_FIELD(indexqual);
563  WRITE_NODE_FIELD(indexqualorig);
564 }
565 
566 static void
568 {
569  WRITE_NODE_TYPE("BITMAPHEAPSCAN");
570 
571  _outScanInfo(str, (const Scan *) node);
572 
573  WRITE_NODE_FIELD(bitmapqualorig);
574 }
575 
576 static void
577 _outTidScan(StringInfo str, const TidScan *node)
578 {
579  WRITE_NODE_TYPE("TIDSCAN");
580 
581  _outScanInfo(str, (const Scan *) node);
582 
583  WRITE_NODE_FIELD(tidquals);
584 }
585 
586 static void
588 {
589  WRITE_NODE_TYPE("SUBQUERYSCAN");
590 
591  _outScanInfo(str, (const Scan *) node);
592 
593  WRITE_NODE_FIELD(subplan);
594 }
595 
596 static void
598 {
599  WRITE_NODE_TYPE("FUNCTIONSCAN");
600 
601  _outScanInfo(str, (const Scan *) node);
602 
604  WRITE_BOOL_FIELD(funcordinality);
605 }
606 
607 static void
609 {
610  WRITE_NODE_TYPE("TABLEFUNCSCAN");
611 
612  _outScanInfo(str, (const Scan *) node);
613 
614  WRITE_NODE_FIELD(tablefunc);
615 }
616 
617 static void
619 {
620  WRITE_NODE_TYPE("VALUESSCAN");
621 
622  _outScanInfo(str, (const Scan *) node);
623 
624  WRITE_NODE_FIELD(values_lists);
625 }
626 
627 static void
628 _outCteScan(StringInfo str, const CteScan *node)
629 {
630  WRITE_NODE_TYPE("CTESCAN");
631 
632  _outScanInfo(str, (const Scan *) node);
633 
634  WRITE_INT_FIELD(ctePlanId);
635  WRITE_INT_FIELD(cteParam);
636 }
637 
638 static void
640 {
641  WRITE_NODE_TYPE("NAMEDTUPLESTORESCAN");
642 
643  _outScanInfo(str, (const Scan *) node);
644 
645  WRITE_STRING_FIELD(enrname);
646 }
647 
648 static void
650 {
651  WRITE_NODE_TYPE("WORKTABLESCAN");
652 
653  _outScanInfo(str, (const Scan *) node);
654 
655  WRITE_INT_FIELD(wtParam);
656 }
657 
658 static void
660 {
661  WRITE_NODE_TYPE("FOREIGNSCAN");
662 
663  _outScanInfo(str, (const Scan *) node);
664 
665  WRITE_ENUM_FIELD(operation, CmdType);
666  WRITE_OID_FIELD(fs_server);
667  WRITE_NODE_FIELD(fdw_exprs);
668  WRITE_NODE_FIELD(fdw_private);
669  WRITE_NODE_FIELD(fdw_scan_tlist);
670  WRITE_NODE_FIELD(fdw_recheck_quals);
671  WRITE_BITMAPSET_FIELD(fs_relids);
672  WRITE_BOOL_FIELD(fsSystemCol);
673 }
674 
675 static void
677 {
678  WRITE_NODE_TYPE("CUSTOMSCAN");
679 
680  _outScanInfo(str, (const Scan *) node);
681 
682  WRITE_UINT_FIELD(flags);
683  WRITE_NODE_FIELD(custom_plans);
684  WRITE_NODE_FIELD(custom_exprs);
685  WRITE_NODE_FIELD(custom_private);
686  WRITE_NODE_FIELD(custom_scan_tlist);
687  WRITE_BITMAPSET_FIELD(custom_relids);
688  /* CustomName is a key to lookup CustomScanMethods */
689  appendStringInfoString(str, " :methods ");
690  outToken(str, node->methods->CustomName);
691 }
692 
693 static void
694 _outJoin(StringInfo str, const Join *node)
695 {
696  WRITE_NODE_TYPE("JOIN");
697 
698  _outJoinPlanInfo(str, (const Join *) node);
699 }
700 
701 static void
703 {
704  WRITE_NODE_TYPE("NESTLOOP");
705 
706  _outJoinPlanInfo(str, (const Join *) node);
707 
708  WRITE_NODE_FIELD(nestParams);
709 }
710 
711 static void
713 {
714  int numCols;
715  int i;
716 
717  WRITE_NODE_TYPE("MERGEJOIN");
718 
719  _outJoinPlanInfo(str, (const Join *) node);
720 
721  WRITE_BOOL_FIELD(skip_mark_restore);
722  WRITE_NODE_FIELD(mergeclauses);
723 
724  numCols = list_length(node->mergeclauses);
725 
726  appendStringInfoString(str, " :mergeFamilies");
727  for (i = 0; i < numCols; i++)
728  appendStringInfo(str, " %u", node->mergeFamilies[i]);
729 
730  appendStringInfoString(str, " :mergeCollations");
731  for (i = 0; i < numCols; i++)
732  appendStringInfo(str, " %u", node->mergeCollations[i]);
733 
734  appendStringInfoString(str, " :mergeStrategies");
735  for (i = 0; i < numCols; i++)
736  appendStringInfo(str, " %d", node->mergeStrategies[i]);
737 
738  appendStringInfoString(str, " :mergeNullsFirst");
739  for (i = 0; i < numCols; i++)
740  appendStringInfo(str, " %s", booltostr(node->mergeNullsFirst[i]));
741 }
742 
743 static void
745 {
746  WRITE_NODE_TYPE("HASHJOIN");
747 
748  _outJoinPlanInfo(str, (const Join *) node);
749 
750  WRITE_NODE_FIELD(hashclauses);
751 }
752 
753 static void
754 _outAgg(StringInfo str, const Agg *node)
755 {
756  int i;
757 
758  WRITE_NODE_TYPE("AGG");
759 
760  _outPlanInfo(str, (const Plan *) node);
761 
762  WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
763  WRITE_ENUM_FIELD(aggsplit, AggSplit);
764  WRITE_INT_FIELD(numCols);
765 
766  appendStringInfoString(str, " :grpColIdx");
767  for (i = 0; i < node->numCols; i++)
768  appendStringInfo(str, " %d", node->grpColIdx[i]);
769 
770  appendStringInfoString(str, " :grpOperators");
771  for (i = 0; i < node->numCols; i++)
772  appendStringInfo(str, " %u", node->grpOperators[i]);
773 
774  WRITE_LONG_FIELD(numGroups);
775  WRITE_BITMAPSET_FIELD(aggParams);
776  WRITE_NODE_FIELD(groupingSets);
777  WRITE_NODE_FIELD(chain);
778 }
779 
780 static void
782 {
783  int i;
784 
785  WRITE_NODE_TYPE("WINDOWAGG");
786 
787  _outPlanInfo(str, (const Plan *) node);
788 
789  WRITE_UINT_FIELD(winref);
790  WRITE_INT_FIELD(partNumCols);
791 
792  appendStringInfoString(str, " :partColIdx");
793  for (i = 0; i < node->partNumCols; i++)
794  appendStringInfo(str, " %d", node->partColIdx[i]);
795 
796  appendStringInfoString(str, " :partOperations");
797  for (i = 0; i < node->partNumCols; i++)
798  appendStringInfo(str, " %u", node->partOperators[i]);
799 
800  WRITE_INT_FIELD(ordNumCols);
801 
802  appendStringInfoString(str, " :ordColIdx");
803  for (i = 0; i < node->ordNumCols; i++)
804  appendStringInfo(str, " %d", node->ordColIdx[i]);
805 
806  appendStringInfoString(str, " :ordOperations");
807  for (i = 0; i < node->ordNumCols; i++)
808  appendStringInfo(str, " %u", node->ordOperators[i]);
809 
810  WRITE_INT_FIELD(frameOptions);
811  WRITE_NODE_FIELD(startOffset);
812  WRITE_NODE_FIELD(endOffset);
813 }
814 
815 static void
816 _outGroup(StringInfo str, const Group *node)
817 {
818  int i;
819 
820  WRITE_NODE_TYPE("GROUP");
821 
822  _outPlanInfo(str, (const Plan *) node);
823 
824  WRITE_INT_FIELD(numCols);
825 
826  appendStringInfoString(str, " :grpColIdx");
827  for (i = 0; i < node->numCols; i++)
828  appendStringInfo(str, " %d", node->grpColIdx[i]);
829 
830  appendStringInfoString(str, " :grpOperators");
831  for (i = 0; i < node->numCols; i++)
832  appendStringInfo(str, " %u", node->grpOperators[i]);
833 }
834 
835 static void
837 {
838  WRITE_NODE_TYPE("MATERIAL");
839 
840  _outPlanInfo(str, (const Plan *) node);
841 }
842 
843 static void
844 _outSort(StringInfo str, const Sort *node)
845 {
846  int i;
847 
848  WRITE_NODE_TYPE("SORT");
849 
850  _outPlanInfo(str, (const Plan *) node);
851 
852  WRITE_INT_FIELD(numCols);
853 
854  appendStringInfoString(str, " :sortColIdx");
855  for (i = 0; i < node->numCols; i++)
856  appendStringInfo(str, " %d", node->sortColIdx[i]);
857 
858  appendStringInfoString(str, " :sortOperators");
859  for (i = 0; i < node->numCols; i++)
860  appendStringInfo(str, " %u", node->sortOperators[i]);
861 
862  appendStringInfoString(str, " :collations");
863  for (i = 0; i < node->numCols; i++)
864  appendStringInfo(str, " %u", node->collations[i]);
865 
866  appendStringInfoString(str, " :nullsFirst");
867  for (i = 0; i < node->numCols; i++)
868  appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
869 }
870 
871 static void
872 _outUnique(StringInfo str, const Unique *node)
873 {
874  int i;
875 
876  WRITE_NODE_TYPE("UNIQUE");
877 
878  _outPlanInfo(str, (const Plan *) node);
879 
880  WRITE_INT_FIELD(numCols);
881 
882  appendStringInfoString(str, " :uniqColIdx");
883  for (i = 0; i < node->numCols; i++)
884  appendStringInfo(str, " %d", node->uniqColIdx[i]);
885 
886  appendStringInfoString(str, " :uniqOperators");
887  for (i = 0; i < node->numCols; i++)
888  appendStringInfo(str, " %u", node->uniqOperators[i]);
889 }
890 
891 static void
892 _outHash(StringInfo str, const Hash *node)
893 {
894  WRITE_NODE_TYPE("HASH");
895 
896  _outPlanInfo(str, (const Plan *) node);
897 
898  WRITE_OID_FIELD(skewTable);
899  WRITE_INT_FIELD(skewColumn);
900  WRITE_BOOL_FIELD(skewInherit);
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_uris);
1022  WRITE_NODE_FIELD(ns_names);
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(rootResultRelations);
2149  WRITE_NODE_FIELD(relationOids);
2150  WRITE_NODE_FIELD(invalItems);
2151  WRITE_INT_FIELD(nParamExec);
2152  WRITE_UINT_FIELD(lastPHId);
2153  WRITE_UINT_FIELD(lastRowMarkId);
2154  WRITE_INT_FIELD(lastPlanNodeId);
2155  WRITE_BOOL_FIELD(transientPlan);
2156  WRITE_BOOL_FIELD(dependsOnRole);
2157  WRITE_BOOL_FIELD(parallelModeOK);
2158  WRITE_BOOL_FIELD(parallelModeNeeded);
2159  WRITE_CHAR_FIELD(maxParallelHazard);
2160 }
2161 
2162 static void
2164 {
2165  WRITE_NODE_TYPE("PLANNERINFO");
2166 
2167  /* NB: this isn't a complete set of fields */
2169  WRITE_NODE_FIELD(glob);
2170  WRITE_UINT_FIELD(query_level);
2171  WRITE_NODE_FIELD(plan_params);
2172  WRITE_BITMAPSET_FIELD(outer_params);
2173  WRITE_BITMAPSET_FIELD(all_baserels);
2174  WRITE_BITMAPSET_FIELD(nullable_baserels);
2175  WRITE_NODE_FIELD(join_rel_list);
2176  WRITE_INT_FIELD(join_cur_level);
2177  WRITE_NODE_FIELD(init_plans);
2178  WRITE_NODE_FIELD(cte_plan_ids);
2179  WRITE_NODE_FIELD(multiexpr_params);
2180  WRITE_NODE_FIELD(eq_classes);
2181  WRITE_NODE_FIELD(canon_pathkeys);
2182  WRITE_NODE_FIELD(left_join_clauses);
2183  WRITE_NODE_FIELD(right_join_clauses);
2184  WRITE_NODE_FIELD(full_join_clauses);
2185  WRITE_NODE_FIELD(join_info_list);
2186  WRITE_NODE_FIELD(append_rel_list);
2187  WRITE_NODE_FIELD(pcinfo_list);
2188  WRITE_NODE_FIELD(rowMarks);
2189  WRITE_NODE_FIELD(placeholder_list);
2190  WRITE_NODE_FIELD(fkey_list);
2191  WRITE_NODE_FIELD(query_pathkeys);
2192  WRITE_NODE_FIELD(group_pathkeys);
2193  WRITE_NODE_FIELD(window_pathkeys);
2194  WRITE_NODE_FIELD(distinct_pathkeys);
2195  WRITE_NODE_FIELD(sort_pathkeys);
2196  WRITE_NODE_FIELD(processed_tlist);
2197  WRITE_NODE_FIELD(minmax_aggs);
2198  WRITE_FLOAT_FIELD(total_table_pages, "%.0f");
2199  WRITE_FLOAT_FIELD(tuple_fraction, "%.4f");
2200  WRITE_FLOAT_FIELD(limit_tuples, "%.0f");
2201  WRITE_UINT_FIELD(qual_security_level);
2202  WRITE_BOOL_FIELD(hasInheritedTarget);
2203  WRITE_BOOL_FIELD(hasJoinRTEs);
2204  WRITE_BOOL_FIELD(hasLateralRTEs);
2205  WRITE_BOOL_FIELD(hasDeletedRTEs);
2206  WRITE_BOOL_FIELD(hasHavingQual);
2207  WRITE_BOOL_FIELD(hasPseudoConstantQuals);
2208  WRITE_BOOL_FIELD(hasRecursion);
2209  WRITE_INT_FIELD(wt_param_id);
2210  WRITE_BITMAPSET_FIELD(curOuterRels);
2211  WRITE_NODE_FIELD(curOuterParams);
2212 }
2213 
2214 static void
2216 {
2217  WRITE_NODE_TYPE("RELOPTINFO");
2218 
2219  /* NB: this isn't a complete set of fields */
2220  WRITE_ENUM_FIELD(reloptkind, RelOptKind);
2221  WRITE_BITMAPSET_FIELD(relids);
2222  WRITE_FLOAT_FIELD(rows, "%.0f");
2223  WRITE_BOOL_FIELD(consider_startup);
2224  WRITE_BOOL_FIELD(consider_param_startup);
2225  WRITE_BOOL_FIELD(consider_parallel);
2226  WRITE_NODE_FIELD(reltarget);
2227  WRITE_NODE_FIELD(pathlist);
2228  WRITE_NODE_FIELD(ppilist);
2229  WRITE_NODE_FIELD(partial_pathlist);
2230  WRITE_NODE_FIELD(cheapest_startup_path);
2231  WRITE_NODE_FIELD(cheapest_total_path);
2232  WRITE_NODE_FIELD(cheapest_unique_path);
2233  WRITE_NODE_FIELD(cheapest_parameterized_paths);
2234  WRITE_BITMAPSET_FIELD(direct_lateral_relids);
2235  WRITE_BITMAPSET_FIELD(lateral_relids);
2236  WRITE_UINT_FIELD(relid);
2237  WRITE_OID_FIELD(reltablespace);
2238  WRITE_ENUM_FIELD(rtekind, RTEKind);
2239  WRITE_INT_FIELD(min_attr);
2240  WRITE_INT_FIELD(max_attr);
2241  WRITE_NODE_FIELD(lateral_vars);
2242  WRITE_BITMAPSET_FIELD(lateral_referencers);
2243  WRITE_NODE_FIELD(indexlist);
2244  WRITE_NODE_FIELD(statlist);
2245  WRITE_UINT_FIELD(pages);
2246  WRITE_FLOAT_FIELD(tuples, "%.0f");
2247  WRITE_FLOAT_FIELD(allvisfrac, "%.6f");
2248  WRITE_NODE_FIELD(subroot);
2249  WRITE_NODE_FIELD(subplan_params);
2250  WRITE_INT_FIELD(rel_parallel_workers);
2251  WRITE_OID_FIELD(serverid);
2252  WRITE_OID_FIELD(userid);
2253  WRITE_BOOL_FIELD(useridiscurrent);
2254  /* we don't try to print fdwroutine or fdw_private */
2255  /* can't print unique_for_rels/non_unique_for_rels; BMSes aren't Nodes */
2256  WRITE_NODE_FIELD(baserestrictinfo);
2257  WRITE_UINT_FIELD(baserestrict_min_security);
2258  WRITE_NODE_FIELD(joininfo);
2259  WRITE_BOOL_FIELD(has_eclass_joins);
2260  WRITE_BITMAPSET_FIELD(top_parent_relids);
2261 }
2262 
2263 static void
2265 {
2266  WRITE_NODE_TYPE("INDEXOPTINFO");
2267 
2268  /* NB: this isn't a complete set of fields */
2269  WRITE_OID_FIELD(indexoid);
2270  /* Do NOT print rel field, else infinite recursion */
2271  WRITE_UINT_FIELD(pages);
2272  WRITE_FLOAT_FIELD(tuples, "%.0f");
2273  WRITE_INT_FIELD(tree_height);
2274  WRITE_INT_FIELD(ncolumns);
2275  /* array fields aren't really worth the trouble to print */
2276  WRITE_OID_FIELD(relam);
2277  /* indexprs is redundant since we print indextlist */
2278  WRITE_NODE_FIELD(indpred);
2279  WRITE_NODE_FIELD(indextlist);
2280  WRITE_NODE_FIELD(indrestrictinfo);
2281  WRITE_BOOL_FIELD(predOK);
2282  WRITE_BOOL_FIELD(unique);
2283  WRITE_BOOL_FIELD(immediate);
2284  WRITE_BOOL_FIELD(hypothetical);
2285  /* we don't bother with fields copied from the index AM's API struct */
2286 }
2287 
2288 static void
2290 {
2291  int i;
2292 
2293  WRITE_NODE_TYPE("FOREIGNKEYOPTINFO");
2294 
2295  WRITE_UINT_FIELD(con_relid);
2296  WRITE_UINT_FIELD(ref_relid);
2297  WRITE_INT_FIELD(nkeys);
2298  appendStringInfoString(str, " :conkey");
2299  for (i = 0; i < node->nkeys; i++)
2300  appendStringInfo(str, " %d", node->conkey[i]);
2301  appendStringInfoString(str, " :confkey");
2302  for (i = 0; i < node->nkeys; i++)
2303  appendStringInfo(str, " %d", node->confkey[i]);
2304  appendStringInfoString(str, " :conpfeqop");
2305  for (i = 0; i < node->nkeys; i++)
2306  appendStringInfo(str, " %u", node->conpfeqop[i]);
2307  WRITE_INT_FIELD(nmatched_ec);
2308  WRITE_INT_FIELD(nmatched_rcols);
2309  WRITE_INT_FIELD(nmatched_ri);
2310  /* for compactness, just print the number of matches per column: */
2311  appendStringInfoString(str, " :eclass");
2312  for (i = 0; i < node->nkeys; i++)
2313  appendStringInfo(str, " %d", (node->eclass[i] != NULL));
2314  appendStringInfoString(str, " :rinfos");
2315  for (i = 0; i < node->nkeys; i++)
2316  appendStringInfo(str, " %d", list_length(node->rinfos[i]));
2317 }
2318 
2319 static void
2321 {
2322  WRITE_NODE_TYPE("STATISTICEXTINFO");
2323 
2324  /* NB: this isn't a complete set of fields */
2325  WRITE_OID_FIELD(statOid);
2326  /* don't write rel, leads to infinite recursion in plan tree dump */
2327  WRITE_CHAR_FIELD(kind);
2328  WRITE_BITMAPSET_FIELD(keys);
2329 }
2330 
2331 static void
2333 {
2334  /*
2335  * To simplify reading, we just chase up to the topmost merged EC and
2336  * print that, without bothering to show the merge-ees separately.
2337  */
2338  while (node->ec_merged)
2339  node = node->ec_merged;
2340 
2341  WRITE_NODE_TYPE("EQUIVALENCECLASS");
2342 
2343  WRITE_NODE_FIELD(ec_opfamilies);
2344  WRITE_OID_FIELD(ec_collation);
2345  WRITE_NODE_FIELD(ec_members);
2346  WRITE_NODE_FIELD(ec_sources);
2347  WRITE_NODE_FIELD(ec_derives);
2348  WRITE_BITMAPSET_FIELD(ec_relids);
2349  WRITE_BOOL_FIELD(ec_has_const);
2350  WRITE_BOOL_FIELD(ec_has_volatile);
2351  WRITE_BOOL_FIELD(ec_below_outer_join);
2352  WRITE_BOOL_FIELD(ec_broken);
2353  WRITE_UINT_FIELD(ec_sortref);
2354  WRITE_UINT_FIELD(ec_min_security);
2355  WRITE_UINT_FIELD(ec_max_security);
2356 }
2357 
2358 static void
2360 {
2361  WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
2362 
2363  WRITE_NODE_FIELD(em_expr);
2364  WRITE_BITMAPSET_FIELD(em_relids);
2365  WRITE_BITMAPSET_FIELD(em_nullable_relids);
2366  WRITE_BOOL_FIELD(em_is_const);
2367  WRITE_BOOL_FIELD(em_is_child);
2368  WRITE_OID_FIELD(em_datatype);
2369 }
2370 
2371 static void
2372 _outPathKey(StringInfo str, const PathKey *node)
2373 {
2374  WRITE_NODE_TYPE("PATHKEY");
2375 
2376  WRITE_NODE_FIELD(pk_eclass);
2377  WRITE_OID_FIELD(pk_opfamily);
2378  WRITE_INT_FIELD(pk_strategy);
2379  WRITE_BOOL_FIELD(pk_nulls_first);
2380 }
2381 
2382 static void
2384 {
2385  WRITE_NODE_TYPE("PATHTARGET");
2386 
2387  WRITE_NODE_FIELD(exprs);
2388  if (node->sortgrouprefs)
2389  {
2390  int i;
2391 
2392  appendStringInfoString(str, " :sortgrouprefs");
2393  for (i = 0; i < list_length(node->exprs); i++)
2394  appendStringInfo(str, " %u", node->sortgrouprefs[i]);
2395  }
2396  WRITE_FLOAT_FIELD(cost.startup, "%.2f");
2397  WRITE_FLOAT_FIELD(cost.per_tuple, "%.2f");
2398  WRITE_INT_FIELD(width);
2399 }
2400 
2401 static void
2403 {
2404  WRITE_NODE_TYPE("PARAMPATHINFO");
2405 
2406  WRITE_BITMAPSET_FIELD(ppi_req_outer);
2407  WRITE_FLOAT_FIELD(ppi_rows, "%.0f");
2408  WRITE_NODE_FIELD(ppi_clauses);
2409 }
2410 
2411 static void
2413 {
2414  WRITE_NODE_TYPE("RESTRICTINFO");
2415 
2416  /* NB: this isn't a complete set of fields */
2417  WRITE_NODE_FIELD(clause);
2418  WRITE_BOOL_FIELD(is_pushed_down);
2419  WRITE_BOOL_FIELD(outerjoin_delayed);
2420  WRITE_BOOL_FIELD(can_join);
2421  WRITE_BOOL_FIELD(pseudoconstant);
2422  WRITE_BOOL_FIELD(leakproof);
2423  WRITE_UINT_FIELD(security_level);
2424  WRITE_BITMAPSET_FIELD(clause_relids);
2425  WRITE_BITMAPSET_FIELD(required_relids);
2426  WRITE_BITMAPSET_FIELD(outer_relids);
2427  WRITE_BITMAPSET_FIELD(nullable_relids);
2428  WRITE_BITMAPSET_FIELD(left_relids);
2429  WRITE_BITMAPSET_FIELD(right_relids);
2430  WRITE_NODE_FIELD(orclause);
2431  /* don't write parent_ec, leads to infinite recursion in plan tree dump */
2432  WRITE_FLOAT_FIELD(norm_selec, "%.4f");
2433  WRITE_FLOAT_FIELD(outer_selec, "%.4f");
2434  WRITE_NODE_FIELD(mergeopfamilies);
2435  /* don't write left_ec, leads to infinite recursion in plan tree dump */
2436  /* don't write right_ec, leads to infinite recursion in plan tree dump */
2437  WRITE_NODE_FIELD(left_em);
2438  WRITE_NODE_FIELD(right_em);
2439  WRITE_BOOL_FIELD(outer_is_left);
2440  WRITE_OID_FIELD(hashjoinoperator);
2441 }
2442 
2443 static void
2445 {
2446  WRITE_NODE_TYPE("PLACEHOLDERVAR");
2447 
2448  WRITE_NODE_FIELD(phexpr);
2449  WRITE_BITMAPSET_FIELD(phrels);
2450  WRITE_UINT_FIELD(phid);
2451  WRITE_UINT_FIELD(phlevelsup);
2452 }
2453 
2454 static void
2456 {
2457  WRITE_NODE_TYPE("SPECIALJOININFO");
2458 
2459  WRITE_BITMAPSET_FIELD(min_lefthand);
2460  WRITE_BITMAPSET_FIELD(min_righthand);
2461  WRITE_BITMAPSET_FIELD(syn_lefthand);
2462  WRITE_BITMAPSET_FIELD(syn_righthand);
2463  WRITE_ENUM_FIELD(jointype, JoinType);
2464  WRITE_BOOL_FIELD(lhs_strict);
2465  WRITE_BOOL_FIELD(delay_upper_joins);
2466  WRITE_BOOL_FIELD(semi_can_btree);
2467  WRITE_BOOL_FIELD(semi_can_hash);
2468  WRITE_NODE_FIELD(semi_operators);
2469  WRITE_NODE_FIELD(semi_rhs_exprs);
2470 }
2471 
2472 static void
2474 {
2475  WRITE_NODE_TYPE("APPENDRELINFO");
2476 
2477  WRITE_UINT_FIELD(parent_relid);
2478  WRITE_UINT_FIELD(child_relid);
2479  WRITE_OID_FIELD(parent_reltype);
2480  WRITE_OID_FIELD(child_reltype);
2481  WRITE_NODE_FIELD(translated_vars);
2482  WRITE_OID_FIELD(parent_reloid);
2483 }
2484 
2485 static void
2487 {
2488  WRITE_NODE_TYPE("PARTITIONEDCHILDRELINFO");
2489 
2490  WRITE_UINT_FIELD(parent_relid);
2491  WRITE_NODE_FIELD(child_rels);
2492 }
2493 
2494 static void
2496 {
2497  WRITE_NODE_TYPE("PLACEHOLDERINFO");
2498 
2499  WRITE_UINT_FIELD(phid);
2500  WRITE_NODE_FIELD(ph_var);
2501  WRITE_BITMAPSET_FIELD(ph_eval_at);
2502  WRITE_BITMAPSET_FIELD(ph_lateral);
2503  WRITE_BITMAPSET_FIELD(ph_needed);
2504  WRITE_INT_FIELD(ph_width);
2505 }
2506 
2507 static void
2509 {
2510  WRITE_NODE_TYPE("MINMAXAGGINFO");
2511 
2512  WRITE_OID_FIELD(aggfnoid);
2513  WRITE_OID_FIELD(aggsortop);
2514  WRITE_NODE_FIELD(target);
2515  /* We intentionally omit subroot --- too large, not interesting enough */
2516  WRITE_NODE_FIELD(path);
2517  WRITE_FLOAT_FIELD(pathcost, "%.2f");
2518  WRITE_NODE_FIELD(param);
2519 }
2520 
2521 static void
2523 {
2524  WRITE_NODE_TYPE("PLANNERPARAMITEM");
2525 
2526  WRITE_NODE_FIELD(item);
2527  WRITE_INT_FIELD(paramId);
2528 }
2529 
2530 /*****************************************************************************
2531  *
2532  * Stuff from extensible.h
2533  *
2534  *****************************************************************************/
2535 
2536 static void
2538 {
2539  const ExtensibleNodeMethods *methods;
2540 
2541  methods = GetExtensibleNodeMethods(node->extnodename, false);
2542 
2543  WRITE_NODE_TYPE("EXTENSIBLENODE");
2544 
2545  WRITE_STRING_FIELD(extnodename);
2546 
2547  /* serialize the private fields */
2548  methods->nodeOut(str, node);
2549 }
2550 
2551 /*****************************************************************************
2552  *
2553  * Stuff from parsenodes.h.
2554  *
2555  *****************************************************************************/
2556 
2557 /*
2558  * print the basic stuff of all nodes that inherit from CreateStmt
2559  */
2560 static void
2562 {
2563  WRITE_NODE_FIELD(relation);
2564  WRITE_NODE_FIELD(tableElts);
2565  WRITE_NODE_FIELD(inhRelations);
2566  WRITE_NODE_FIELD(partspec);
2567  WRITE_NODE_FIELD(partbound);
2568  WRITE_NODE_FIELD(ofTypename);
2569  WRITE_NODE_FIELD(constraints);
2571  WRITE_ENUM_FIELD(oncommit, OnCommitAction);
2572  WRITE_STRING_FIELD(tablespacename);
2573  WRITE_BOOL_FIELD(if_not_exists);
2574 }
2575 
2576 static void
2578 {
2579  WRITE_NODE_TYPE("CREATESTMT");
2580 
2581  _outCreateStmtInfo(str, (const CreateStmt *) node);
2582 }
2583 
2584 static void
2586 {
2587  WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
2588 
2589  _outCreateStmtInfo(str, (const CreateStmt *) node);
2590 
2591  WRITE_STRING_FIELD(servername);
2593 }
2594 
2595 static void
2597 {
2598  WRITE_NODE_TYPE("IMPORTFOREIGNSCHEMASTMT");
2599 
2600  WRITE_STRING_FIELD(server_name);
2601  WRITE_STRING_FIELD(remote_schema);
2602  WRITE_STRING_FIELD(local_schema);
2604  WRITE_NODE_FIELD(table_list);
2606 }
2607 
2608 static void
2610 {
2611  WRITE_NODE_TYPE("INDEXSTMT");
2612 
2613  WRITE_STRING_FIELD(idxname);
2614  WRITE_NODE_FIELD(relation);
2615  WRITE_STRING_FIELD(accessMethod);
2616  WRITE_STRING_FIELD(tableSpace);
2617  WRITE_NODE_FIELD(indexParams);
2619  WRITE_NODE_FIELD(whereClause);
2620  WRITE_NODE_FIELD(excludeOpNames);
2621  WRITE_STRING_FIELD(idxcomment);
2622  WRITE_OID_FIELD(indexOid);
2623  WRITE_OID_FIELD(oldNode);
2624  WRITE_BOOL_FIELD(unique);
2625  WRITE_BOOL_FIELD(primary);
2626  WRITE_BOOL_FIELD(isconstraint);
2627  WRITE_BOOL_FIELD(deferrable);
2628  WRITE_BOOL_FIELD(initdeferred);
2629  WRITE_BOOL_FIELD(transformed);
2630  WRITE_BOOL_FIELD(concurrent);
2631  WRITE_BOOL_FIELD(if_not_exists);
2632 }
2633 
2634 static void
2636 {
2637  WRITE_NODE_TYPE("CREATESTATSSTMT");
2638 
2639  WRITE_NODE_FIELD(defnames);
2640  WRITE_NODE_FIELD(stat_types);
2641  WRITE_NODE_FIELD(exprs);
2642  WRITE_NODE_FIELD(relations);
2643  WRITE_BOOL_FIELD(if_not_exists);
2644 }
2645 
2646 static void
2648 {
2649  WRITE_NODE_TYPE("NOTIFY");
2650 
2651  WRITE_STRING_FIELD(conditionname);
2652  WRITE_STRING_FIELD(payload);
2653 }
2654 
2655 static void
2657 {
2658  WRITE_NODE_TYPE("DECLARECURSOR");
2659 
2660  WRITE_STRING_FIELD(portalname);
2662  WRITE_NODE_FIELD(query);
2663 }
2664 
2665 static void
2667 {
2668  WRITE_NODE_TYPE("SELECT");
2669 
2670  WRITE_NODE_FIELD(distinctClause);
2671  WRITE_NODE_FIELD(intoClause);
2672  WRITE_NODE_FIELD(targetList);
2673  WRITE_NODE_FIELD(fromClause);
2674  WRITE_NODE_FIELD(whereClause);
2675  WRITE_NODE_FIELD(groupClause);
2676  WRITE_NODE_FIELD(havingClause);
2677  WRITE_NODE_FIELD(windowClause);
2678  WRITE_NODE_FIELD(valuesLists);
2679  WRITE_NODE_FIELD(sortClause);
2680  WRITE_NODE_FIELD(limitOffset);
2681  WRITE_NODE_FIELD(limitCount);
2682  WRITE_NODE_FIELD(lockingClause);
2683  WRITE_NODE_FIELD(withClause);
2685  WRITE_BOOL_FIELD(all);
2686  WRITE_NODE_FIELD(larg);
2687  WRITE_NODE_FIELD(rarg);
2688 }
2689 
2690 static void
2692 {
2693  WRITE_NODE_TYPE("FUNCCALL");
2694 
2695  WRITE_NODE_FIELD(funcname);
2697  WRITE_NODE_FIELD(agg_order);
2698  WRITE_NODE_FIELD(agg_filter);
2699  WRITE_BOOL_FIELD(agg_within_group);
2700  WRITE_BOOL_FIELD(agg_star);
2701  WRITE_BOOL_FIELD(agg_distinct);
2702  WRITE_BOOL_FIELD(func_variadic);
2703  WRITE_NODE_FIELD(over);
2704  WRITE_LOCATION_FIELD(location);
2705 }
2706 
2707 static void
2708 _outDefElem(StringInfo str, const DefElem *node)
2709 {
2710  WRITE_NODE_TYPE("DEFELEM");
2711 
2712  WRITE_STRING_FIELD(defnamespace);
2713  WRITE_STRING_FIELD(defname);
2715  WRITE_ENUM_FIELD(defaction, DefElemAction);
2716  WRITE_LOCATION_FIELD(location);
2717 }
2718 
2719 static void
2721 {
2722  WRITE_NODE_TYPE("TABLELIKECLAUSE");
2723 
2724  WRITE_NODE_FIELD(relation);
2726 }
2727 
2728 static void
2730 {
2731  WRITE_NODE_TYPE("LOCKINGCLAUSE");
2732 
2733  WRITE_NODE_FIELD(lockedRels);
2735  WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2736 }
2737 
2738 static void
2740 {
2741  WRITE_NODE_TYPE("XMLSERIALIZE");
2742 
2744  WRITE_NODE_FIELD(expr);
2745  WRITE_NODE_FIELD(typeName);
2746  WRITE_LOCATION_FIELD(location);
2747 }
2748 
2749 static void
2751 {
2752  WRITE_NODE_TYPE("TRIGGERTRANSITION");
2753 
2755  WRITE_BOOL_FIELD(isNew);
2756  WRITE_BOOL_FIELD(isTable);
2757 }
2758 
2759 static void
2761 {
2762  WRITE_NODE_TYPE("COLUMNDEF");
2763 
2764  WRITE_STRING_FIELD(colname);
2765  WRITE_NODE_FIELD(typeName);
2766  WRITE_INT_FIELD(inhcount);
2767  WRITE_BOOL_FIELD(is_local);
2768  WRITE_BOOL_FIELD(is_not_null);
2769  WRITE_BOOL_FIELD(is_from_type);
2770  WRITE_BOOL_FIELD(is_from_parent);
2771  WRITE_CHAR_FIELD(storage);
2772  WRITE_NODE_FIELD(raw_default);
2773  WRITE_NODE_FIELD(cooked_default);
2774  WRITE_CHAR_FIELD(identity);
2775  WRITE_NODE_FIELD(collClause);
2776  WRITE_OID_FIELD(collOid);
2777  WRITE_NODE_FIELD(constraints);
2778  WRITE_NODE_FIELD(fdwoptions);
2779  WRITE_LOCATION_FIELD(location);
2780 }
2781 
2782 static void
2784 {
2785  WRITE_NODE_TYPE("TYPENAME");
2786 
2787  WRITE_NODE_FIELD(names);
2788  WRITE_OID_FIELD(typeOid);
2789  WRITE_BOOL_FIELD(setof);
2790  WRITE_BOOL_FIELD(pct_type);
2791  WRITE_NODE_FIELD(typmods);
2792  WRITE_INT_FIELD(typemod);
2793  WRITE_NODE_FIELD(arrayBounds);
2794  WRITE_LOCATION_FIELD(location);
2795 }
2796 
2797 static void
2799 {
2800  WRITE_NODE_TYPE("TYPECAST");
2801 
2803  WRITE_NODE_FIELD(typeName);
2804  WRITE_LOCATION_FIELD(location);
2805 }
2806 
2807 static void
2809 {
2810  WRITE_NODE_TYPE("COLLATECLAUSE");
2811 
2813  WRITE_NODE_FIELD(collname);
2814  WRITE_LOCATION_FIELD(location);
2815 }
2816 
2817 static void
2819 {
2820  WRITE_NODE_TYPE("INDEXELEM");
2821 
2823  WRITE_NODE_FIELD(expr);
2824  WRITE_STRING_FIELD(indexcolname);
2825  WRITE_NODE_FIELD(collation);
2826  WRITE_NODE_FIELD(opclass);
2827  WRITE_ENUM_FIELD(ordering, SortByDir);
2828  WRITE_ENUM_FIELD(nulls_ordering, SortByNulls);
2829 }
2830 
2831 static void
2832 _outQuery(StringInfo str, const Query *node)
2833 {
2834  WRITE_NODE_TYPE("QUERY");
2835 
2836  WRITE_ENUM_FIELD(commandType, CmdType);
2837  WRITE_ENUM_FIELD(querySource, QuerySource);
2838  /* we intentionally do not print the queryId field */
2839  WRITE_BOOL_FIELD(canSetTag);
2840 
2841  /*
2842  * Hack to work around missing outfuncs routines for a lot of the
2843  * utility-statement node types. (The only one we actually *need* for
2844  * rules support is NotifyStmt.) Someday we ought to support 'em all, but
2845  * for the meantime do this to avoid getting lots of warnings when running
2846  * with debug_print_parse on.
2847  */
2848  if (node->utilityStmt)
2849  {
2850  switch (nodeTag(node->utilityStmt))
2851  {
2852  case T_CreateStmt:
2853  case T_IndexStmt:
2854  case T_NotifyStmt:
2855  case T_DeclareCursorStmt:
2856  WRITE_NODE_FIELD(utilityStmt);
2857  break;
2858  default:
2859  appendStringInfoString(str, " :utilityStmt ?");
2860  break;
2861  }
2862  }
2863  else
2864  appendStringInfoString(str, " :utilityStmt <>");
2865 
2866  WRITE_INT_FIELD(resultRelation);
2867  WRITE_BOOL_FIELD(hasAggs);
2868  WRITE_BOOL_FIELD(hasWindowFuncs);
2869  WRITE_BOOL_FIELD(hasTargetSRFs);
2870  WRITE_BOOL_FIELD(hasSubLinks);
2871  WRITE_BOOL_FIELD(hasDistinctOn);
2872  WRITE_BOOL_FIELD(hasRecursive);
2873  WRITE_BOOL_FIELD(hasModifyingCTE);
2874  WRITE_BOOL_FIELD(hasForUpdate);
2875  WRITE_BOOL_FIELD(hasRowSecurity);
2876  WRITE_NODE_FIELD(cteList);
2877  WRITE_NODE_FIELD(rtable);
2878  WRITE_NODE_FIELD(jointree);
2879  WRITE_NODE_FIELD(targetList);
2880  WRITE_ENUM_FIELD(override, OverridingKind);
2881  WRITE_NODE_FIELD(onConflict);
2882  WRITE_NODE_FIELD(returningList);
2883  WRITE_NODE_FIELD(groupClause);
2884  WRITE_NODE_FIELD(groupingSets);
2885  WRITE_NODE_FIELD(havingQual);
2886  WRITE_NODE_FIELD(windowClause);
2887  WRITE_NODE_FIELD(distinctClause);
2888  WRITE_NODE_FIELD(sortClause);
2889  WRITE_NODE_FIELD(limitOffset);
2890  WRITE_NODE_FIELD(limitCount);
2891  WRITE_NODE_FIELD(rowMarks);
2892  WRITE_NODE_FIELD(setOperations);
2893  WRITE_NODE_FIELD(constraintDeps);
2894  /* withCheckOptions intentionally omitted, see comment in parsenodes.h */
2895  WRITE_LOCATION_FIELD(stmt_location);
2896  WRITE_LOCATION_FIELD(stmt_len);
2897 }
2898 
2899 static void
2901 {
2902  WRITE_NODE_TYPE("WITHCHECKOPTION");
2903 
2904  WRITE_ENUM_FIELD(kind, WCOKind);
2905  WRITE_STRING_FIELD(relname);
2906  WRITE_STRING_FIELD(polname);
2907  WRITE_NODE_FIELD(qual);
2908  WRITE_BOOL_FIELD(cascaded);
2909 }
2910 
2911 static void
2913 {
2914  WRITE_NODE_TYPE("SORTGROUPCLAUSE");
2915 
2916  WRITE_UINT_FIELD(tleSortGroupRef);
2917  WRITE_OID_FIELD(eqop);
2918  WRITE_OID_FIELD(sortop);
2919  WRITE_BOOL_FIELD(nulls_first);
2920  WRITE_BOOL_FIELD(hashable);
2921 }
2922 
2923 static void
2925 {
2926  WRITE_NODE_TYPE("GROUPINGSET");
2927 
2929  WRITE_NODE_FIELD(content);
2930  WRITE_LOCATION_FIELD(location);
2931 }
2932 
2933 static void
2935 {
2936  WRITE_NODE_TYPE("WINDOWCLAUSE");
2937 
2939  WRITE_STRING_FIELD(refname);
2940  WRITE_NODE_FIELD(partitionClause);
2941  WRITE_NODE_FIELD(orderClause);
2942  WRITE_INT_FIELD(frameOptions);
2943  WRITE_NODE_FIELD(startOffset);
2944  WRITE_NODE_FIELD(endOffset);
2945  WRITE_UINT_FIELD(winref);
2946  WRITE_BOOL_FIELD(copiedOrder);
2947 }
2948 
2949 static void
2951 {
2952  WRITE_NODE_TYPE("ROWMARKCLAUSE");
2953 
2954  WRITE_UINT_FIELD(rti);
2956  WRITE_ENUM_FIELD(waitPolicy, LockWaitPolicy);
2957  WRITE_BOOL_FIELD(pushedDown);
2958 }
2959 
2960 static void
2962 {
2963  WRITE_NODE_TYPE("WITHCLAUSE");
2964 
2965  WRITE_NODE_FIELD(ctes);
2966  WRITE_BOOL_FIELD(recursive);
2967  WRITE_LOCATION_FIELD(location);
2968 }
2969 
2970 static void
2972 {
2973  WRITE_NODE_TYPE("COMMONTABLEEXPR");
2974 
2975  WRITE_STRING_FIELD(ctename);
2976  WRITE_NODE_FIELD(aliascolnames);
2977  WRITE_NODE_FIELD(ctequery);
2978  WRITE_LOCATION_FIELD(location);
2979  WRITE_BOOL_FIELD(cterecursive);
2980  WRITE_INT_FIELD(cterefcount);
2981  WRITE_NODE_FIELD(ctecolnames);
2982  WRITE_NODE_FIELD(ctecoltypes);
2983  WRITE_NODE_FIELD(ctecoltypmods);
2984  WRITE_NODE_FIELD(ctecolcollations);
2985 }
2986 
2987 static void
2989 {
2990  WRITE_NODE_TYPE("SETOPERATIONSTMT");
2991 
2993  WRITE_BOOL_FIELD(all);
2994  WRITE_NODE_FIELD(larg);
2995  WRITE_NODE_FIELD(rarg);
2996  WRITE_NODE_FIELD(colTypes);
2997  WRITE_NODE_FIELD(colTypmods);
2998  WRITE_NODE_FIELD(colCollations);
2999  WRITE_NODE_FIELD(groupClauses);
3000 }
3001 
3002 static void
3004 {
3005  WRITE_NODE_TYPE("RTE");
3006 
3007  /* put alias + eref first to make dump more legible */
3008  WRITE_NODE_FIELD(alias);
3009  WRITE_NODE_FIELD(eref);
3010  WRITE_ENUM_FIELD(rtekind, RTEKind);
3011 
3012  switch (node->rtekind)
3013  {
3014  case RTE_RELATION:
3015  WRITE_OID_FIELD(relid);
3016  WRITE_CHAR_FIELD(relkind);
3017  WRITE_NODE_FIELD(tablesample);
3018  break;
3019  case RTE_SUBQUERY:
3020  WRITE_NODE_FIELD(subquery);
3021  WRITE_BOOL_FIELD(security_barrier);
3022  break;
3023  case RTE_JOIN:
3024  WRITE_ENUM_FIELD(jointype, JoinType);
3025  WRITE_NODE_FIELD(joinaliasvars);
3026  break;
3027  case RTE_FUNCTION:
3029  WRITE_BOOL_FIELD(funcordinality);
3030  break;
3031  case RTE_TABLEFUNC:
3032  WRITE_NODE_FIELD(tablefunc);
3033  break;
3034  case RTE_VALUES:
3035  WRITE_NODE_FIELD(values_lists);
3036  WRITE_NODE_FIELD(coltypes);
3037  WRITE_NODE_FIELD(coltypmods);
3038  WRITE_NODE_FIELD(colcollations);
3039  break;
3040  case RTE_CTE:
3041  WRITE_STRING_FIELD(ctename);
3042  WRITE_UINT_FIELD(ctelevelsup);
3043  WRITE_BOOL_FIELD(self_reference);
3044  WRITE_NODE_FIELD(coltypes);
3045  WRITE_NODE_FIELD(coltypmods);
3046  WRITE_NODE_FIELD(colcollations);
3047  break;
3048  case RTE_NAMEDTUPLESTORE:
3049  WRITE_STRING_FIELD(enrname);
3050  WRITE_FLOAT_FIELD(enrtuples, "%.0f");
3051  WRITE_OID_FIELD(relid);
3052  WRITE_NODE_FIELD(coltypes);
3053  WRITE_NODE_FIELD(coltypmods);
3054  WRITE_NODE_FIELD(colcollations);
3055  break;
3056  default:
3057  elog(ERROR, "unrecognized RTE kind: %d", (int) node->rtekind);
3058  break;
3059  }
3060 
3061  WRITE_BOOL_FIELD(lateral);
3062  WRITE_BOOL_FIELD(inh);
3063  WRITE_BOOL_FIELD(inFromCl);
3064  WRITE_UINT_FIELD(requiredPerms);
3065  WRITE_OID_FIELD(checkAsUser);
3066  WRITE_BITMAPSET_FIELD(selectedCols);
3067  WRITE_BITMAPSET_FIELD(insertedCols);
3068  WRITE_BITMAPSET_FIELD(updatedCols);
3069  WRITE_NODE_FIELD(securityQuals);
3070 }
3071 
3072 static void
3074 {
3075  WRITE_NODE_TYPE("RANGETBLFUNCTION");
3076 
3077  WRITE_NODE_FIELD(funcexpr);
3078  WRITE_INT_FIELD(funccolcount);
3079  WRITE_NODE_FIELD(funccolnames);
3080  WRITE_NODE_FIELD(funccoltypes);
3081  WRITE_NODE_FIELD(funccoltypmods);
3082  WRITE_NODE_FIELD(funccolcollations);
3083  WRITE_BITMAPSET_FIELD(funcparams);
3084 }
3085 
3086 static void
3088 {
3089  WRITE_NODE_TYPE("TABLESAMPLECLAUSE");
3090 
3091  WRITE_OID_FIELD(tsmhandler);
3093  WRITE_NODE_FIELD(repeatable);
3094 }
3095 
3096 static void
3097 _outAExpr(StringInfo str, const A_Expr *node)
3098 {
3099  WRITE_NODE_TYPE("AEXPR");
3100 
3101  switch (node->kind)
3102  {
3103  case AEXPR_OP:
3104  appendStringInfoChar(str, ' ');
3106  break;
3107  case AEXPR_OP_ANY:
3108  appendStringInfoChar(str, ' ');
3110  appendStringInfoString(str, " ANY ");
3111  break;
3112  case AEXPR_OP_ALL:
3113  appendStringInfoChar(str, ' ');
3115  appendStringInfoString(str, " ALL ");
3116  break;
3117  case AEXPR_DISTINCT:
3118  appendStringInfoString(str, " DISTINCT ");
3120  break;
3121  case AEXPR_NOT_DISTINCT:
3122  appendStringInfoString(str, " NOT_DISTINCT ");
3124  break;
3125  case AEXPR_NULLIF:
3126  appendStringInfoString(str, " NULLIF ");
3128  break;
3129  case AEXPR_OF:
3130  appendStringInfoString(str, " OF ");
3132  break;
3133  case AEXPR_IN:
3134  appendStringInfoString(str, " IN ");
3136  break;
3137  case AEXPR_LIKE:
3138  appendStringInfoString(str, " LIKE ");
3140  break;
3141  case AEXPR_ILIKE:
3142  appendStringInfoString(str, " ILIKE ");
3144  break;
3145  case AEXPR_SIMILAR:
3146  appendStringInfoString(str, " SIMILAR ");
3148  break;
3149  case AEXPR_BETWEEN:
3150  appendStringInfoString(str, " BETWEEN ");
3152  break;
3153  case AEXPR_NOT_BETWEEN:
3154  appendStringInfoString(str, " NOT_BETWEEN ");
3156  break;
3157  case AEXPR_BETWEEN_SYM:
3158  appendStringInfoString(str, " BETWEEN_SYM ");
3160  break;
3161  case AEXPR_NOT_BETWEEN_SYM:
3162  appendStringInfoString(str, " NOT_BETWEEN_SYM ");
3164  break;
3165  case AEXPR_PAREN:
3166  appendStringInfoString(str, " PAREN");
3167  break;
3168  default:
3169  appendStringInfoString(str, " ??");
3170  break;
3171  }
3172 
3173  WRITE_NODE_FIELD(lexpr);
3174  WRITE_NODE_FIELD(rexpr);
3175  WRITE_LOCATION_FIELD(location);
3176 }
3177 
3178 static void
3180 {
3181  switch (value->type)
3182  {
3183  case T_Integer:
3184  appendStringInfo(str, "%ld", value->val.ival);
3185  break;
3186  case T_Float:
3187 
3188  /*
3189  * We assume the value is a valid numeric literal and so does not
3190  * need quoting.
3191  */
3192  appendStringInfoString(str, value->val.str);
3193  break;
3194  case T_String:
3195 
3196  /*
3197  * We use outToken to provide escaping of the string's content,
3198  * but we don't want it to do anything with an empty string.
3199  */
3200  appendStringInfoChar(str, '"');
3201  if (value->val.str[0] != '\0')
3202  outToken(str, value->val.str);
3203  appendStringInfoChar(str, '"');
3204  break;
3205  case T_BitString:
3206  /* internal representation already has leading 'b' */
3207  appendStringInfoString(str, value->val.str);
3208  break;
3209  case T_Null:
3210  /* this is seen only within A_Const, not in transformed trees */
3211  appendStringInfoString(str, "NULL");
3212  break;
3213  default:
3214  elog(ERROR, "unrecognized node type: %d", (int) value->type);
3215  break;
3216  }
3217 }
3218 
3219 static void
3221 {
3222  WRITE_NODE_TYPE("COLUMNREF");
3223 
3224  WRITE_NODE_FIELD(fields);
3225  WRITE_LOCATION_FIELD(location);
3226 }
3227 
3228 static void
3230 {
3231  WRITE_NODE_TYPE("PARAMREF");
3232 
3233  WRITE_INT_FIELD(number);
3234  WRITE_LOCATION_FIELD(location);
3235 }
3236 
3237 static void
3238 _outAConst(StringInfo str, const A_Const *node)
3239 {
3240  WRITE_NODE_TYPE("A_CONST");
3241 
3242  appendStringInfoString(str, " :val ");
3243  _outValue(str, &(node->val));
3244  WRITE_LOCATION_FIELD(location);
3245 }
3246 
3247 static void
3248 _outA_Star(StringInfo str, const A_Star *node)
3249 {
3250  WRITE_NODE_TYPE("A_STAR");
3251 }
3252 
3253 static void
3255 {
3256  WRITE_NODE_TYPE("A_INDICES");
3257 
3258  WRITE_BOOL_FIELD(is_slice);
3259  WRITE_NODE_FIELD(lidx);
3260  WRITE_NODE_FIELD(uidx);
3261 }
3262 
3263 static void
3265 {
3266  WRITE_NODE_TYPE("A_INDIRECTION");
3267 
3269  WRITE_NODE_FIELD(indirection);
3270 }
3271 
3272 static void
3274 {
3275  WRITE_NODE_TYPE("A_ARRAYEXPR");
3276 
3277  WRITE_NODE_FIELD(elements);
3278  WRITE_LOCATION_FIELD(location);
3279 }
3280 
3281 static void
3283 {
3284  WRITE_NODE_TYPE("RESTARGET");
3285 
3287  WRITE_NODE_FIELD(indirection);
3289  WRITE_LOCATION_FIELD(location);
3290 }
3291 
3292 static void
3294 {
3295  WRITE_NODE_TYPE("MULTIASSIGNREF");
3296 
3297  WRITE_NODE_FIELD(source);
3298  WRITE_INT_FIELD(colno);
3299  WRITE_INT_FIELD(ncolumns);
3300 }
3301 
3302 static void
3303 _outSortBy(StringInfo str, const SortBy *node)
3304 {
3305  WRITE_NODE_TYPE("SORTBY");
3306 
3307  WRITE_NODE_FIELD(node);
3308  WRITE_ENUM_FIELD(sortby_dir, SortByDir);
3309  WRITE_ENUM_FIELD(sortby_nulls, SortByNulls);
3310  WRITE_NODE_FIELD(useOp);
3311  WRITE_LOCATION_FIELD(location);
3312 }
3313 
3314 static void
3316 {
3317  WRITE_NODE_TYPE("WINDOWDEF");
3318 
3320  WRITE_STRING_FIELD(refname);
3321  WRITE_NODE_FIELD(partitionClause);
3322  WRITE_NODE_FIELD(orderClause);
3323  WRITE_INT_FIELD(frameOptions);
3324  WRITE_NODE_FIELD(startOffset);
3325  WRITE_NODE_FIELD(endOffset);
3326  WRITE_LOCATION_FIELD(location);
3327 }
3328 
3329 static void
3331 {
3332  WRITE_NODE_TYPE("RANGESUBSELECT");
3333 
3334  WRITE_BOOL_FIELD(lateral);
3335  WRITE_NODE_FIELD(subquery);
3336  WRITE_NODE_FIELD(alias);
3337 }
3338 
3339 static void
3341 {
3342  WRITE_NODE_TYPE("RANGEFUNCTION");
3343 
3344  WRITE_BOOL_FIELD(lateral);
3345  WRITE_BOOL_FIELD(ordinality);
3346  WRITE_BOOL_FIELD(is_rowsfrom);
3348  WRITE_NODE_FIELD(alias);
3349  WRITE_NODE_FIELD(coldeflist);
3350 }
3351 
3352 static void
3354 {
3355  WRITE_NODE_TYPE("RANGETABLESAMPLE");
3356 
3357  WRITE_NODE_FIELD(relation);
3358  WRITE_NODE_FIELD(method);
3360  WRITE_NODE_FIELD(repeatable);
3361  WRITE_LOCATION_FIELD(location);
3362 }
3363 
3364 static void
3366 {
3367  WRITE_NODE_TYPE("RANGETABLEFUNC");
3368 
3369  WRITE_BOOL_FIELD(lateral);
3370  WRITE_NODE_FIELD(docexpr);
3371  WRITE_NODE_FIELD(rowexpr);
3372  WRITE_NODE_FIELD(namespaces);
3373  WRITE_NODE_FIELD(columns);
3374  WRITE_NODE_FIELD(alias);
3375  WRITE_LOCATION_FIELD(location);
3376 }
3377 
3378 static void
3380 {
3381  WRITE_NODE_TYPE("RANGETABLEFUNCCOL");
3382 
3383  WRITE_STRING_FIELD(colname);
3384  WRITE_NODE_FIELD(typeName);
3385  WRITE_BOOL_FIELD(for_ordinality);
3386  WRITE_BOOL_FIELD(is_not_null);
3387  WRITE_NODE_FIELD(colexpr);
3388  WRITE_NODE_FIELD(coldefexpr);
3389  WRITE_LOCATION_FIELD(location);
3390 }
3391 
3392 static void
3394 {
3395  WRITE_NODE_TYPE("CONSTRAINT");
3396 
3397  WRITE_STRING_FIELD(conname);
3398  WRITE_BOOL_FIELD(deferrable);
3399  WRITE_BOOL_FIELD(initdeferred);
3400  WRITE_LOCATION_FIELD(location);
3401 
3402  appendStringInfoString(str, " :contype ");
3403  switch (node->contype)
3404  {
3405  case CONSTR_NULL:
3406  appendStringInfoString(str, "NULL");
3407  break;
3408 
3409  case CONSTR_NOTNULL:
3410  appendStringInfoString(str, "NOT_NULL");
3411  break;
3412 
3413  case CONSTR_DEFAULT:
3414  appendStringInfoString(str, "DEFAULT");
3415  WRITE_NODE_FIELD(raw_expr);
3416  WRITE_STRING_FIELD(cooked_expr);
3417  break;
3418 
3419  case CONSTR_IDENTITY:
3420  appendStringInfoString(str, "IDENTITY");
3421  WRITE_NODE_FIELD(raw_expr);
3422  WRITE_STRING_FIELD(cooked_expr);
3423  WRITE_CHAR_FIELD(generated_when);
3424  break;
3425 
3426  case CONSTR_CHECK:
3427  appendStringInfoString(str, "CHECK");
3428  WRITE_BOOL_FIELD(is_no_inherit);
3429  WRITE_NODE_FIELD(raw_expr);
3430  WRITE_STRING_FIELD(cooked_expr);
3431  break;
3432 
3433  case CONSTR_PRIMARY:
3434  appendStringInfoString(str, "PRIMARY_KEY");
3435  WRITE_NODE_FIELD(keys);
3437  WRITE_STRING_FIELD(indexname);
3438  WRITE_STRING_FIELD(indexspace);
3439  /* access_method and where_clause not currently used */
3440  break;
3441 
3442  case CONSTR_UNIQUE:
3443  appendStringInfoString(str, "UNIQUE");
3444  WRITE_NODE_FIELD(keys);
3446  WRITE_STRING_FIELD(indexname);
3447  WRITE_STRING_FIELD(indexspace);
3448  /* access_method and where_clause not currently used */
3449  break;
3450 
3451  case CONSTR_EXCLUSION:
3452  appendStringInfoString(str, "EXCLUSION");
3453  WRITE_NODE_FIELD(exclusions);
3455  WRITE_STRING_FIELD(indexname);
3456  WRITE_STRING_FIELD(indexspace);
3457  WRITE_STRING_FIELD(access_method);
3458  WRITE_NODE_FIELD(where_clause);
3459  break;
3460 
3461  case CONSTR_FOREIGN:
3462  appendStringInfoString(str, "FOREIGN_KEY");
3463  WRITE_NODE_FIELD(pktable);
3464  WRITE_NODE_FIELD(fk_attrs);
3465  WRITE_NODE_FIELD(pk_attrs);
3466  WRITE_CHAR_FIELD(fk_matchtype);
3467  WRITE_CHAR_FIELD(fk_upd_action);
3468  WRITE_CHAR_FIELD(fk_del_action);
3469  WRITE_NODE_FIELD(old_conpfeqop);
3470  WRITE_OID_FIELD(old_pktable_oid);
3471  WRITE_BOOL_FIELD(skip_validation);
3472  WRITE_BOOL_FIELD(initially_valid);
3473  break;
3474 
3476  appendStringInfoString(str, "ATTR_DEFERRABLE");
3477  break;
3478 
3480  appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
3481  break;
3482 
3483  case CONSTR_ATTR_DEFERRED:
3484  appendStringInfoString(str, "ATTR_DEFERRED");
3485  break;
3486 
3487  case CONSTR_ATTR_IMMEDIATE:
3488  appendStringInfoString(str, "ATTR_IMMEDIATE");
3489  break;
3490 
3491  default:
3492  appendStringInfo(str, "<unrecognized_constraint %d>",
3493  (int) node->contype);
3494  break;
3495  }
3496 }
3497 
3498 static void
3500 {
3501  int i;
3502 
3503  WRITE_NODE_TYPE("FOREIGNKEYCACHEINFO");
3504 
3505  WRITE_OID_FIELD(conrelid);
3506  WRITE_OID_FIELD(confrelid);
3507  WRITE_INT_FIELD(nkeys);
3508  appendStringInfoString(str, " :conkey");
3509  for (i = 0; i < node->nkeys; i++)
3510  appendStringInfo(str, " %d", node->conkey[i]);
3511  appendStringInfoString(str, " :confkey");
3512  for (i = 0; i < node->nkeys; i++)
3513  appendStringInfo(str, " %d", node->confkey[i]);
3514  appendStringInfoString(str, " :conpfeqop");
3515  for (i = 0; i < node->nkeys; i++)
3516  appendStringInfo(str, " %u", node->conpfeqop[i]);
3517 }
3518 
3519 static void
3521 {
3522  WRITE_NODE_TYPE("PARTITIONELEM");
3523 
3525  WRITE_NODE_FIELD(expr);
3526  WRITE_NODE_FIELD(collation);
3527  WRITE_NODE_FIELD(opclass);
3528  WRITE_LOCATION_FIELD(location);
3529 }
3530 
3531 static void
3533 {
3534  WRITE_NODE_TYPE("PARTITIONSPEC");
3535 
3536  WRITE_STRING_FIELD(strategy);
3537  WRITE_NODE_FIELD(partParams);
3538  WRITE_LOCATION_FIELD(location);
3539 }
3540 
3541 static void
3543 {
3544  WRITE_NODE_TYPE("PARTITIONBOUNDSPEC");
3545 
3546  WRITE_CHAR_FIELD(strategy);
3547  WRITE_NODE_FIELD(listdatums);
3548  WRITE_NODE_FIELD(lowerdatums);
3549  WRITE_NODE_FIELD(upperdatums);
3550  WRITE_LOCATION_FIELD(location);
3551 }
3552 
3553 static void
3555 {
3556  WRITE_NODE_TYPE("PARTITIONRANGEDATUM");
3557 
3558  WRITE_BOOL_FIELD(infinite);
3560  WRITE_LOCATION_FIELD(location);
3561 }
3562 
3563 /*
3564  * outNode -
3565  * converts a Node into ascii string and append it to 'str'
3566  */
3567 void
3568 outNode(StringInfo str, const void *obj)
3569 {
3570  if (obj == NULL)
3571  appendStringInfoString(str, "<>");
3572  else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
3573  _outList(str, obj);
3574  else if (IsA(obj, Integer) ||
3575  IsA(obj, Float) ||
3576  IsA(obj, String) ||
3577  IsA(obj, BitString))
3578  {
3579  /* nodeRead does not want to see { } around these! */
3580  _outValue(str, obj);
3581  }
3582  else
3583  {
3584  appendStringInfoChar(str, '{');
3585  switch (nodeTag(obj))
3586  {
3587  case T_PlannedStmt:
3588  _outPlannedStmt(str, obj);
3589  break;
3590  case T_Plan:
3591  _outPlan(str, obj);
3592  break;
3593  case T_Result:
3594  _outResult(str, obj);
3595  break;
3596  case T_ProjectSet:
3597  _outProjectSet(str, obj);
3598  break;
3599  case T_ModifyTable:
3600  _outModifyTable(str, obj);
3601  break;
3602  case T_Append:
3603  _outAppend(str, obj);
3604  break;
3605  case T_MergeAppend:
3606  _outMergeAppend(str, obj);
3607  break;
3608  case T_RecursiveUnion:
3609  _outRecursiveUnion(str, obj);
3610  break;
3611  case T_BitmapAnd:
3612  _outBitmapAnd(str, obj);
3613  break;
3614  case T_BitmapOr:
3615  _outBitmapOr(str, obj);
3616  break;
3617  case T_Gather:
3618  _outGather(str, obj);
3619  break;
3620  case T_GatherMerge:
3621  _outGatherMerge(str, obj);
3622  break;
3623  case T_Scan:
3624  _outScan(str, obj);
3625  break;
3626  case T_SeqScan:
3627  _outSeqScan(str, obj);
3628  break;
3629  case T_SampleScan:
3630  _outSampleScan(str, obj);
3631  break;
3632  case T_IndexScan:
3633  _outIndexScan(str, obj);
3634  break;
3635  case T_IndexOnlyScan:
3636  _outIndexOnlyScan(str, obj);
3637  break;
3638  case T_BitmapIndexScan:
3639  _outBitmapIndexScan(str, obj);
3640  break;
3641  case T_BitmapHeapScan:
3642  _outBitmapHeapScan(str, obj);
3643  break;
3644  case T_TidScan:
3645  _outTidScan(str, obj);
3646  break;
3647  case T_SubqueryScan:
3648  _outSubqueryScan(str, obj);
3649  break;
3650  case T_FunctionScan:
3651  _outFunctionScan(str, obj);
3652  break;
3653  case T_TableFuncScan:
3654  _outTableFuncScan(str, obj);
3655  break;
3656  case T_ValuesScan:
3657  _outValuesScan(str, obj);
3658  break;
3659  case T_CteScan:
3660  _outCteScan(str, obj);
3661  break;
3662  case T_NamedTuplestoreScan:
3663  _outNamedTuplestoreScan(str, obj);
3664  break;
3665  case T_WorkTableScan:
3666  _outWorkTableScan(str, obj);
3667  break;
3668  case T_ForeignScan:
3669  _outForeignScan(str, obj);
3670  break;
3671  case T_CustomScan:
3672  _outCustomScan(str, obj);
3673  break;
3674  case T_Join:
3675  _outJoin(str, obj);
3676  break;
3677  case T_NestLoop:
3678  _outNestLoop(str, obj);
3679  break;
3680  case T_MergeJoin:
3681  _outMergeJoin(str, obj);
3682  break;
3683  case T_HashJoin:
3684  _outHashJoin(str, obj);
3685  break;
3686  case T_Agg:
3687  _outAgg(str, obj);
3688  break;
3689  case T_WindowAgg:
3690  _outWindowAgg(str, obj);
3691  break;
3692  case T_Group:
3693  _outGroup(str, obj);
3694  break;
3695  case T_Material:
3696  _outMaterial(str, obj);
3697  break;
3698  case T_Sort:
3699  _outSort(str, obj);
3700  break;
3701  case T_Unique:
3702  _outUnique(str, obj);
3703  break;
3704  case T_Hash:
3705  _outHash(str, obj);
3706  break;
3707  case T_SetOp:
3708  _outSetOp(str, obj);
3709  break;
3710  case T_LockRows:
3711  _outLockRows(str, obj);
3712  break;
3713  case T_Limit:
3714  _outLimit(str, obj);
3715  break;
3716  case T_NestLoopParam:
3717  _outNestLoopParam(str, obj);
3718  break;
3719  case T_PlanRowMark:
3720  _outPlanRowMark(str, obj);
3721  break;
3722  case T_PlanInvalItem:
3723  _outPlanInvalItem(str, obj);
3724  break;
3725  case T_Alias:
3726  _outAlias(str, obj);
3727  break;
3728  case T_RangeVar:
3729  _outRangeVar(str, obj);
3730  break;
3731  case T_TableFunc:
3732  _outTableFunc(str, obj);
3733  break;
3734  case T_IntoClause:
3735  _outIntoClause(str, obj);
3736  break;
3737  case T_Var:
3738  _outVar(str, obj);
3739  break;
3740  case T_Const:
3741  _outConst(str, obj);
3742  break;
3743  case T_Param:
3744  _outParam(str, obj);
3745  break;
3746  case T_Aggref:
3747  _outAggref(str, obj);
3748  break;
3749  case T_GroupingFunc:
3750  _outGroupingFunc(str, obj);
3751  break;
3752  case T_WindowFunc:
3753  _outWindowFunc(str, obj);
3754  break;
3755  case T_ArrayRef:
3756  _outArrayRef(str, obj);
3757  break;
3758  case T_FuncExpr:
3759  _outFuncExpr(str, obj);
3760  break;
3761  case T_NamedArgExpr:
3762  _outNamedArgExpr(str, obj);
3763  break;
3764  case T_OpExpr:
3765  _outOpExpr(str, obj);
3766  break;
3767  case T_DistinctExpr:
3768  _outDistinctExpr(str, obj);
3769  break;
3770  case T_NullIfExpr:
3771  _outNullIfExpr(str, obj);
3772  break;
3773  case T_ScalarArrayOpExpr:
3774  _outScalarArrayOpExpr(str, obj);
3775  break;
3776  case T_BoolExpr:
3777  _outBoolExpr(str, obj);
3778  break;
3779  case T_SubLink:
3780  _outSubLink(str, obj);
3781  break;
3782  case T_SubPlan:
3783  _outSubPlan(str, obj);
3784  break;
3785  case T_AlternativeSubPlan:
3786  _outAlternativeSubPlan(str, obj);
3787  break;
3788  case T_FieldSelect:
3789  _outFieldSelect(str, obj);
3790  break;
3791  case T_FieldStore:
3792  _outFieldStore(str, obj);
3793  break;
3794  case T_RelabelType:
3795  _outRelabelType(str, obj);
3796  break;
3797  case T_CoerceViaIO:
3798  _outCoerceViaIO(str, obj);
3799  break;
3800  case T_ArrayCoerceExpr:
3801  _outArrayCoerceExpr(str, obj);
3802  break;
3803  case T_ConvertRowtypeExpr:
3804  _outConvertRowtypeExpr(str, obj);
3805  break;
3806  case T_CollateExpr:
3807  _outCollateExpr(str, obj);
3808  break;
3809  case T_CaseExpr:
3810  _outCaseExpr(str, obj);
3811  break;
3812  case T_CaseWhen:
3813  _outCaseWhen(str, obj);
3814  break;
3815  case T_CaseTestExpr:
3816  _outCaseTestExpr(str, obj);
3817  break;
3818  case T_ArrayExpr:
3819  _outArrayExpr(str, obj);
3820  break;
3821  case T_RowExpr:
3822  _outRowExpr(str, obj);
3823  break;
3824  case T_RowCompareExpr:
3825  _outRowCompareExpr(str, obj);
3826  break;
3827  case T_CoalesceExpr:
3828  _outCoalesceExpr(str, obj);
3829  break;
3830  case T_MinMaxExpr:
3831  _outMinMaxExpr(str, obj);
3832  break;
3833  case T_SQLValueFunction:
3834  _outSQLValueFunction(str, obj);
3835  break;
3836  case T_XmlExpr:
3837  _outXmlExpr(str, obj);
3838  break;
3839  case T_NullTest:
3840  _outNullTest(str, obj);
3841  break;
3842  case T_BooleanTest:
3843  _outBooleanTest(str, obj);
3844  break;
3845  case T_CoerceToDomain:
3846  _outCoerceToDomain(str, obj);
3847  break;
3848  case T_CoerceToDomainValue:
3849  _outCoerceToDomainValue(str, obj);
3850  break;
3851  case T_SetToDefault:
3852  _outSetToDefault(str, obj);
3853  break;
3854  case T_CurrentOfExpr:
3855  _outCurrentOfExpr(str, obj);
3856  break;
3857  case T_InferenceElem:
3858  _outInferenceElem(str, obj);
3859  break;
3860  case T_TargetEntry:
3861  _outTargetEntry(str, obj);
3862  break;
3863  case T_RangeTblRef:
3864  _outRangeTblRef(str, obj);
3865  break;
3866  case T_JoinExpr:
3867  _outJoinExpr(str, obj);
3868  break;
3869  case T_FromExpr:
3870  _outFromExpr(str, obj);
3871  break;
3872  case T_OnConflictExpr:
3873  _outOnConflictExpr(str, obj);
3874  break;
3875  case T_Path:
3876  _outPath(str, obj);
3877  break;
3878  case T_IndexPath:
3879  _outIndexPath(str, obj);
3880  break;
3881  case T_BitmapHeapPath:
3882  _outBitmapHeapPath(str, obj);
3883  break;
3884  case T_BitmapAndPath:
3885  _outBitmapAndPath(str, obj);
3886  break;
3887  case T_BitmapOrPath:
3888  _outBitmapOrPath(str, obj);
3889  break;
3890  case T_TidPath:
3891  _outTidPath(str, obj);
3892  break;
3893  case T_SubqueryScanPath:
3894  _outSubqueryScanPath(str, obj);
3895  break;
3896  case T_ForeignPath:
3897  _outForeignPath(str, obj);
3898  break;
3899  case T_CustomPath:
3900  _outCustomPath(str, obj);
3901  break;
3902  case T_AppendPath:
3903  _outAppendPath(str, obj);
3904  break;
3905  case T_MergeAppendPath:
3906  _outMergeAppendPath(str, obj);
3907  break;
3908  case T_ResultPath:
3909  _outResultPath(str, obj);
3910  break;
3911  case T_MaterialPath:
3912  _outMaterialPath(str, obj);
3913  break;
3914  case T_UniquePath:
3915  _outUniquePath(str, obj);
3916  break;
3917  case T_GatherPath:
3918  _outGatherPath(str, obj);
3919  break;
3920  case T_ProjectionPath:
3921  _outProjectionPath(str, obj);
3922  break;
3923  case T_ProjectSetPath:
3924  _outProjectSetPath(str, obj);
3925  break;
3926  case T_SortPath:
3927  _outSortPath(str, obj);
3928  break;
3929  case T_GroupPath:
3930  _outGroupPath(str, obj);
3931  break;
3932  case T_UpperUniquePath:
3933  _outUpperUniquePath(str, obj);
3934  break;
3935  case T_AggPath:
3936  _outAggPath(str, obj);
3937  break;
3938  case T_GroupingSetsPath:
3939  _outGroupingSetsPath(str, obj);
3940  break;
3941  case T_MinMaxAggPath:
3942  _outMinMaxAggPath(str, obj);
3943  break;
3944  case T_WindowAggPath:
3945  _outWindowAggPath(str, obj);
3946  break;
3947  case T_SetOpPath:
3948  _outSetOpPath(str, obj);
3949  break;
3950  case T_RecursiveUnionPath:
3951  _outRecursiveUnionPath(str, obj);
3952  break;
3953  case T_LockRowsPath:
3954  _outLockRowsPath(str, obj);
3955  break;
3956  case T_ModifyTablePath:
3957  _outModifyTablePath(str, obj);
3958  break;
3959  case T_LimitPath:
3960  _outLimitPath(str, obj);
3961  break;
3962  case T_GatherMergePath:
3963  _outGatherMergePath(str, obj);
3964  break;
3965  case T_NestPath:
3966  _outNestPath(str, obj);
3967  break;
3968  case T_MergePath:
3969  _outMergePath(str, obj);
3970  break;
3971  case T_HashPath:
3972  _outHashPath(str, obj);
3973  break;
3974  case T_PlannerGlobal:
3975  _outPlannerGlobal(str, obj);
3976  break;
3977  case T_PlannerInfo:
3978  _outPlannerInfo(str, obj);
3979  break;
3980  case T_RelOptInfo:
3981  _outRelOptInfo(str, obj);
3982  break;
3983  case T_IndexOptInfo:
3984  _outIndexOptInfo(str, obj);
3985  break;
3986  case T_ForeignKeyOptInfo:
3987  _outForeignKeyOptInfo(str, obj);
3988  break;
3989  case T_EquivalenceClass:
3990  _outEquivalenceClass(str, obj);
3991  break;
3992  case T_EquivalenceMember:
3993  _outEquivalenceMember(str, obj);
3994  break;
3995  case T_PathKey:
3996  _outPathKey(str, obj);
3997  break;
3998  case T_PathTarget:
3999  _outPathTarget(str, obj);
4000  break;
4001  case T_ParamPathInfo:
4002  _outParamPathInfo(str, obj);
4003  break;
4004  case T_RestrictInfo:
4005  _outRestrictInfo(str, obj);
4006  break;
4007  case T_PlaceHolderVar:
4008  _outPlaceHolderVar(str, obj);
4009  break;
4010  case T_SpecialJoinInfo:
4011  _outSpecialJoinInfo(str, obj);
4012  break;
4013  case T_AppendRelInfo:
4014  _outAppendRelInfo(str, obj);
4015  break;
4017  _outPartitionedChildRelInfo(str, obj);
4018  break;
4019  case T_PlaceHolderInfo:
4020  _outPlaceHolderInfo(str, obj);
4021  break;
4022  case T_MinMaxAggInfo:
4023  _outMinMaxAggInfo(str, obj);
4024  break;
4025  case T_PlannerParamItem:
4026  _outPlannerParamItem(str, obj);
4027  break;
4028  case T_RollupData:
4029  _outRollupData(str, obj);
4030  break;
4031  case T_GroupingSetData:
4032  _outGroupingSetData(str, obj);
4033  break;
4034  case T_StatisticExtInfo:
4035  _outStatisticExtInfo(str, obj);
4036  break;
4037  case T_ExtensibleNode:
4038  _outExtensibleNode(str, obj);
4039  break;
4040  case T_CreateStmt:
4041  _outCreateStmt(str, obj);
4042  break;
4044  _outCreateForeignTableStmt(str, obj);
4045  break;
4047  _outImportForeignSchemaStmt(str, obj);
4048  break;
4049  case T_IndexStmt:
4050  _outIndexStmt(str, obj);
4051  break;
4052  case T_CreateStatsStmt:
4053  _outCreateStatsStmt(str, obj);
4054  break;
4055  case T_NotifyStmt:
4056  _outNotifyStmt(str, obj);
4057  break;
4058  case T_DeclareCursorStmt:
4059  _outDeclareCursorStmt(str, obj);
4060  break;
4061  case T_SelectStmt:
4062  _outSelectStmt(str, obj);
4063  break;
4064  case T_ColumnDef:
4065  _outColumnDef(str, obj);
4066  break;
4067  case T_TypeName:
4068  _outTypeName(str, obj);
4069  break;
4070  case T_TypeCast:
4071  _outTypeCast(str, obj);
4072  break;
4073  case T_CollateClause:
4074  _outCollateClause(str, obj);
4075  break;
4076  case T_IndexElem:
4077  _outIndexElem(str, obj);
4078  break;
4079  case T_Query:
4080  _outQuery(str, obj);
4081  break;
4082  case T_WithCheckOption:
4083  _outWithCheckOption(str, obj);
4084  break;
4085  case T_SortGroupClause:
4086  _outSortGroupClause(str, obj);
4087  break;
4088  case T_GroupingSet:
4089  _outGroupingSet(str, obj);
4090  break;
4091  case T_WindowClause:
4092  _outWindowClause(str, obj);
4093  break;
4094  case T_RowMarkClause:
4095  _outRowMarkClause(str, obj);
4096  break;
4097  case T_WithClause:
4098  _outWithClause(str, obj);
4099  break;
4100  case T_CommonTableExpr:
4101  _outCommonTableExpr(str, obj);
4102  break;
4103  case T_SetOperationStmt:
4104  _outSetOperationStmt(str, obj);
4105  break;
4106  case T_RangeTblEntry:
4107  _outRangeTblEntry(str, obj);
4108  break;
4109  case T_RangeTblFunction:
4110  _outRangeTblFunction(str, obj);
4111  break;
4112  case T_TableSampleClause:
4113  _outTableSampleClause(str, obj);
4114  break;
4115  case T_A_Expr:
4116  _outAExpr(str, obj);
4117  break;
4118  case T_ColumnRef:
4119  _outColumnRef(str, obj);
4120  break;
4121  case T_ParamRef:
4122  _outParamRef(str, obj);
4123  break;
4124  case T_A_Const:
4125  _outAConst(str, obj);
4126  break;
4127  case T_A_Star:
4128  _outA_Star(str, obj);
4129  break;
4130  case T_A_Indices:
4131  _outA_Indices(str, obj);
4132  break;
4133  case T_A_Indirection:
4134  _outA_Indirection(str, obj);
4135  break;
4136  case T_A_ArrayExpr:
4137  _outA_ArrayExpr(str, obj);
4138  break;
4139  case T_ResTarget:
4140  _outResTarget(str, obj);
4141  break;
4142  case T_MultiAssignRef:
4143  _outMultiAssignRef(str, obj);
4144  break;
4145  case T_SortBy:
4146  _outSortBy(str, obj);
4147  break;
4148  case T_WindowDef:
4149  _outWindowDef(str, obj);
4150  break;
4151  case T_RangeSubselect:
4152  _outRangeSubselect(str, obj);
4153  break;
4154  case T_RangeFunction:
4155  _outRangeFunction(str, obj);
4156  break;
4157  case T_RangeTableSample:
4158  _outRangeTableSample(str, obj);
4159  break;
4160  case T_RangeTableFunc:
4161  _outRangeTableFunc(str, obj);
4162  break;
4163  case T_RangeTableFuncCol:
4164  _outRangeTableFuncCol(str, obj);
4165  break;
4166  case T_Constraint:
4167  _outConstraint(str, obj);
4168  break;
4169  case T_FuncCall:
4170  _outFuncCall(str, obj);
4171  break;
4172  case T_DefElem:
4173  _outDefElem(str, obj);
4174  break;
4175  case T_TableLikeClause:
4176  _outTableLikeClause(str, obj);
4177  break;
4178  case T_LockingClause:
4179  _outLockingClause(str, obj);
4180  break;
4181  case T_XmlSerialize:
4182  _outXmlSerialize(str, obj);
4183  break;
4184  case T_ForeignKeyCacheInfo:
4185  _outForeignKeyCacheInfo(str, obj);
4186  break;
4187  case T_TriggerTransition:
4188  _outTriggerTransition(str, obj);
4189  break;
4190  case T_PartitionElem:
4191  _outPartitionElem(str, obj);
4192  break;
4193  case T_PartitionSpec:
4194  _outPartitionSpec(str, obj);
4195  break;
4196  case T_PartitionBoundSpec:
4197  _outPartitionBoundSpec(str, obj);
4198  break;
4199  case T_PartitionRangeDatum:
4200  _outPartitionRangeDatum(str, obj);
4201  break;
4202 
4203  default:
4204 
4205  /*
4206  * This should be an ERROR, but it's too useful to be able to
4207  * dump structures that outNode only understands part of.
4208  */
4209  elog(WARNING, "could not dump unrecognized node type: %d",
4210  (int) nodeTag(obj));
4211  break;
4212  }
4213  appendStringInfoChar(str, '}');
4214  }
4215 }
4216 
4217 /*
4218  * nodeToString -
4219  * returns the ascii representation of the Node as a palloc'd string
4220  */
4221 char *
4222 nodeToString(const void *obj)
4223 {
4224  StringInfoData str;
4225 
4226  /* see stringinfo.h for an explanation of this maneuver */
4227  initStringInfo(&str);
4228  outNode(&str, obj);
4229  return str.data;
4230 }
4231 
4232 /*
4233  * bmsToString -
4234  * returns the ascii representation of the Bitmapset as a palloc'd string
4235  */
4236 char *
4238 {
4239  StringInfoData str;
4240 
4241  /* see stringinfo.h for an explanation of this maneuver */
4242  initStringInfo(&str);
4243  outBitmapset(&str, bms);
4244  return str.data;
4245 }
Datum constvalue
Definition: primnodes.h:196
static void _outRangeTableFunc(StringInfo str, const RangeTableFunc *node)
Definition: outfuncs.c:3365
static void _outA_Indices(StringInfo str, const A_Indices *node)
Definition: outfuncs.c:3254
int numCols
Definition: plannodes.h:821
static void _outValue(StringInfo str, const Value *value)
Definition: outfuncs.c:3179
static void _outPlaceHolderInfo(StringInfo str, const PlaceHolderInfo *node)
Definition: outfuncs.c:2495
SortByDir
Definition: parsenodes.h:48
static void _outCaseExpr(StringInfo str, const CaseExpr *node)
Definition: outfuncs.c:1408
int ordNumCols
Definition: plannodes.h:806
static void _outSpecialJoinInfo(StringInfo str, const SpecialJoinInfo *node)
Definition: outfuncs.c:2455
static void _outAppend(StringInfo str, const Append *node)
Definition: outfuncs.c:371
int length(const List *list)
Definition: list.c:1271
int numCols
Definition: plannodes.h:785
static void _outWindowAgg(StringInfo str, const WindowAgg *node)
Definition: outfuncs.c:781
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:955
static void _outRangeSubselect(StringInfo str, const RangeSubselect *node)
Definition: outfuncs.c:3330
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:2971
#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:850
static void _outBitmapAnd(StringInfo str, const BitmapAnd *node)
Definition: outfuncs.c:436
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:2609
AttrNumber * grpColIdx
Definition: plannodes.h:786
ParamKind
Definition: primnodes.h:233
A_Expr_Kind kind
Definition: parsenodes.h:274
bool constbyval
Definition: primnodes.h:199
static void _outTargetEntry(StringInfo str, const TargetEntry *node)
Definition: outfuncs.c: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:597
static void _outMergeJoin(StringInfo str, const MergeJoin *node)
Definition: outfuncs.c:712
static void _outNullTest(StringInfo str, const NullTest *node)
Definition: outfuncs.c:1530
static void _outDefElem(StringInfo str, const DefElem *node)
Definition: outfuncs.c:2708
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:3264
static void _outScan(StringInfo str, const Scan *node)
Definition: outfuncs.c:498
Oid * collations
Definition: plannodes.h:268
static void _outPartitionElem(StringInfo str, const PartitionElem *node)
Definition: outfuncs.c:3520
static void _outUnique(StringInfo str, const Unique *node)
Definition: outfuncs.c:872
long ival
Definition: value.h:47
static void _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
Definition: outfuncs.c:2522
static void _outGroupPath(StringInfo str, const GroupPath *node)
Definition: outfuncs.c:1922
AttrNumber * sortColIdx
Definition: plannodes.h:848
static void _outRelOptInfo(StringInfo str, const RelOptInfo *node)
Definition: outfuncs.c:2215
#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:3315
static void _outRowMarkClause(StringInfo str, const RowMarkClause *node)
Definition: outfuncs.c:2950
static void _outStatisticExtInfo(StringInfo str, const StatisticExtInfo *node)
Definition: outfuncs.c:2320
BoolTestType
Definition: primnodes.h:1195
static void _outCreateStmt(StringInfo str, const CreateStmt *node)
Definition: outfuncs.c:2577
#define WRITE_ENUM_FIELD(fldname, enumtype)
Definition: outfuncs.c:68
AttrNumber * ordColIdx
Definition: plannodes.h:807
static void _outSampleScan(StringInfo str, const SampleScan *node)
Definition: outfuncs.c:514
AttrNumber conkey[INDEX_MAX_KEYS]
Definition: rel.h:243
XmlExprOp
Definition: primnodes.h:1121
int bms_next_member(const Bitmapset *a, int prevbit)
Definition: bitmapset.c:937
static void _outForeignScan(StringInfo str, const ForeignScan *node)
Definition: outfuncs.c:659
RelOptKind
Definition: relation.h:492
static void _outRelabelType(StringInfo str, const RelabelType *node)
Definition: outfuncs.c:1347
QuerySource
Definition: parsenodes.h:38
ParamPathInfo * param_info
Definition: relation.h:957
static void _outTableFuncScan(StringInfo str, const TableFuncScan *node)
Definition: outfuncs.c:608
#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:836
bool * nullsFirst
Definition: plannodes.h:851
static void _outPartitionRangeDatum(StringInfo str, const PartitionRangeDatum *node)
Definition: outfuncs.c:3554
static void _outTableLikeClause(StringInfo str, const TableLikeClause *node)
Definition: outfuncs.c:2720
static void _outSetOp(StringInfo str, const SetOp *node)
Definition: outfuncs.c:904
bool * nullsFirst
Definition: plannodes.h:749
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:577
AttrNumber * dupColIdx
Definition: plannodes.h:882
static void _outNestLoop(StringInfo str, const NestLoop *node)
Definition: outfuncs.c:702
static void _outWithClause(StringInfo str, const WithClause *node)
Definition: outfuncs.c:2961
static void _outCteScan(StringInfo str, const CteScan *node)
Definition: outfuncs.c:628
return result
Definition: formatting.c:1633
static void _outDeclareCursorStmt(StringInfo str, const DeclareCursorStmt *node)
Definition: outfuncs.c:2656
Definition: nodes.h:75
void outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
Definition: outfuncs.c:203
NullTestType
Definition: primnodes.h:1172
static void _outA_Star(StringInfo str, const A_Star *node)
Definition: outfuncs.c:3248
static void _outProjectSet(StringInfo str, const ProjectSet *node)
Definition: outfuncs.c:334
#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:3229
static void _outRangeTableSample(StringInfo str, const RangeTableSample *node)
Definition: outfuncs.c:3353
static void _outConst(StringInfo str, const Const *node)
Definition: outfuncs.c:1067
int numCols
Definition: plannodes.h:880
static void _outGroupingSetsPath(StringInfo str, const GroupingSetsPath *node)
Definition: outfuncs.c:1982
SetOpStrategy
Definition: nodes.h:787
Oid * ordOperators
Definition: plannodes.h:808
Oid * sortOperators
Definition: plannodes.h:747
static void _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
Definition: outfuncs.c:2264
OnCommitAction
Definition: primnodes.h:47
static void _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
Definition: outfuncs.c:2561
static void _outPlanInfo(StringInfo str, const Plan *node)
Definition: outfuncs.c:272
JoinType
Definition: nodes.h:673
static void _outFieldSelect(StringInfo str, const FieldSelect *node)
Definition: outfuncs.c:1324
List * mergeclauses
Definition: plannodes.h:711
static void _outJoinPlanInfo(StringInfo str, const Join *node)
Definition: outfuncs.c:305
static void _outBitmapOr(StringInfo str, const BitmapOr *node)
Definition: outfuncs.c:446
Oid * uniqOperators
Definition: plannodes.h:823
static void _outLockRows(StringInfo str, const LockRows *node)
Definition: outfuncs.c:930
static void _outIndexElem(StringInfo str, const IndexElem *node)
Definition: outfuncs.c:2818
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:649
const struct CustomPathMethods * methods
Definition: relation.h:1163
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:744
SetOperation
Definition: parsenodes.h:1482
MinMaxOp
Definition: primnodes.h:1054
static void _outGroupingFunc(StringInfo str, const GroupingFunc *node)
Definition: outfuncs.c:1124
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
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:2832
#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:2473
static void _outTypeName(StringInfo str, const TypeName *node)
Definition: outfuncs.c:2783
static void _outLimitPath(StringInfo str, const LimitPath *node)
Definition: outfuncs.c:2081
static void _outPlannerInfo(StringInfo str, const PlannerInfo *node)
Definition: outfuncs.c:2163
#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:699
BoolExprType boolop
Definition: primnodes.h:562
Oid * dupOperators
Definition: plannodes.h:883
static void _outPlanRowMark(StringInfo str, const PlanRowMark *node)
Definition: outfuncs.c:961
AttrNumber * dupColIdx
Definition: plannodes.h:287
static void _outGatherMerge(StringInfo str, const GatherMerge *node)
Definition: outfuncs.c:469
static struct @121 value
static void _outExtensibleNode(StringInfo str, const ExtensibleNode *node)
Definition: outfuncs.c:2537
RTEKind
Definition: parsenodes.h:920
RelOptInfo * parent
Definition: relation.h:954
Definition: nodes.h:76
static void _outMinMaxAggInfo(StringInfo str, const MinMaxAggInfo *node)
Definition: outfuncs.c:2508
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:157
static void _outSortBy(StringInfo str, const SortBy *node)
Definition: outfuncs.c:3303
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:540
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:382
static void _outConstraint(StringInfo str, const Constraint *node)
Definition: outfuncs.c:3393
static void _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
Definition: outfuncs.c:413
ScanDirection
Definition: sdir.h:22
static void _outHash(StringInfo str, const Hash *node)
Definition: outfuncs.c:892
const struct CustomScanMethods * methods
Definition: plannodes.h:633
static void _outUniquePath(StringInfo str, const UniquePath *node)
Definition: outfuncs.c:1866
static void _outGroupingSet(StringInfo str, const GroupingSet *node)
Definition: outfuncs.c:2924
Index * sortgrouprefs
Definition: relation.h:885
static void _outPath(StringInfo str, const Path *node)
Definition: outfuncs.c:1720
static void _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
Definition: outfuncs.c:2585
static void _outRecursiveUnionPath(StringInfo str, const RecursiveUnionPath *node)
Definition: outfuncs.c:2034
Relids relids
Definition: relation.h:525
int partNumCols
Definition: plannodes.h:803
int numCols
Definition: plannodes.h:761
static void _outPathKey(StringInfo str, const PathKey *node)
Definition: outfuncs.c:2372
const char * CustomName
Definition: extensible.h:107
static void _outValuesScan(StringInfo str, const ValuesScan *node)
Definition: outfuncs.c:618
#define WRITE_FLOAT_FIELD(fldname, format)
Definition: outfuncs.c:73
WCOKind
Definition: parsenodes.h:1097
#define lnext(lc)
Definition: pg_list.h:105
static void _outSetToDefault(StringInfo str, const SetToDefault *node)
Definition: outfuncs.c:1575
SQLValueFunctionOp
Definition: primnodes.h:1082
static void _outJoinPathInfo(StringInfo str, const JoinPath *node)
Definition: outfuncs.c:1708
static void _outIndexScan(StringInfo str, const IndexScan *node)
Definition: outfuncs.c:524
static void _outUpperUniquePath(StringInfo str, const UpperUniquePath *node)
Definition: outfuncs.c:1934
Definition: nodes.h:147
SubLinkType
Definition: primnodes.h:618
AttrNumber * uniqColIdx
Definition: plannodes.h:822
static void _outSeqScan(StringInfo str, const SeqScan *node)
Definition: outfuncs.c:506
void appendStringInfoChar(StringInfo str, char ch)
Definition: stringinfo.c:169
void initStringInfo(StringInfo str)
Definition: stringinfo.c:46
static void _outTypeCast(StringInfo str, const TypeCast *node)
Definition: outfuncs.c:2798
struct EquivalenceClass * eclass[INDEX_MAX_KEYS]
Definition: relation.h:706
Oid * sortOperators
Definition: plannodes.h:849
static void _outRangeFunction(StringInfo str, const RangeFunction *node)
Definition: outfuncs.c:3340
void outNode(StringInfo str, const void *obj)
Definition: outfuncs.c:3568
#define WARNING
Definition: elog.h:40
int numCols
Definition: plannodes.h:745
Definition: nodes.h:146
List * exprs
Definition: relation.h:884
static void _outSelectStmt(StringInfo str, const SelectStmt *node)
Definition: outfuncs.c:2666
static void _outResult(StringInfo str, const Result *node)
Definition: outfuncs.c:324
static void _outModifyTable(StringInfo str, const ModifyTable *node)
Definition: outfuncs.c:342
static void _outBitmapHeapScan(StringInfo str, const BitmapHeapScan *node)
Definition: outfuncs.c:567
static void _outJoin(StringInfo str, const Join *node)
Definition: outfuncs.c:694
Definition: nodes.h:304
static void _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
Definition: outfuncs.c:2359
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:2934
AttrNumber conkey[INDEX_MAX_KEYS]
Definition: relation.h:697
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:2912
static void _outAgg(StringInfo str, const Agg *node)
Definition: outfuncs.c:754
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:713
static void _outArrayCoerceExpr(StringInfo str, const ArrayCoerceExpr *node)
Definition: outfuncs.c:1372
Oid * mergeCollations
Definition: plannodes.h:714
#define WRITE_CHAR_FIELD(fldname)
Definition: outfuncs.c:64
static void _outTableSampleClause(StringInfo str, const TableSampleClause *node)
Definition: outfuncs.c:3087
AttrNumber * partColIdx
Definition: plannodes.h:804
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:294
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:2271
static void _outColumnRef(StringInfo str, const ColumnRef *node)
Definition: outfuncs.c:3220
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:1017
static void _outNotifyStmt(StringInfo str, const NotifyStmt *node)
Definition: outfuncs.c:2647
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:805
bool * mergeNullsFirst
Definition: plannodes.h:716
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:2289
static void _outList(StringInfo str, const List *node)
Definition: outfuncs.c:144
#define NULL
Definition: c.h:229
int * mergeStrategies
Definition: plannodes.h:715
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:3282
Definition: value.h:42
static void _outMultiAssignRef(StringInfo str, const MultiAssignRef *node)
Definition: outfuncs.c:3293
#define WRITE_NODE_TYPE(nodelabel)
Definition: outfuncs.c:44
static void _outWithCheckOption(StringInfo str, const WithCheckOption *node)
Definition: outfuncs.c:2900
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:266
XmlOptionType
Definition: primnodes.h:1133
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:757
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:950
Oid * dupOperators
Definition: plannodes.h:288
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:3532
static void _outCreateStatsStmt(StringInfo str, const CreateStatsStmt *node)
Definition: outfuncs.c:2635
static void _outAExpr(StringInfo str, const A_Expr *node)
Definition: outfuncs.c:3097
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:2808
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:3379
const char * name
Definition: encode.c:521
static void _outAConst(StringInfo str, const A_Const *node)
Definition: outfuncs.c:3238
#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:269
static void _outImportForeignSchemaStmt(StringInfo str, const ImportForeignSchemaStmt *node)
Definition: outfuncs.c:2596
#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:746
RTEKind rtekind
Definition: parsenodes.h:936
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:4237
Definition: nodes.h:83
Definition: nodes.h:283
static void _outTriggerTransition(StringInfo str, const TriggerTransition *node)
Definition: outfuncs.c:2750
NodeTag type
Definition: pg_list.h:47
AggStrategy
Definition: nodes.h:735
static void _outMaterialPath(StringInfo str, const MaterialPath *node)
Definition: outfuncs.c:1856
static void _outColumnDef(StringInfo str, const ColumnDef *node)
Definition: outfuncs.c:2760
Oid * grpOperators
Definition: plannodes.h:787
static void _outGroup(StringInfo str, const Group *node)
Definition: outfuncs.c:816
int xmloption
Definition: xml.c:97
SetOpCmd
Definition: nodes.h:779
static void _outXmlSerialize(StringInfo str, const XmlSerialize *node)
Definition: outfuncs.c:2739
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:762
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:554
char * nodeToString(const void *obj)
Definition: outfuncs.c:4222
ConstrType contype
Definition: parsenodes.h:2065
DefElemAction
Definition: parsenodes.h:707
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:2444
GroupingSetKind
Definition: parsenodes.h:1233
static void _outPathTarget(StringInfo str, const PathTarget *node)
Definition: outfuncs.c:2383
static void _outCaseTestExpr(StringInfo str, const CaseTestExpr *node)
Definition: outfuncs.c:1431
UniquePathMethod
Definition: relation.h:1241
static void _outNamedTuplestoreScan(StringInfo str, const NamedTuplestoreScan *node)
Definition: outfuncs.c:639
Oid * sortOperators
Definition: plannodes.h:267
Relids ppi_req_outer
Definition: relation.h:913