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