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