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