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