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

Generated by: LCOV version 1.13