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

Generated by: LCOV version 1.11