LCOV - code coverage report
Current view: top level - src/backend/nodes - outfuncs.c (source / functions) Hit Total Coverage
Test: PostgreSQL 13beta1 Lines: 1537 2993 51.4 %
Date: 2020-06-03 08:06:29 Functions: 123 229 53.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13