LCOV - code coverage report
Current view: top level - src/backend/nodes - readfuncs.c (source / functions) Hit Total Coverage
Test: PostgreSQL Lines: 954 1378 69.2 %
Date: 2017-09-29 15:12:54 Functions: 76 124 61.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * readfuncs.c
       4             :  *    Reader functions for Postgres tree nodes.
       5             :  *
       6             :  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
       7             :  * Portions Copyright (c) 1994, Regents of the University of California
       8             :  *
       9             :  *
      10             :  * IDENTIFICATION
      11             :  *    src/backend/nodes/readfuncs.c
      12             :  *
      13             :  * NOTES
      14             :  *    Path nodes do not have any readfuncs support, because we never
      15             :  *    have occasion to read them in.  (There was once code here that
      16             :  *    claimed to read them, but it was broken as well as unused.)  We
      17             :  *    never read executor state trees, either.
      18             :  *
      19             :  *    Parse location fields are written out by outfuncs.c, but only for
      20             :  *    possible debugging use.  When reading a location field, we discard
      21             :  *    the stored value and set the location field to -1 (ie, "unknown").
      22             :  *    This is because nodes coming from a stored rule should not be thought
      23             :  *    to have a known location in the current query's text.
      24             :  *
      25             :  *-------------------------------------------------------------------------
      26             :  */
      27             : #include "postgres.h"
      28             : 
      29             : #include <math.h>
      30             : 
      31             : #include "fmgr.h"
      32             : #include "nodes/extensible.h"
      33             : #include "nodes/parsenodes.h"
      34             : #include "nodes/plannodes.h"
      35             : #include "nodes/readfuncs.h"
      36             : 
      37             : 
      38             : /*
      39             :  * Macros to simplify reading of different kinds of fields.  Use these
      40             :  * wherever possible to reduce the chance for silly typos.  Note that these
      41             :  * hard-wire conventions about the names of the local variables in a Read
      42             :  * routine.
      43             :  */
      44             : 
      45             : /* Macros for declaring appropriate local variables */
      46             : 
      47             : /* A few guys need only local_node */
      48             : #define READ_LOCALS_NO_FIELDS(nodeTypeName) \
      49             :     nodeTypeName *local_node = makeNode(nodeTypeName)
      50             : 
      51             : /* And a few guys need only the pg_strtok support fields */
      52             : #define READ_TEMP_LOCALS()  \
      53             :     char       *token;      \
      54             :     int         length
      55             : 
      56             : /* ... but most need both */
      57             : #define READ_LOCALS(nodeTypeName)           \
      58             :     READ_LOCALS_NO_FIELDS(nodeTypeName);    \
      59             :     READ_TEMP_LOCALS()
      60             : 
      61             : /* Read an integer field (anything written as ":fldname %d") */
      62             : #define READ_INT_FIELD(fldname) \
      63             :     token = pg_strtok(&length);     /* skip :fldname */ \
      64             :     token = pg_strtok(&length);     /* get field value */ \
      65             :     local_node->fldname = atoi(token)
      66             : 
      67             : /* Read an unsigned integer field (anything written as ":fldname %u") */
      68             : #define READ_UINT_FIELD(fldname) \
      69             :     token = pg_strtok(&length);     /* skip :fldname */ \
      70             :     token = pg_strtok(&length);     /* get field value */ \
      71             :     local_node->fldname = atoui(token)
      72             : 
      73             : /* Read an long integer field (anything written as ":fldname %ld") */
      74             : #define READ_LONG_FIELD(fldname) \
      75             :     token = pg_strtok(&length);     /* skip :fldname */ \
      76             :     token = pg_strtok(&length);     /* get field value */ \
      77             :     local_node->fldname = atol(token)
      78             : 
      79             : /* Read an OID field (don't hard-wire assumption that OID is same as uint) */
      80             : #define READ_OID_FIELD(fldname) \
      81             :     token = pg_strtok(&length);     /* skip :fldname */ \
      82             :     token = pg_strtok(&length);     /* get field value */ \
      83             :     local_node->fldname = atooid(token)
      84             : 
      85             : /* Read a char field (ie, one ascii character) */
      86             : #define READ_CHAR_FIELD(fldname) \
      87             :     token = pg_strtok(&length);     /* skip :fldname */ \
      88             :     token = pg_strtok(&length);     /* get field value */ \
      89             :     /* avoid overhead of calling debackslash() for one char */ \
      90             :     local_node->fldname = (length == 0) ? '\0' : (token[0] == '\\' ? token[1] : token[0])
      91             : 
      92             : /* Read an enumerated-type field that was written as an integer code */
      93             : #define READ_ENUM_FIELD(fldname, enumtype) \
      94             :     token = pg_strtok(&length);     /* skip :fldname */ \
      95             :     token = pg_strtok(&length);     /* get field value */ \
      96             :     local_node->fldname = (enumtype) atoi(token)
      97             : 
      98             : /* Read a float field */
      99             : #define READ_FLOAT_FIELD(fldname) \
     100             :     token = pg_strtok(&length);     /* skip :fldname */ \
     101             :     token = pg_strtok(&length);     /* get field value */ \
     102             :     local_node->fldname = atof(token)
     103             : 
     104             : /* Read a boolean field */
     105             : #define READ_BOOL_FIELD(fldname) \
     106             :     token = pg_strtok(&length);     /* skip :fldname */ \
     107             :     token = pg_strtok(&length);     /* get field value */ \
     108             :     local_node->fldname = strtobool(token)
     109             : 
     110             : /* Read a character-string field */
     111             : #define READ_STRING_FIELD(fldname) \
     112             :     token = pg_strtok(&length);     /* skip :fldname */ \
     113             :     token = pg_strtok(&length);     /* get field value */ \
     114             :     local_node->fldname = nullable_string(token, length)
     115             : 
     116             : /* Read a parse location field (and throw away the value, per notes above) */
     117             : #define READ_LOCATION_FIELD(fldname) \
     118             :     token = pg_strtok(&length);     /* skip :fldname */ \
     119             :     token = pg_strtok(&length);     /* get field value */ \
     120             :     (void) token;               /* in case not used elsewhere */ \
     121             :     local_node->fldname = -1 /* set field to "unknown" */
     122             : 
     123             : /* Read a Node field */
     124             : #define READ_NODE_FIELD(fldname) \
     125             :     token = pg_strtok(&length);     /* skip :fldname */ \
     126             :     (void) token;               /* in case not used elsewhere */ \
     127             :     local_node->fldname = nodeRead(NULL, 0)
     128             : 
     129             : /* Read a bitmapset field */
     130             : #define READ_BITMAPSET_FIELD(fldname) \
     131             :     token = pg_strtok(&length);     /* skip :fldname */ \
     132             :     (void) token;               /* in case not used elsewhere */ \
     133             :     local_node->fldname = _readBitmapset()
     134             : 
     135             : /* Read an attribute number array */
     136             : #define READ_ATTRNUMBER_ARRAY(fldname, len) \
     137             :     token = pg_strtok(&length);     /* skip :fldname */ \
     138             :     local_node->fldname = readAttrNumberCols(len);
     139             : 
     140             : /* Read an oid array */
     141             : #define READ_OID_ARRAY(fldname, len) \
     142             :     token = pg_strtok(&length);     /* skip :fldname */ \
     143             :     local_node->fldname = readOidCols(len);
     144             : 
     145             : /* Read an int array */
     146             : #define READ_INT_ARRAY(fldname, len) \
     147             :     token = pg_strtok(&length);     /* skip :fldname */ \
     148             :     local_node->fldname = readIntCols(len);
     149             : 
     150             : /* Read a bool array */
     151             : #define READ_BOOL_ARRAY(fldname, len) \
     152             :     token = pg_strtok(&length);     /* skip :fldname */ \
     153             :     local_node->fldname = readBoolCols(len);
     154             : 
     155             : /* Routine exit */
     156             : #define READ_DONE() \
     157             :     return local_node
     158             : 
     159             : 
     160             : /*
     161             :  * NOTE: use atoi() to read values written with %d, or atoui() to read
     162             :  * values written with %u in outfuncs.c.  An exception is OID values,
     163             :  * for which use atooid().  (As of 7.1, outfuncs.c writes OIDs as %u,
     164             :  * but this will probably change in the future.)
     165             :  */
     166             : #define atoui(x)  ((unsigned int) strtoul((x), NULL, 10))
     167             : 
     168             : #define strtobool(x)  ((*(x) == 't') ? true : false)
     169             : 
     170             : #define nullable_string(token,length)  \
     171             :     ((length) == 0 ? NULL : debackslash(token, length))
     172             : 
     173             : 
     174             : /*
     175             :  * _readBitmapset
     176             :  */
     177             : static Bitmapset *
     178       17298 : _readBitmapset(void)
     179             : {
     180       17298 :     Bitmapset  *result = NULL;
     181             : 
     182             :     READ_TEMP_LOCALS();
     183             : 
     184       17298 :     token = pg_strtok(&length);
     185       17298 :     if (token == NULL)
     186           0 :         elog(ERROR, "incomplete Bitmapset structure");
     187       17298 :     if (length != 1 || token[0] != '(')
     188           0 :         elog(ERROR, "unrecognized token: \"%.*s\"", length, token);
     189             : 
     190       17298 :     token = pg_strtok(&length);
     191       17298 :     if (token == NULL)
     192           0 :         elog(ERROR, "incomplete Bitmapset structure");
     193       17298 :     if (length != 1 || token[0] != 'b')
     194           0 :         elog(ERROR, "unrecognized token: \"%.*s\"", length, token);
     195             : 
     196             :     for (;;)
     197             :     {
     198             :         int         val;
     199             :         char       *endptr;
     200             : 
     201       23622 :         token = pg_strtok(&length);
     202       23622 :         if (token == NULL)
     203           0 :             elog(ERROR, "unterminated Bitmapset structure");
     204       23622 :         if (length == 1 && token[0] == ')')
     205       17298 :             break;
     206        6324 :         val = (int) strtol(token, &endptr, 10);
     207        6324 :         if (endptr != token + length)
     208           0 :             elog(ERROR, "unrecognized integer: \"%.*s\"", length, token);
     209        6324 :         result = bms_add_member(result, val);
     210        6324 :     }
     211             : 
     212       34596 :     return result;
     213             : }
     214             : 
     215             : /*
     216             :  * for use by extensions which define extensible nodes
     217             :  */
     218             : Bitmapset *
     219           0 : readBitmapset(void)
     220             : {
     221           0 :     return _readBitmapset();
     222             : }
     223             : 
     224             : /*
     225             :  * _readQuery
     226             :  */
     227             : static Query *
     228        1661 : _readQuery(void)
     229             : {
     230        1661 :     READ_LOCALS(Query);
     231             : 
     232        1661 :     READ_ENUM_FIELD(commandType, CmdType);
     233        1661 :     READ_ENUM_FIELD(querySource, QuerySource);
     234        1661 :     local_node->queryId = 0; /* not saved in output format */
     235        1661 :     READ_BOOL_FIELD(canSetTag);
     236        1661 :     READ_NODE_FIELD(utilityStmt);
     237        1661 :     READ_INT_FIELD(resultRelation);
     238        1661 :     READ_BOOL_FIELD(hasAggs);
     239        1661 :     READ_BOOL_FIELD(hasWindowFuncs);
     240        1661 :     READ_BOOL_FIELD(hasTargetSRFs);
     241        1661 :     READ_BOOL_FIELD(hasSubLinks);
     242        1661 :     READ_BOOL_FIELD(hasDistinctOn);
     243        1661 :     READ_BOOL_FIELD(hasRecursive);
     244        1661 :     READ_BOOL_FIELD(hasModifyingCTE);
     245        1661 :     READ_BOOL_FIELD(hasForUpdate);
     246        1661 :     READ_BOOL_FIELD(hasRowSecurity);
     247        1661 :     READ_NODE_FIELD(cteList);
     248        1661 :     READ_NODE_FIELD(rtable);
     249        1661 :     READ_NODE_FIELD(jointree);
     250        1661 :     READ_NODE_FIELD(targetList);
     251        1661 :     READ_ENUM_FIELD(override, OverridingKind);
     252        1661 :     READ_NODE_FIELD(onConflict);
     253        1661 :     READ_NODE_FIELD(returningList);
     254        1661 :     READ_NODE_FIELD(groupClause);
     255        1661 :     READ_NODE_FIELD(groupingSets);
     256        1661 :     READ_NODE_FIELD(havingQual);
     257        1661 :     READ_NODE_FIELD(windowClause);
     258        1661 :     READ_NODE_FIELD(distinctClause);
     259        1661 :     READ_NODE_FIELD(sortClause);
     260        1661 :     READ_NODE_FIELD(limitOffset);
     261        1661 :     READ_NODE_FIELD(limitCount);
     262        1661 :     READ_NODE_FIELD(rowMarks);
     263        1661 :     READ_NODE_FIELD(setOperations);
     264        1661 :     READ_NODE_FIELD(constraintDeps);
     265             :     /* withCheckOptions intentionally omitted, see comment in parsenodes.h */
     266        1661 :     READ_LOCATION_FIELD(stmt_location);
     267        1661 :     READ_LOCATION_FIELD(stmt_len);
     268             : 
     269        1661 :     READ_DONE();
     270             : }
     271             : 
     272             : /*
     273             :  * _readNotifyStmt
     274             :  */
     275             : static NotifyStmt *
     276           5 : _readNotifyStmt(void)
     277             : {
     278           5 :     READ_LOCALS(NotifyStmt);
     279             : 
     280           5 :     READ_STRING_FIELD(conditionname);
     281           5 :     READ_STRING_FIELD(payload);
     282             : 
     283           5 :     READ_DONE();
     284             : }
     285             : 
     286             : /*
     287             :  * _readDeclareCursorStmt
     288             :  */
     289             : static DeclareCursorStmt *
     290           0 : _readDeclareCursorStmt(void)
     291             : {
     292           0 :     READ_LOCALS(DeclareCursorStmt);
     293             : 
     294           0 :     READ_STRING_FIELD(portalname);
     295           0 :     READ_INT_FIELD(options);
     296           0 :     READ_NODE_FIELD(query);
     297             : 
     298           0 :     READ_DONE();
     299             : }
     300             : 
     301             : /*
     302             :  * _readWithCheckOption
     303             :  */
     304             : static WithCheckOption *
     305           0 : _readWithCheckOption(void)
     306             : {
     307           0 :     READ_LOCALS(WithCheckOption);
     308             : 
     309           0 :     READ_ENUM_FIELD(kind, WCOKind);
     310           0 :     READ_STRING_FIELD(relname);
     311           0 :     READ_STRING_FIELD(polname);
     312           0 :     READ_NODE_FIELD(qual);
     313           0 :     READ_BOOL_FIELD(cascaded);
     314             : 
     315           0 :     READ_DONE();
     316             : }
     317             : 
     318             : /*
     319             :  * _readSortGroupClause
     320             :  */
     321             : static SortGroupClause *
     322         229 : _readSortGroupClause(void)
     323             : {
     324         229 :     READ_LOCALS(SortGroupClause);
     325             : 
     326         229 :     READ_UINT_FIELD(tleSortGroupRef);
     327         229 :     READ_OID_FIELD(eqop);
     328         229 :     READ_OID_FIELD(sortop);
     329         229 :     READ_BOOL_FIELD(nulls_first);
     330         229 :     READ_BOOL_FIELD(hashable);
     331             : 
     332         229 :     READ_DONE();
     333             : }
     334             : 
     335             : /*
     336             :  * _readGroupingSet
     337             :  */
     338             : static GroupingSet *
     339           6 : _readGroupingSet(void)
     340             : {
     341           6 :     READ_LOCALS(GroupingSet);
     342             : 
     343           6 :     READ_ENUM_FIELD(kind, GroupingSetKind);
     344           6 :     READ_NODE_FIELD(content);
     345           6 :     READ_LOCATION_FIELD(location);
     346             : 
     347           6 :     READ_DONE();
     348             : }
     349             : 
     350             : /*
     351             :  * _readWindowClause
     352             :  */
     353             : static WindowClause *
     354           3 : _readWindowClause(void)
     355             : {
     356           3 :     READ_LOCALS(WindowClause);
     357             : 
     358           3 :     READ_STRING_FIELD(name);
     359           3 :     READ_STRING_FIELD(refname);
     360           3 :     READ_NODE_FIELD(partitionClause);
     361           3 :     READ_NODE_FIELD(orderClause);
     362           3 :     READ_INT_FIELD(frameOptions);
     363           3 :     READ_NODE_FIELD(startOffset);
     364           3 :     READ_NODE_FIELD(endOffset);
     365           3 :     READ_UINT_FIELD(winref);
     366           3 :     READ_BOOL_FIELD(copiedOrder);
     367             : 
     368           3 :     READ_DONE();
     369             : }
     370             : 
     371             : /*
     372             :  * _readRowMarkClause
     373             :  */
     374             : static RowMarkClause *
     375           0 : _readRowMarkClause(void)
     376             : {
     377           0 :     READ_LOCALS(RowMarkClause);
     378             : 
     379           0 :     READ_UINT_FIELD(rti);
     380           0 :     READ_ENUM_FIELD(strength, LockClauseStrength);
     381           0 :     READ_ENUM_FIELD(waitPolicy, LockWaitPolicy);
     382           0 :     READ_BOOL_FIELD(pushedDown);
     383             : 
     384           0 :     READ_DONE();
     385             : }
     386             : 
     387             : /*
     388             :  * _readCommonTableExpr
     389             :  */
     390             : static CommonTableExpr *
     391          10 : _readCommonTableExpr(void)
     392             : {
     393          10 :     READ_LOCALS(CommonTableExpr);
     394             : 
     395          10 :     READ_STRING_FIELD(ctename);
     396          10 :     READ_NODE_FIELD(aliascolnames);
     397          10 :     READ_NODE_FIELD(ctequery);
     398          10 :     READ_LOCATION_FIELD(location);
     399          10 :     READ_BOOL_FIELD(cterecursive);
     400          10 :     READ_INT_FIELD(cterefcount);
     401          10 :     READ_NODE_FIELD(ctecolnames);
     402          10 :     READ_NODE_FIELD(ctecoltypes);
     403          10 :     READ_NODE_FIELD(ctecoltypmods);
     404          10 :     READ_NODE_FIELD(ctecolcollations);
     405             : 
     406          10 :     READ_DONE();
     407             : }
     408             : 
     409             : /*
     410             :  * _readSetOperationStmt
     411             :  */
     412             : static SetOperationStmt *
     413          82 : _readSetOperationStmt(void)
     414             : {
     415          82 :     READ_LOCALS(SetOperationStmt);
     416             : 
     417          82 :     READ_ENUM_FIELD(op, SetOperation);
     418          82 :     READ_BOOL_FIELD(all);
     419          82 :     READ_NODE_FIELD(larg);
     420          82 :     READ_NODE_FIELD(rarg);
     421          82 :     READ_NODE_FIELD(colTypes);
     422          82 :     READ_NODE_FIELD(colTypmods);
     423          82 :     READ_NODE_FIELD(colCollations);
     424          82 :     READ_NODE_FIELD(groupClauses);
     425             : 
     426          82 :     READ_DONE();
     427             : }
     428             : 
     429             : 
     430             : /*
     431             :  *  Stuff from primnodes.h.
     432             :  */
     433             : 
     434             : static Alias *
     435        9088 : _readAlias(void)
     436             : {
     437        9088 :     READ_LOCALS(Alias);
     438             : 
     439        9088 :     READ_STRING_FIELD(aliasname);
     440        9088 :     READ_NODE_FIELD(colnames);
     441             : 
     442        9088 :     READ_DONE();
     443             : }
     444             : 
     445             : static RangeVar *
     446           0 : _readRangeVar(void)
     447             : {
     448           0 :     READ_LOCALS(RangeVar);
     449             : 
     450           0 :     local_node->catalogname = NULL; /* not currently saved in output format */
     451             : 
     452           0 :     READ_STRING_FIELD(schemaname);
     453           0 :     READ_STRING_FIELD(relname);
     454           0 :     READ_BOOL_FIELD(inh);
     455           0 :     READ_CHAR_FIELD(relpersistence);
     456           0 :     READ_NODE_FIELD(alias);
     457           0 :     READ_LOCATION_FIELD(location);
     458             : 
     459           0 :     READ_DONE();
     460             : }
     461             : 
     462             : /*
     463             :  * _readTableFunc
     464             :  */
     465             : static TableFunc *
     466           2 : _readTableFunc(void)
     467             : {
     468           2 :     READ_LOCALS(TableFunc);
     469             : 
     470           2 :     READ_NODE_FIELD(ns_uris);
     471           2 :     READ_NODE_FIELD(ns_names);
     472           2 :     READ_NODE_FIELD(docexpr);
     473           2 :     READ_NODE_FIELD(rowexpr);
     474           2 :     READ_NODE_FIELD(colnames);
     475           2 :     READ_NODE_FIELD(coltypes);
     476           2 :     READ_NODE_FIELD(coltypmods);
     477           2 :     READ_NODE_FIELD(colcollations);
     478           2 :     READ_NODE_FIELD(colexprs);
     479           2 :     READ_NODE_FIELD(coldefexprs);
     480           2 :     READ_BITMAPSET_FIELD(notnulls);
     481           2 :     READ_INT_FIELD(ordinalitycol);
     482           2 :     READ_LOCATION_FIELD(location);
     483             : 
     484           2 :     READ_DONE();
     485             : }
     486             : 
     487             : static IntoClause *
     488           0 : _readIntoClause(void)
     489             : {
     490           0 :     READ_LOCALS(IntoClause);
     491             : 
     492           0 :     READ_NODE_FIELD(rel);
     493           0 :     READ_NODE_FIELD(colNames);
     494           0 :     READ_NODE_FIELD(options);
     495           0 :     READ_ENUM_FIELD(onCommit, OnCommitAction);
     496           0 :     READ_STRING_FIELD(tableSpaceName);
     497           0 :     READ_NODE_FIELD(viewQuery);
     498           0 :     READ_BOOL_FIELD(skipData);
     499             : 
     500           0 :     READ_DONE();
     501             : }
     502             : 
     503             : /*
     504             :  * _readVar
     505             :  */
     506             : static Var *
     507       24567 : _readVar(void)
     508             : {
     509       24567 :     READ_LOCALS(Var);
     510             : 
     511       24567 :     READ_UINT_FIELD(varno);
     512       24567 :     READ_INT_FIELD(varattno);
     513       24567 :     READ_OID_FIELD(vartype);
     514       24567 :     READ_INT_FIELD(vartypmod);
     515       24567 :     READ_OID_FIELD(varcollid);
     516       24567 :     READ_UINT_FIELD(varlevelsup);
     517       24567 :     READ_UINT_FIELD(varnoold);
     518       24567 :     READ_INT_FIELD(varoattno);
     519       24567 :     READ_LOCATION_FIELD(location);
     520             : 
     521       24567 :     READ_DONE();
     522             : }
     523             : 
     524             : /*
     525             :  * _readConst
     526             :  */
     527             : static Const *
     528        7833 : _readConst(void)
     529             : {
     530        7833 :     READ_LOCALS(Const);
     531             : 
     532        7833 :     READ_OID_FIELD(consttype);
     533        7833 :     READ_INT_FIELD(consttypmod);
     534        7833 :     READ_OID_FIELD(constcollid);
     535        7833 :     READ_INT_FIELD(constlen);
     536        7833 :     READ_BOOL_FIELD(constbyval);
     537        7833 :     READ_BOOL_FIELD(constisnull);
     538        7833 :     READ_LOCATION_FIELD(location);
     539             : 
     540        7833 :     token = pg_strtok(&length); /* skip :constvalue */
     541        7833 :     if (local_node->constisnull)
     542         480 :         token = pg_strtok(&length); /* skip "<>" */
     543             :     else
     544        7353 :         local_node->constvalue = readDatum(local_node->constbyval);
     545             : 
     546        7833 :     READ_DONE();
     547             : }
     548             : 
     549             : /*
     550             :  * _readParam
     551             :  */
     552             : static Param *
     553          25 : _readParam(void)
     554             : {
     555          25 :     READ_LOCALS(Param);
     556             : 
     557          25 :     READ_ENUM_FIELD(paramkind, ParamKind);
     558          25 :     READ_INT_FIELD(paramid);
     559          25 :     READ_OID_FIELD(paramtype);
     560          25 :     READ_INT_FIELD(paramtypmod);
     561          25 :     READ_OID_FIELD(paramcollid);
     562          25 :     READ_LOCATION_FIELD(location);
     563             : 
     564          25 :     READ_DONE();
     565             : }
     566             : 
     567             : /*
     568             :  * _readAggref
     569             :  */
     570             : static Aggref *
     571         201 : _readAggref(void)
     572             : {
     573         201 :     READ_LOCALS(Aggref);
     574             : 
     575         201 :     READ_OID_FIELD(aggfnoid);
     576         201 :     READ_OID_FIELD(aggtype);
     577         201 :     READ_OID_FIELD(aggcollid);
     578         201 :     READ_OID_FIELD(inputcollid);
     579         201 :     READ_OID_FIELD(aggtranstype);
     580         201 :     READ_NODE_FIELD(aggargtypes);
     581         201 :     READ_NODE_FIELD(aggdirectargs);
     582         201 :     READ_NODE_FIELD(args);
     583         201 :     READ_NODE_FIELD(aggorder);
     584         201 :     READ_NODE_FIELD(aggdistinct);
     585         201 :     READ_NODE_FIELD(aggfilter);
     586         201 :     READ_BOOL_FIELD(aggstar);
     587         201 :     READ_BOOL_FIELD(aggvariadic);
     588         201 :     READ_CHAR_FIELD(aggkind);
     589         201 :     READ_UINT_FIELD(agglevelsup);
     590         201 :     READ_ENUM_FIELD(aggsplit, AggSplit);
     591         201 :     READ_LOCATION_FIELD(location);
     592             : 
     593         201 :     READ_DONE();
     594             : }
     595             : 
     596             : /*
     597             :  * _readGroupingFunc
     598             :  */
     599             : static GroupingFunc *
     600           2 : _readGroupingFunc(void)
     601             : {
     602           2 :     READ_LOCALS(GroupingFunc);
     603             : 
     604           2 :     READ_NODE_FIELD(args);
     605           2 :     READ_NODE_FIELD(refs);
     606           2 :     READ_NODE_FIELD(cols);
     607           2 :     READ_UINT_FIELD(agglevelsup);
     608           2 :     READ_LOCATION_FIELD(location);
     609             : 
     610           2 :     READ_DONE();
     611             : }
     612             : 
     613             : /*
     614             :  * _readWindowFunc
     615             :  */
     616             : static WindowFunc *
     617           3 : _readWindowFunc(void)
     618             : {
     619           3 :     READ_LOCALS(WindowFunc);
     620             : 
     621           3 :     READ_OID_FIELD(winfnoid);
     622           3 :     READ_OID_FIELD(wintype);
     623           3 :     READ_OID_FIELD(wincollid);
     624           3 :     READ_OID_FIELD(inputcollid);
     625           3 :     READ_NODE_FIELD(args);
     626           3 :     READ_NODE_FIELD(aggfilter);
     627           3 :     READ_UINT_FIELD(winref);
     628           3 :     READ_BOOL_FIELD(winstar);
     629           3 :     READ_BOOL_FIELD(winagg);
     630           3 :     READ_LOCATION_FIELD(location);
     631             : 
     632           3 :     READ_DONE();
     633             : }
     634             : 
     635             : /*
     636             :  * _readArrayRef
     637             :  */
     638             : static ArrayRef *
     639         113 : _readArrayRef(void)
     640             : {
     641         113 :     READ_LOCALS(ArrayRef);
     642             : 
     643         113 :     READ_OID_FIELD(refarraytype);
     644         113 :     READ_OID_FIELD(refelemtype);
     645         113 :     READ_INT_FIELD(reftypmod);
     646         113 :     READ_OID_FIELD(refcollid);
     647         113 :     READ_NODE_FIELD(refupperindexpr);
     648         113 :     READ_NODE_FIELD(reflowerindexpr);
     649         113 :     READ_NODE_FIELD(refexpr);
     650         113 :     READ_NODE_FIELD(refassgnexpr);
     651             : 
     652         113 :     READ_DONE();
     653             : }
     654             : 
     655             : /*
     656             :  * _readFuncExpr
     657             :  */
     658             : static FuncExpr *
     659        2381 : _readFuncExpr(void)
     660             : {
     661        2381 :     READ_LOCALS(FuncExpr);
     662             : 
     663        2381 :     READ_OID_FIELD(funcid);
     664        2381 :     READ_OID_FIELD(funcresulttype);
     665        2381 :     READ_BOOL_FIELD(funcretset);
     666        2381 :     READ_BOOL_FIELD(funcvariadic);
     667        2381 :     READ_ENUM_FIELD(funcformat, CoercionForm);
     668        2381 :     READ_OID_FIELD(funccollid);
     669        2381 :     READ_OID_FIELD(inputcollid);
     670        2381 :     READ_NODE_FIELD(args);
     671        2381 :     READ_LOCATION_FIELD(location);
     672             : 
     673        2381 :     READ_DONE();
     674             : }
     675             : 
     676             : /*
     677             :  * _readNamedArgExpr
     678             :  */
     679             : static NamedArgExpr *
     680           6 : _readNamedArgExpr(void)
     681             : {
     682           6 :     READ_LOCALS(NamedArgExpr);
     683             : 
     684           6 :     READ_NODE_FIELD(arg);
     685           6 :     READ_STRING_FIELD(name);
     686           6 :     READ_INT_FIELD(argnumber);
     687           6 :     READ_LOCATION_FIELD(location);
     688             : 
     689           6 :     READ_DONE();
     690             : }
     691             : 
     692             : /*
     693             :  * _readOpExpr
     694             :  */
     695             : static OpExpr *
     696        3141 : _readOpExpr(void)
     697             : {
     698        3141 :     READ_LOCALS(OpExpr);
     699             : 
     700        3141 :     READ_OID_FIELD(opno);
     701        3141 :     READ_OID_FIELD(opfuncid);
     702        3141 :     READ_OID_FIELD(opresulttype);
     703        3141 :     READ_BOOL_FIELD(opretset);
     704        3141 :     READ_OID_FIELD(opcollid);
     705        3141 :     READ_OID_FIELD(inputcollid);
     706        3141 :     READ_NODE_FIELD(args);
     707        3141 :     READ_LOCATION_FIELD(location);
     708             : 
     709        3141 :     READ_DONE();
     710             : }
     711             : 
     712             : /*
     713             :  * _readDistinctExpr
     714             :  */
     715             : static DistinctExpr *
     716           2 : _readDistinctExpr(void)
     717             : {
     718           2 :     READ_LOCALS(DistinctExpr);
     719             : 
     720           2 :     READ_OID_FIELD(opno);
     721           2 :     READ_OID_FIELD(opfuncid);
     722           2 :     READ_OID_FIELD(opresulttype);
     723           2 :     READ_BOOL_FIELD(opretset);
     724           2 :     READ_OID_FIELD(opcollid);
     725           2 :     READ_OID_FIELD(inputcollid);
     726           2 :     READ_NODE_FIELD(args);
     727           2 :     READ_LOCATION_FIELD(location);
     728             : 
     729           2 :     READ_DONE();
     730             : }
     731             : 
     732             : /*
     733             :  * _readNullIfExpr
     734             :  */
     735             : static NullIfExpr *
     736           2 : _readNullIfExpr(void)
     737             : {
     738           2 :     READ_LOCALS(NullIfExpr);
     739             : 
     740           2 :     READ_OID_FIELD(opno);
     741           2 :     READ_OID_FIELD(opfuncid);
     742           2 :     READ_OID_FIELD(opresulttype);
     743           2 :     READ_BOOL_FIELD(opretset);
     744           2 :     READ_OID_FIELD(opcollid);
     745           2 :     READ_OID_FIELD(inputcollid);
     746           2 :     READ_NODE_FIELD(args);
     747           2 :     READ_LOCATION_FIELD(location);
     748             : 
     749           2 :     READ_DONE();
     750             : }
     751             : 
     752             : /*
     753             :  * _readScalarArrayOpExpr
     754             :  */
     755             : static ScalarArrayOpExpr *
     756         154 : _readScalarArrayOpExpr(void)
     757             : {
     758         154 :     READ_LOCALS(ScalarArrayOpExpr);
     759             : 
     760         154 :     READ_OID_FIELD(opno);
     761         154 :     READ_OID_FIELD(opfuncid);
     762         154 :     READ_BOOL_FIELD(useOr);
     763         154 :     READ_OID_FIELD(inputcollid);
     764         154 :     READ_NODE_FIELD(args);
     765         154 :     READ_LOCATION_FIELD(location);
     766             : 
     767         154 :     READ_DONE();
     768             : }
     769             : 
     770             : /*
     771             :  * _readBoolExpr
     772             :  */
     773             : static BoolExpr *
     774         542 : _readBoolExpr(void)
     775             : {
     776         542 :     READ_LOCALS(BoolExpr);
     777             : 
     778             :     /* do-it-yourself enum representation */
     779         542 :     token = pg_strtok(&length); /* skip :boolop */
     780         542 :     token = pg_strtok(&length); /* get field value */
     781         542 :     if (strncmp(token, "and", 3) == 0)
     782         391 :         local_node->boolop = AND_EXPR;
     783         151 :     else if (strncmp(token, "or", 2) == 0)
     784          97 :         local_node->boolop = OR_EXPR;
     785          54 :     else if (strncmp(token, "not", 3) == 0)
     786          54 :         local_node->boolop = NOT_EXPR;
     787             :     else
     788           0 :         elog(ERROR, "unrecognized boolop \"%.*s\"", length, token);
     789             : 
     790         542 :     READ_NODE_FIELD(args);
     791         542 :     READ_LOCATION_FIELD(location);
     792             : 
     793         542 :     READ_DONE();
     794             : }
     795             : 
     796             : /*
     797             :  * _readSubLink
     798             :  */
     799             : static SubLink *
     800         164 : _readSubLink(void)
     801             : {
     802         164 :     READ_LOCALS(SubLink);
     803             : 
     804         164 :     READ_ENUM_FIELD(subLinkType, SubLinkType);
     805         164 :     READ_INT_FIELD(subLinkId);
     806         164 :     READ_NODE_FIELD(testexpr);
     807         164 :     READ_NODE_FIELD(operName);
     808         164 :     READ_NODE_FIELD(subselect);
     809         164 :     READ_LOCATION_FIELD(location);
     810             : 
     811         164 :     READ_DONE();
     812             : }
     813             : 
     814             : /*
     815             :  * _readSubPlan is not needed since it doesn't appear in stored rules.
     816             :  */
     817             : 
     818             : /*
     819             :  * _readFieldSelect
     820             :  */
     821             : static FieldSelect *
     822          98 : _readFieldSelect(void)
     823             : {
     824          98 :     READ_LOCALS(FieldSelect);
     825             : 
     826          98 :     READ_NODE_FIELD(arg);
     827          98 :     READ_INT_FIELD(fieldnum);
     828          98 :     READ_OID_FIELD(resulttype);
     829          98 :     READ_INT_FIELD(resulttypmod);
     830          98 :     READ_OID_FIELD(resultcollid);
     831             : 
     832          98 :     READ_DONE();
     833             : }
     834             : 
     835             : /*
     836             :  * _readFieldStore
     837             :  */
     838             : static FieldStore *
     839          28 : _readFieldStore(void)
     840             : {
     841          28 :     READ_LOCALS(FieldStore);
     842             : 
     843          28 :     READ_NODE_FIELD(arg);
     844          28 :     READ_NODE_FIELD(newvals);
     845          28 :     READ_NODE_FIELD(fieldnums);
     846          28 :     READ_OID_FIELD(resulttype);
     847             : 
     848          28 :     READ_DONE();
     849             : }
     850             : 
     851             : /*
     852             :  * _readRelabelType
     853             :  */
     854             : static RelabelType *
     855         184 : _readRelabelType(void)
     856             : {
     857         184 :     READ_LOCALS(RelabelType);
     858             : 
     859         184 :     READ_NODE_FIELD(arg);
     860         184 :     READ_OID_FIELD(resulttype);
     861         184 :     READ_INT_FIELD(resulttypmod);
     862         184 :     READ_OID_FIELD(resultcollid);
     863         184 :     READ_ENUM_FIELD(relabelformat, CoercionForm);
     864         184 :     READ_LOCATION_FIELD(location);
     865             : 
     866         184 :     READ_DONE();
     867             : }
     868             : 
     869             : /*
     870             :  * _readCoerceViaIO
     871             :  */
     872             : static CoerceViaIO *
     873          80 : _readCoerceViaIO(void)
     874             : {
     875          80 :     READ_LOCALS(CoerceViaIO);
     876             : 
     877          80 :     READ_NODE_FIELD(arg);
     878          80 :     READ_OID_FIELD(resulttype);
     879          80 :     READ_OID_FIELD(resultcollid);
     880          80 :     READ_ENUM_FIELD(coerceformat, CoercionForm);
     881          80 :     READ_LOCATION_FIELD(location);
     882             : 
     883          80 :     READ_DONE();
     884             : }
     885             : 
     886             : /*
     887             :  * _readArrayCoerceExpr
     888             :  */
     889             : static ArrayCoerceExpr *
     890          58 : _readArrayCoerceExpr(void)
     891             : {
     892          58 :     READ_LOCALS(ArrayCoerceExpr);
     893             : 
     894          58 :     READ_NODE_FIELD(arg);
     895          58 :     READ_OID_FIELD(elemfuncid);
     896          58 :     READ_OID_FIELD(resulttype);
     897          58 :     READ_INT_FIELD(resulttypmod);
     898          58 :     READ_OID_FIELD(resultcollid);
     899          58 :     READ_BOOL_FIELD(isExplicit);
     900          58 :     READ_ENUM_FIELD(coerceformat, CoercionForm);
     901          58 :     READ_LOCATION_FIELD(location);
     902             : 
     903          58 :     READ_DONE();
     904             : }
     905             : 
     906             : /*
     907             :  * _readConvertRowtypeExpr
     908             :  */
     909             : static ConvertRowtypeExpr *
     910           0 : _readConvertRowtypeExpr(void)
     911             : {
     912           0 :     READ_LOCALS(ConvertRowtypeExpr);
     913             : 
     914           0 :     READ_NODE_FIELD(arg);
     915           0 :     READ_OID_FIELD(resulttype);
     916           0 :     READ_ENUM_FIELD(convertformat, CoercionForm);
     917           0 :     READ_LOCATION_FIELD(location);
     918             : 
     919           0 :     READ_DONE();
     920             : }
     921             : 
     922             : /*
     923             :  * _readCollateExpr
     924             :  */
     925             : static CollateExpr *
     926           8 : _readCollateExpr(void)
     927             : {
     928           8 :     READ_LOCALS(CollateExpr);
     929             : 
     930           8 :     READ_NODE_FIELD(arg);
     931           8 :     READ_OID_FIELD(collOid);
     932           8 :     READ_LOCATION_FIELD(location);
     933             : 
     934           8 :     READ_DONE();
     935             : }
     936             : 
     937             : /*
     938             :  * _readCaseExpr
     939             :  */
     940             : static CaseExpr *
     941         212 : _readCaseExpr(void)
     942             : {
     943         212 :     READ_LOCALS(CaseExpr);
     944             : 
     945         212 :     READ_OID_FIELD(casetype);
     946         212 :     READ_OID_FIELD(casecollid);
     947         212 :     READ_NODE_FIELD(arg);
     948         212 :     READ_NODE_FIELD(args);
     949         212 :     READ_NODE_FIELD(defresult);
     950         212 :     READ_LOCATION_FIELD(location);
     951             : 
     952         212 :     READ_DONE();
     953             : }
     954             : 
     955             : /*
     956             :  * _readCaseWhen
     957             :  */
     958             : static CaseWhen *
     959         477 : _readCaseWhen(void)
     960             : {
     961         477 :     READ_LOCALS(CaseWhen);
     962             : 
     963         477 :     READ_NODE_FIELD(expr);
     964         477 :     READ_NODE_FIELD(result);
     965         477 :     READ_LOCATION_FIELD(location);
     966             : 
     967         477 :     READ_DONE();
     968             : }
     969             : 
     970             : /*
     971             :  * _readCaseTestExpr
     972             :  */
     973             : static CaseTestExpr *
     974          69 : _readCaseTestExpr(void)
     975             : {
     976          69 :     READ_LOCALS(CaseTestExpr);
     977             : 
     978          69 :     READ_OID_FIELD(typeId);
     979          69 :     READ_INT_FIELD(typeMod);
     980          69 :     READ_OID_FIELD(collation);
     981             : 
     982          69 :     READ_DONE();
     983             : }
     984             : 
     985             : /*
     986             :  * _readArrayExpr
     987             :  */
     988             : static ArrayExpr *
     989         163 : _readArrayExpr(void)
     990             : {
     991         163 :     READ_LOCALS(ArrayExpr);
     992             : 
     993         163 :     READ_OID_FIELD(array_typeid);
     994         163 :     READ_OID_FIELD(array_collid);
     995         163 :     READ_OID_FIELD(element_typeid);
     996         163 :     READ_NODE_FIELD(elements);
     997         163 :     READ_BOOL_FIELD(multidims);
     998         163 :     READ_LOCATION_FIELD(location);
     999             : 
    1000         163 :     READ_DONE();
    1001             : }
    1002             : 
    1003             : /*
    1004             :  * _readRowExpr
    1005             :  */
    1006             : static RowExpr *
    1007           2 : _readRowExpr(void)
    1008             : {
    1009           2 :     READ_LOCALS(RowExpr);
    1010             : 
    1011           2 :     READ_NODE_FIELD(args);
    1012           2 :     READ_OID_FIELD(row_typeid);
    1013           2 :     READ_ENUM_FIELD(row_format, CoercionForm);
    1014           2 :     READ_NODE_FIELD(colnames);
    1015           2 :     READ_LOCATION_FIELD(location);
    1016             : 
    1017           2 :     READ_DONE();
    1018             : }
    1019             : 
    1020             : /*
    1021             :  * _readRowCompareExpr
    1022             :  */
    1023             : static RowCompareExpr *
    1024           0 : _readRowCompareExpr(void)
    1025             : {
    1026           0 :     READ_LOCALS(RowCompareExpr);
    1027             : 
    1028           0 :     READ_ENUM_FIELD(rctype, RowCompareType);
    1029           0 :     READ_NODE_FIELD(opnos);
    1030           0 :     READ_NODE_FIELD(opfamilies);
    1031           0 :     READ_NODE_FIELD(inputcollids);
    1032           0 :     READ_NODE_FIELD(largs);
    1033           0 :     READ_NODE_FIELD(rargs);
    1034             : 
    1035           0 :     READ_DONE();
    1036             : }
    1037             : 
    1038             : /*
    1039             :  * _readCoalesceExpr
    1040             :  */
    1041             : static CoalesceExpr *
    1042          90 : _readCoalesceExpr(void)
    1043             : {
    1044          90 :     READ_LOCALS(CoalesceExpr);
    1045             : 
    1046          90 :     READ_OID_FIELD(coalescetype);
    1047          90 :     READ_OID_FIELD(coalescecollid);
    1048          90 :     READ_NODE_FIELD(args);
    1049          90 :     READ_LOCATION_FIELD(location);
    1050             : 
    1051          90 :     READ_DONE();
    1052             : }
    1053             : 
    1054             : /*
    1055             :  * _readMinMaxExpr
    1056             :  */
    1057             : static MinMaxExpr *
    1058           2 : _readMinMaxExpr(void)
    1059             : {
    1060           2 :     READ_LOCALS(MinMaxExpr);
    1061             : 
    1062           2 :     READ_OID_FIELD(minmaxtype);
    1063           2 :     READ_OID_FIELD(minmaxcollid);
    1064           2 :     READ_OID_FIELD(inputcollid);
    1065           2 :     READ_ENUM_FIELD(op, MinMaxOp);
    1066           2 :     READ_NODE_FIELD(args);
    1067           2 :     READ_LOCATION_FIELD(location);
    1068             : 
    1069           2 :     READ_DONE();
    1070             : }
    1071             : 
    1072             : /*
    1073             :  * _readSQLValueFunction
    1074             :  */
    1075             : static SQLValueFunction *
    1076          76 : _readSQLValueFunction(void)
    1077             : {
    1078          76 :     READ_LOCALS(SQLValueFunction);
    1079             : 
    1080          76 :     READ_ENUM_FIELD(op, SQLValueFunctionOp);
    1081          76 :     READ_OID_FIELD(type);
    1082          76 :     READ_INT_FIELD(typmod);
    1083          76 :     READ_LOCATION_FIELD(location);
    1084             : 
    1085          76 :     READ_DONE();
    1086             : }
    1087             : 
    1088             : /*
    1089             :  * _readXmlExpr
    1090             :  */
    1091             : static XmlExpr *
    1092           2 : _readXmlExpr(void)
    1093             : {
    1094           2 :     READ_LOCALS(XmlExpr);
    1095             : 
    1096           2 :     READ_ENUM_FIELD(op, XmlExprOp);
    1097           2 :     READ_STRING_FIELD(name);
    1098           2 :     READ_NODE_FIELD(named_args);
    1099           2 :     READ_NODE_FIELD(arg_names);
    1100           2 :     READ_NODE_FIELD(args);
    1101           2 :     READ_ENUM_FIELD(xmloption, XmlOptionType);
    1102           2 :     READ_OID_FIELD(type);
    1103           2 :     READ_INT_FIELD(typmod);
    1104           2 :     READ_LOCATION_FIELD(location);
    1105             : 
    1106           2 :     READ_DONE();
    1107             : }
    1108             : 
    1109             : /*
    1110             :  * _readNullTest
    1111             :  */
    1112             : static NullTest *
    1113          36 : _readNullTest(void)
    1114             : {
    1115          36 :     READ_LOCALS(NullTest);
    1116             : 
    1117          36 :     READ_NODE_FIELD(arg);
    1118          36 :     READ_ENUM_FIELD(nulltesttype, NullTestType);
    1119          36 :     READ_BOOL_FIELD(argisrow);
    1120          36 :     READ_LOCATION_FIELD(location);
    1121             : 
    1122          36 :     READ_DONE();
    1123             : }
    1124             : 
    1125             : /*
    1126             :  * _readBooleanTest
    1127             :  */
    1128             : static BooleanTest *
    1129           0 : _readBooleanTest(void)
    1130             : {
    1131           0 :     READ_LOCALS(BooleanTest);
    1132             : 
    1133           0 :     READ_NODE_FIELD(arg);
    1134           0 :     READ_ENUM_FIELD(booltesttype, BoolTestType);
    1135           0 :     READ_LOCATION_FIELD(location);
    1136             : 
    1137           0 :     READ_DONE();
    1138             : }
    1139             : 
    1140             : /*
    1141             :  * _readCoerceToDomain
    1142             :  */
    1143             : static CoerceToDomain *
    1144         676 : _readCoerceToDomain(void)
    1145             : {
    1146         676 :     READ_LOCALS(CoerceToDomain);
    1147             : 
    1148         676 :     READ_NODE_FIELD(arg);
    1149         676 :     READ_OID_FIELD(resulttype);
    1150         676 :     READ_INT_FIELD(resulttypmod);
    1151         676 :     READ_OID_FIELD(resultcollid);
    1152         676 :     READ_ENUM_FIELD(coercionformat, CoercionForm);
    1153         676 :     READ_LOCATION_FIELD(location);
    1154             : 
    1155         676 :     READ_DONE();
    1156             : }
    1157             : 
    1158             : /*
    1159             :  * _readCoerceToDomainValue
    1160             :  */
    1161             : static CoerceToDomainValue *
    1162         204 : _readCoerceToDomainValue(void)
    1163             : {
    1164         204 :     READ_LOCALS(CoerceToDomainValue);
    1165             : 
    1166         204 :     READ_OID_FIELD(typeId);
    1167         204 :     READ_INT_FIELD(typeMod);
    1168         204 :     READ_OID_FIELD(collation);
    1169         204 :     READ_LOCATION_FIELD(location);
    1170             : 
    1171         204 :     READ_DONE();
    1172             : }
    1173             : 
    1174             : /*
    1175             :  * _readSetToDefault
    1176             :  */
    1177             : static SetToDefault *
    1178           0 : _readSetToDefault(void)
    1179             : {
    1180           0 :     READ_LOCALS(SetToDefault);
    1181             : 
    1182           0 :     READ_OID_FIELD(typeId);
    1183           0 :     READ_INT_FIELD(typeMod);
    1184           0 :     READ_OID_FIELD(collation);
    1185           0 :     READ_LOCATION_FIELD(location);
    1186             : 
    1187           0 :     READ_DONE();
    1188             : }
    1189             : 
    1190             : /*
    1191             :  * _readCurrentOfExpr
    1192             :  */
    1193             : static CurrentOfExpr *
    1194           0 : _readCurrentOfExpr(void)
    1195             : {
    1196           0 :     READ_LOCALS(CurrentOfExpr);
    1197             : 
    1198           0 :     READ_UINT_FIELD(cvarno);
    1199           0 :     READ_STRING_FIELD(cursor_name);
    1200           0 :     READ_INT_FIELD(cursor_param);
    1201             : 
    1202           0 :     READ_DONE();
    1203             : }
    1204             : 
    1205             : /*
    1206             :  * _readNextValueExpr
    1207             :  */
    1208             : static NextValueExpr *
    1209           0 : _readNextValueExpr(void)
    1210             : {
    1211           0 :     READ_LOCALS(NextValueExpr);
    1212             : 
    1213           0 :     READ_OID_FIELD(seqid);
    1214           0 :     READ_OID_FIELD(typeId);
    1215             : 
    1216           0 :     READ_DONE();
    1217             : }
    1218             : 
    1219             : /*
    1220             :  * _readInferenceElem
    1221             :  */
    1222             : static InferenceElem *
    1223           6 : _readInferenceElem(void)
    1224             : {
    1225           6 :     READ_LOCALS(InferenceElem);
    1226             : 
    1227           6 :     READ_NODE_FIELD(expr);
    1228           6 :     READ_OID_FIELD(infercollid);
    1229           6 :     READ_OID_FIELD(inferopclass);
    1230             : 
    1231           6 :     READ_DONE();
    1232             : }
    1233             : 
    1234             : /*
    1235             :  * _readTargetEntry
    1236             :  */
    1237             : static TargetEntry *
    1238        6786 : _readTargetEntry(void)
    1239             : {
    1240        6786 :     READ_LOCALS(TargetEntry);
    1241             : 
    1242        6786 :     READ_NODE_FIELD(expr);
    1243        6786 :     READ_INT_FIELD(resno);
    1244        6786 :     READ_STRING_FIELD(resname);
    1245        6786 :     READ_UINT_FIELD(ressortgroupref);
    1246        6786 :     READ_OID_FIELD(resorigtbl);
    1247        6786 :     READ_INT_FIELD(resorigcol);
    1248        6786 :     READ_BOOL_FIELD(resjunk);
    1249             : 
    1250        6786 :     READ_DONE();
    1251             : }
    1252             : 
    1253             : /*
    1254             :  * _readRangeTblRef
    1255             :  */
    1256             : static RangeTblRef *
    1257        2186 : _readRangeTblRef(void)
    1258             : {
    1259        2186 :     READ_LOCALS(RangeTblRef);
    1260             : 
    1261        2186 :     READ_INT_FIELD(rtindex);
    1262             : 
    1263        2186 :     READ_DONE();
    1264             : }
    1265             : 
    1266             : /*
    1267             :  * _readJoinExpr
    1268             :  */
    1269             : static JoinExpr *
    1270         418 : _readJoinExpr(void)
    1271             : {
    1272         418 :     READ_LOCALS(JoinExpr);
    1273             : 
    1274         418 :     READ_ENUM_FIELD(jointype, JoinType);
    1275         418 :     READ_BOOL_FIELD(isNatural);
    1276         418 :     READ_NODE_FIELD(larg);
    1277         418 :     READ_NODE_FIELD(rarg);
    1278         418 :     READ_NODE_FIELD(usingClause);
    1279         418 :     READ_NODE_FIELD(quals);
    1280         418 :     READ_NODE_FIELD(alias);
    1281         418 :     READ_INT_FIELD(rtindex);
    1282             : 
    1283         418 :     READ_DONE();
    1284             : }
    1285             : 
    1286             : /*
    1287             :  * _readFromExpr
    1288             :  */
    1289             : static FromExpr *
    1290        1656 : _readFromExpr(void)
    1291             : {
    1292        1656 :     READ_LOCALS(FromExpr);
    1293             : 
    1294        1656 :     READ_NODE_FIELD(fromlist);
    1295        1656 :     READ_NODE_FIELD(quals);
    1296             : 
    1297        1656 :     READ_DONE();
    1298             : }
    1299             : 
    1300             : /*
    1301             :  * _readOnConflictExpr
    1302             :  */
    1303             : static OnConflictExpr *
    1304           8 : _readOnConflictExpr(void)
    1305             : {
    1306           8 :     READ_LOCALS(OnConflictExpr);
    1307             : 
    1308           8 :     READ_ENUM_FIELD(action, OnConflictAction);
    1309           8 :     READ_NODE_FIELD(arbiterElems);
    1310           8 :     READ_NODE_FIELD(arbiterWhere);
    1311           8 :     READ_OID_FIELD(constraint);
    1312           8 :     READ_NODE_FIELD(onConflictSet);
    1313           8 :     READ_NODE_FIELD(onConflictWhere);
    1314           8 :     READ_INT_FIELD(exclRelIndex);
    1315           8 :     READ_NODE_FIELD(exclRelTlist);
    1316             : 
    1317           8 :     READ_DONE();
    1318             : }
    1319             : 
    1320             : /*
    1321             :  *  Stuff from parsenodes.h.
    1322             :  */
    1323             : 
    1324             : /*
    1325             :  * _readRangeTblEntry
    1326             :  */
    1327             : static RangeTblEntry *
    1328        5478 : _readRangeTblEntry(void)
    1329             : {
    1330        5478 :     READ_LOCALS(RangeTblEntry);
    1331             : 
    1332             :     /* put alias + eref first to make dump more legible */
    1333        5478 :     READ_NODE_FIELD(alias);
    1334        5478 :     READ_NODE_FIELD(eref);
    1335        5478 :     READ_ENUM_FIELD(rtekind, RTEKind);
    1336             : 
    1337        5478 :     switch (local_node->rtekind)
    1338             :     {
    1339             :         case RTE_RELATION:
    1340        4452 :             READ_OID_FIELD(relid);
    1341        4452 :             READ_CHAR_FIELD(relkind);
    1342        4452 :             READ_NODE_FIELD(tablesample);
    1343        4452 :             break;
    1344             :         case RTE_SUBQUERY:
    1345         302 :             READ_NODE_FIELD(subquery);
    1346         302 :             READ_BOOL_FIELD(security_barrier);
    1347         302 :             break;
    1348             :         case RTE_JOIN:
    1349         454 :             READ_ENUM_FIELD(jointype, JoinType);
    1350         454 :             READ_NODE_FIELD(joinaliasvars);
    1351         454 :             break;
    1352             :         case RTE_FUNCTION:
    1353         133 :             READ_NODE_FIELD(functions);
    1354         133 :             READ_BOOL_FIELD(funcordinality);
    1355         133 :             break;
    1356             :         case RTE_TABLEFUNC:
    1357           2 :             READ_NODE_FIELD(tablefunc);
    1358           2 :             break;
    1359             :         case RTE_VALUES:
    1360         116 :             READ_NODE_FIELD(values_lists);
    1361         116 :             READ_NODE_FIELD(coltypes);
    1362         116 :             READ_NODE_FIELD(coltypmods);
    1363         116 :             READ_NODE_FIELD(colcollations);
    1364         116 :             break;
    1365             :         case RTE_CTE:
    1366          19 :             READ_STRING_FIELD(ctename);
    1367          19 :             READ_UINT_FIELD(ctelevelsup);
    1368          19 :             READ_BOOL_FIELD(self_reference);
    1369          19 :             READ_NODE_FIELD(coltypes);
    1370          19 :             READ_NODE_FIELD(coltypmods);
    1371          19 :             READ_NODE_FIELD(colcollations);
    1372          19 :             break;
    1373             :         case RTE_NAMEDTUPLESTORE:
    1374           0 :             READ_STRING_FIELD(enrname);
    1375           0 :             READ_FLOAT_FIELD(enrtuples);
    1376           0 :             READ_OID_FIELD(relid);
    1377           0 :             READ_NODE_FIELD(coltypes);
    1378           0 :             READ_NODE_FIELD(coltypmods);
    1379           0 :             READ_NODE_FIELD(colcollations);
    1380           0 :             break;
    1381             :         default:
    1382           0 :             elog(ERROR, "unrecognized RTE kind: %d",
    1383             :                  (int) local_node->rtekind);
    1384             :             break;
    1385             :     }
    1386             : 
    1387        5478 :     READ_BOOL_FIELD(lateral);
    1388        5478 :     READ_BOOL_FIELD(inh);
    1389        5478 :     READ_BOOL_FIELD(inFromCl);
    1390        5478 :     READ_UINT_FIELD(requiredPerms);
    1391        5478 :     READ_OID_FIELD(checkAsUser);
    1392        5478 :     READ_BITMAPSET_FIELD(selectedCols);
    1393        5478 :     READ_BITMAPSET_FIELD(insertedCols);
    1394        5478 :     READ_BITMAPSET_FIELD(updatedCols);
    1395        5478 :     READ_NODE_FIELD(securityQuals);
    1396             : 
    1397        5478 :     READ_DONE();
    1398             : }
    1399             : 
    1400             : /*
    1401             :  * _readRangeTblFunction
    1402             :  */
    1403             : static RangeTblFunction *
    1404         152 : _readRangeTblFunction(void)
    1405             : {
    1406         152 :     READ_LOCALS(RangeTblFunction);
    1407             : 
    1408         152 :     READ_NODE_FIELD(funcexpr);
    1409         152 :     READ_INT_FIELD(funccolcount);
    1410         152 :     READ_NODE_FIELD(funccolnames);
    1411         152 :     READ_NODE_FIELD(funccoltypes);
    1412         152 :     READ_NODE_FIELD(funccoltypmods);
    1413         152 :     READ_NODE_FIELD(funccolcollations);
    1414         152 :     READ_BITMAPSET_FIELD(funcparams);
    1415             : 
    1416         152 :     READ_DONE();
    1417             : }
    1418             : 
    1419             : /*
    1420             :  * _readTableSampleClause
    1421             :  */
    1422             : static TableSampleClause *
    1423           8 : _readTableSampleClause(void)
    1424             : {
    1425           8 :     READ_LOCALS(TableSampleClause);
    1426             : 
    1427           8 :     READ_OID_FIELD(tsmhandler);
    1428           8 :     READ_NODE_FIELD(args);
    1429           8 :     READ_NODE_FIELD(repeatable);
    1430             : 
    1431           8 :     READ_DONE();
    1432             : }
    1433             : 
    1434             : /*
    1435             :  * _readDefElem
    1436             :  */
    1437             : static DefElem *
    1438           0 : _readDefElem(void)
    1439             : {
    1440           0 :     READ_LOCALS(DefElem);
    1441             : 
    1442           0 :     READ_STRING_FIELD(defnamespace);
    1443           0 :     READ_STRING_FIELD(defname);
    1444           0 :     READ_NODE_FIELD(arg);
    1445           0 :     READ_ENUM_FIELD(defaction, DefElemAction);
    1446           0 :     READ_LOCATION_FIELD(location);
    1447             : 
    1448           0 :     READ_DONE();
    1449             : }
    1450             : 
    1451             : /*
    1452             :  * _readPlannedStmt
    1453             :  */
    1454             : static PlannedStmt *
    1455         115 : _readPlannedStmt(void)
    1456             : {
    1457         115 :     READ_LOCALS(PlannedStmt);
    1458             : 
    1459         115 :     READ_ENUM_FIELD(commandType, CmdType);
    1460         115 :     READ_UINT_FIELD(queryId);
    1461         115 :     READ_BOOL_FIELD(hasReturning);
    1462         115 :     READ_BOOL_FIELD(hasModifyingCTE);
    1463         115 :     READ_BOOL_FIELD(canSetTag);
    1464         115 :     READ_BOOL_FIELD(transientPlan);
    1465         115 :     READ_BOOL_FIELD(dependsOnRole);
    1466         115 :     READ_BOOL_FIELD(parallelModeNeeded);
    1467         115 :     READ_NODE_FIELD(planTree);
    1468         115 :     READ_NODE_FIELD(rtable);
    1469         115 :     READ_NODE_FIELD(resultRelations);
    1470         115 :     READ_NODE_FIELD(nonleafResultRelations);
    1471         115 :     READ_NODE_FIELD(rootResultRelations);
    1472         115 :     READ_NODE_FIELD(subplans);
    1473         115 :     READ_BITMAPSET_FIELD(rewindPlanIDs);
    1474         115 :     READ_NODE_FIELD(rowMarks);
    1475         115 :     READ_NODE_FIELD(relationOids);
    1476         115 :     READ_NODE_FIELD(invalItems);
    1477         115 :     READ_INT_FIELD(nParamExec);
    1478         115 :     READ_NODE_FIELD(utilityStmt);
    1479         115 :     READ_LOCATION_FIELD(stmt_location);
    1480         115 :     READ_LOCATION_FIELD(stmt_len);
    1481             : 
    1482         115 :     READ_DONE();
    1483             : }
    1484             : 
    1485             : /*
    1486             :  * ReadCommonPlan
    1487             :  *  Assign the basic stuff of all nodes that inherit from Plan
    1488             :  */
    1489             : static void
    1490         265 : ReadCommonPlan(Plan *local_node)
    1491             : {
    1492             :     READ_TEMP_LOCALS();
    1493             : 
    1494         265 :     READ_FLOAT_FIELD(startup_cost);
    1495         265 :     READ_FLOAT_FIELD(total_cost);
    1496         265 :     READ_FLOAT_FIELD(plan_rows);
    1497         265 :     READ_INT_FIELD(plan_width);
    1498         265 :     READ_BOOL_FIELD(parallel_aware);
    1499         265 :     READ_BOOL_FIELD(parallel_safe);
    1500         265 :     READ_INT_FIELD(plan_node_id);
    1501         265 :     READ_NODE_FIELD(targetlist);
    1502         265 :     READ_NODE_FIELD(qual);
    1503         265 :     READ_NODE_FIELD(lefttree);
    1504         265 :     READ_NODE_FIELD(righttree);
    1505         265 :     READ_NODE_FIELD(initPlan);
    1506         265 :     READ_BITMAPSET_FIELD(extParam);
    1507         265 :     READ_BITMAPSET_FIELD(allParam);
    1508         265 : }
    1509             : 
    1510             : /*
    1511             :  * _readPlan
    1512             :  */
    1513             : static Plan *
    1514           0 : _readPlan(void)
    1515             : {
    1516           0 :     READ_LOCALS_NO_FIELDS(Plan);
    1517             : 
    1518           0 :     ReadCommonPlan(local_node);
    1519             : 
    1520           0 :     READ_DONE();
    1521             : }
    1522             : 
    1523             : /*
    1524             :  * _readResult
    1525             :  */
    1526             : static Result *
    1527           2 : _readResult(void)
    1528             : {
    1529           2 :     READ_LOCALS(Result);
    1530             : 
    1531           2 :     ReadCommonPlan(&local_node->plan);
    1532             : 
    1533           2 :     READ_NODE_FIELD(resconstantqual);
    1534             : 
    1535           2 :     READ_DONE();
    1536             : }
    1537             : 
    1538             : /*
    1539             :  * _readProjectSet
    1540             :  */
    1541             : static ProjectSet *
    1542           1 : _readProjectSet(void)
    1543             : {
    1544           1 :     READ_LOCALS_NO_FIELDS(ProjectSet);
    1545             : 
    1546           1 :     ReadCommonPlan(&local_node->plan);
    1547             : 
    1548           1 :     READ_DONE();
    1549             : }
    1550             : 
    1551             : /*
    1552             :  * _readModifyTable
    1553             :  */
    1554             : static ModifyTable *
    1555           0 : _readModifyTable(void)
    1556             : {
    1557           0 :     READ_LOCALS(ModifyTable);
    1558             : 
    1559           0 :     ReadCommonPlan(&local_node->plan);
    1560             : 
    1561           0 :     READ_ENUM_FIELD(operation, CmdType);
    1562           0 :     READ_BOOL_FIELD(canSetTag);
    1563           0 :     READ_UINT_FIELD(nominalRelation);
    1564           0 :     READ_NODE_FIELD(partitioned_rels);
    1565           0 :     READ_NODE_FIELD(resultRelations);
    1566           0 :     READ_INT_FIELD(resultRelIndex);
    1567           0 :     READ_INT_FIELD(rootResultRelIndex);
    1568           0 :     READ_NODE_FIELD(plans);
    1569           0 :     READ_NODE_FIELD(withCheckOptionLists);
    1570           0 :     READ_NODE_FIELD(returningLists);
    1571           0 :     READ_NODE_FIELD(fdwPrivLists);
    1572           0 :     READ_BITMAPSET_FIELD(fdwDirectModifyPlans);
    1573           0 :     READ_NODE_FIELD(rowMarks);
    1574           0 :     READ_INT_FIELD(epqParam);
    1575           0 :     READ_ENUM_FIELD(onConflictAction, OnConflictAction);
    1576           0 :     READ_NODE_FIELD(arbiterIndexes);
    1577           0 :     READ_NODE_FIELD(onConflictSet);
    1578           0 :     READ_NODE_FIELD(onConflictWhere);
    1579           0 :     READ_UINT_FIELD(exclRelRTI);
    1580           0 :     READ_NODE_FIELD(exclRelTlist);
    1581             : 
    1582           0 :     READ_DONE();
    1583             : }
    1584             : 
    1585             : /*
    1586             :  * _readAppend
    1587             :  */
    1588             : static Append *
    1589           1 : _readAppend(void)
    1590             : {
    1591           1 :     READ_LOCALS(Append);
    1592             : 
    1593           1 :     ReadCommonPlan(&local_node->plan);
    1594             : 
    1595           1 :     READ_NODE_FIELD(partitioned_rels);
    1596           1 :     READ_NODE_FIELD(appendplans);
    1597             : 
    1598           1 :     READ_DONE();
    1599             : }
    1600             : 
    1601             : /*
    1602             :  * _readMergeAppend
    1603             :  */
    1604             : static MergeAppend *
    1605           0 : _readMergeAppend(void)
    1606             : {
    1607           0 :     READ_LOCALS(MergeAppend);
    1608             : 
    1609           0 :     ReadCommonPlan(&local_node->plan);
    1610             : 
    1611           0 :     READ_NODE_FIELD(partitioned_rels);
    1612           0 :     READ_NODE_FIELD(mergeplans);
    1613           0 :     READ_INT_FIELD(numCols);
    1614           0 :     READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
    1615           0 :     READ_OID_ARRAY(sortOperators, local_node->numCols);
    1616           0 :     READ_OID_ARRAY(collations, local_node->numCols);
    1617           0 :     READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
    1618             : 
    1619           0 :     READ_DONE();
    1620             : }
    1621             : 
    1622             : /*
    1623             :  * _readRecursiveUnion
    1624             :  */
    1625             : static RecursiveUnion *
    1626           0 : _readRecursiveUnion(void)
    1627             : {
    1628           0 :     READ_LOCALS(RecursiveUnion);
    1629             : 
    1630           0 :     ReadCommonPlan(&local_node->plan);
    1631             : 
    1632           0 :     READ_INT_FIELD(wtParam);
    1633           0 :     READ_INT_FIELD(numCols);
    1634           0 :     READ_ATTRNUMBER_ARRAY(dupColIdx, local_node->numCols);
    1635           0 :     READ_OID_ARRAY(dupOperators, local_node->numCols);
    1636           0 :     READ_LONG_FIELD(numGroups);
    1637             : 
    1638           0 :     READ_DONE();
    1639             : }
    1640             : 
    1641             : /*
    1642             :  * _readBitmapAnd
    1643             :  */
    1644             : static BitmapAnd *
    1645           0 : _readBitmapAnd(void)
    1646             : {
    1647           0 :     READ_LOCALS(BitmapAnd);
    1648             : 
    1649           0 :     ReadCommonPlan(&local_node->plan);
    1650             : 
    1651           0 :     READ_NODE_FIELD(bitmapplans);
    1652             : 
    1653           0 :     READ_DONE();
    1654             : }
    1655             : 
    1656             : /*
    1657             :  * _readBitmapOr
    1658             :  */
    1659             : static BitmapOr *
    1660           0 : _readBitmapOr(void)
    1661             : {
    1662           0 :     READ_LOCALS(BitmapOr);
    1663             : 
    1664           0 :     ReadCommonPlan(&local_node->plan);
    1665             : 
    1666           0 :     READ_BOOL_FIELD(isshared);
    1667           0 :     READ_NODE_FIELD(bitmapplans);
    1668             : 
    1669           0 :     READ_DONE();
    1670             : }
    1671             : 
    1672             : /*
    1673             :  * ReadCommonScan
    1674             :  *  Assign the basic stuff of all nodes that inherit from Scan
    1675             :  */
    1676             : static void
    1677         171 : ReadCommonScan(Scan *local_node)
    1678             : {
    1679             :     READ_TEMP_LOCALS();
    1680             : 
    1681         171 :     ReadCommonPlan(&local_node->plan);
    1682             : 
    1683         171 :     READ_UINT_FIELD(scanrelid);
    1684         171 : }
    1685             : 
    1686             : /*
    1687             :  * _readScan
    1688             :  */
    1689             : static Scan *
    1690           0 : _readScan(void)
    1691             : {
    1692           0 :     READ_LOCALS_NO_FIELDS(Scan);
    1693             : 
    1694           0 :     ReadCommonScan(local_node);
    1695             : 
    1696           0 :     READ_DONE();
    1697             : }
    1698             : 
    1699             : /*
    1700             :  * _readSeqScan
    1701             :  */
    1702             : static SeqScan *
    1703          42 : _readSeqScan(void)
    1704             : {
    1705          42 :     READ_LOCALS_NO_FIELDS(SeqScan);
    1706             : 
    1707          42 :     ReadCommonScan(local_node);
    1708             : 
    1709          42 :     READ_DONE();
    1710             : }
    1711             : 
    1712             : /*
    1713             :  * _readSampleScan
    1714             :  */
    1715             : static SampleScan *
    1716           0 : _readSampleScan(void)
    1717             : {
    1718           0 :     READ_LOCALS(SampleScan);
    1719             : 
    1720           0 :     ReadCommonScan(&local_node->scan);
    1721             : 
    1722           0 :     READ_NODE_FIELD(tablesample);
    1723             : 
    1724           0 :     READ_DONE();
    1725             : }
    1726             : 
    1727             : /*
    1728             :  * _readIndexScan
    1729             :  */
    1730             : static IndexScan *
    1731          17 : _readIndexScan(void)
    1732             : {
    1733          17 :     READ_LOCALS(IndexScan);
    1734             : 
    1735          17 :     ReadCommonScan(&local_node->scan);
    1736             : 
    1737          17 :     READ_OID_FIELD(indexid);
    1738          17 :     READ_NODE_FIELD(indexqual);
    1739          17 :     READ_NODE_FIELD(indexqualorig);
    1740          17 :     READ_NODE_FIELD(indexorderby);
    1741          17 :     READ_NODE_FIELD(indexorderbyorig);
    1742          17 :     READ_NODE_FIELD(indexorderbyops);
    1743          17 :     READ_ENUM_FIELD(indexorderdir, ScanDirection);
    1744             : 
    1745          17 :     READ_DONE();
    1746             : }
    1747             : 
    1748             : /*
    1749             :  * _readIndexOnlyScan
    1750             :  */
    1751             : static IndexOnlyScan *
    1752          24 : _readIndexOnlyScan(void)
    1753             : {
    1754          24 :     READ_LOCALS(IndexOnlyScan);
    1755             : 
    1756          24 :     ReadCommonScan(&local_node->scan);
    1757             : 
    1758          24 :     READ_OID_FIELD(indexid);
    1759          24 :     READ_NODE_FIELD(indexqual);
    1760          24 :     READ_NODE_FIELD(indexorderby);
    1761          24 :     READ_NODE_FIELD(indextlist);
    1762          24 :     READ_ENUM_FIELD(indexorderdir, ScanDirection);
    1763             : 
    1764          24 :     READ_DONE();
    1765             : }
    1766             : 
    1767             : /*
    1768             :  * _readBitmapIndexScan
    1769             :  */
    1770             : static BitmapIndexScan *
    1771          44 : _readBitmapIndexScan(void)
    1772             : {
    1773          44 :     READ_LOCALS(BitmapIndexScan);
    1774             : 
    1775          44 :     ReadCommonScan(&local_node->scan);
    1776             : 
    1777          44 :     READ_OID_FIELD(indexid);
    1778          44 :     READ_BOOL_FIELD(isshared);
    1779          44 :     READ_NODE_FIELD(indexqual);
    1780          44 :     READ_NODE_FIELD(indexqualorig);
    1781             : 
    1782          44 :     READ_DONE();
    1783             : }
    1784             : 
    1785             : /*
    1786             :  * _readBitmapHeapScan
    1787             :  */
    1788             : static BitmapHeapScan *
    1789          44 : _readBitmapHeapScan(void)
    1790             : {
    1791          44 :     READ_LOCALS(BitmapHeapScan);
    1792             : 
    1793          44 :     ReadCommonScan(&local_node->scan);
    1794             : 
    1795          44 :     READ_NODE_FIELD(bitmapqualorig);
    1796             : 
    1797          44 :     READ_DONE();
    1798             : }
    1799             : 
    1800             : /*
    1801             :  * _readTidScan
    1802             :  */
    1803             : static TidScan *
    1804           0 : _readTidScan(void)
    1805             : {
    1806           0 :     READ_LOCALS(TidScan);
    1807             : 
    1808           0 :     ReadCommonScan(&local_node->scan);
    1809             : 
    1810           0 :     READ_NODE_FIELD(tidquals);
    1811             : 
    1812           0 :     READ_DONE();
    1813             : }
    1814             : 
    1815             : /*
    1816             :  * _readSubqueryScan
    1817             :  */
    1818             : static SubqueryScan *
    1819           0 : _readSubqueryScan(void)
    1820             : {
    1821           0 :     READ_LOCALS(SubqueryScan);
    1822             : 
    1823           0 :     ReadCommonScan(&local_node->scan);
    1824             : 
    1825           0 :     READ_NODE_FIELD(subplan);
    1826             : 
    1827           0 :     READ_DONE();
    1828             : }
    1829             : 
    1830             : /*
    1831             :  * _readFunctionScan
    1832             :  */
    1833             : static FunctionScan *
    1834           0 : _readFunctionScan(void)
    1835             : {
    1836           0 :     READ_LOCALS(FunctionScan);
    1837             : 
    1838           0 :     ReadCommonScan(&local_node->scan);
    1839             : 
    1840           0 :     READ_NODE_FIELD(functions);
    1841           0 :     READ_BOOL_FIELD(funcordinality);
    1842             : 
    1843           0 :     READ_DONE();
    1844             : }
    1845             : 
    1846             : /*
    1847             :  * _readValuesScan
    1848             :  */
    1849             : static ValuesScan *
    1850           0 : _readValuesScan(void)
    1851             : {
    1852           0 :     READ_LOCALS(ValuesScan);
    1853             : 
    1854           0 :     ReadCommonScan(&local_node->scan);
    1855             : 
    1856           0 :     READ_NODE_FIELD(values_lists);
    1857             : 
    1858           0 :     READ_DONE();
    1859             : }
    1860             : 
    1861             : /*
    1862             :  * _readTableFuncScan
    1863             :  */
    1864             : static TableFuncScan *
    1865           0 : _readTableFuncScan(void)
    1866             : {
    1867           0 :     READ_LOCALS(TableFuncScan);
    1868             : 
    1869           0 :     ReadCommonScan(&local_node->scan);
    1870             : 
    1871           0 :     READ_NODE_FIELD(tablefunc);
    1872             : 
    1873           0 :     READ_DONE();
    1874             : }
    1875             : 
    1876             : /*
    1877             :  * _readCteScan
    1878             :  */
    1879             : static CteScan *
    1880           0 : _readCteScan(void)
    1881             : {
    1882           0 :     READ_LOCALS(CteScan);
    1883             : 
    1884           0 :     ReadCommonScan(&local_node->scan);
    1885             : 
    1886           0 :     READ_INT_FIELD(ctePlanId);
    1887           0 :     READ_INT_FIELD(cteParam);
    1888             : 
    1889           0 :     READ_DONE();
    1890             : }
    1891             : 
    1892             : /*
    1893             :  * _readWorkTableScan
    1894             :  */
    1895             : static WorkTableScan *
    1896           0 : _readWorkTableScan(void)
    1897             : {
    1898           0 :     READ_LOCALS(WorkTableScan);
    1899             : 
    1900           0 :     ReadCommonScan(&local_node->scan);
    1901             : 
    1902           0 :     READ_INT_FIELD(wtParam);
    1903             : 
    1904           0 :     READ_DONE();
    1905             : }
    1906             : 
    1907             : /*
    1908             :  * _readForeignScan
    1909             :  */
    1910             : static ForeignScan *
    1911           0 : _readForeignScan(void)
    1912             : {
    1913           0 :     READ_LOCALS(ForeignScan);
    1914             : 
    1915           0 :     ReadCommonScan(&local_node->scan);
    1916             : 
    1917           0 :     READ_ENUM_FIELD(operation, CmdType);
    1918           0 :     READ_OID_FIELD(fs_server);
    1919           0 :     READ_NODE_FIELD(fdw_exprs);
    1920           0 :     READ_NODE_FIELD(fdw_private);
    1921           0 :     READ_NODE_FIELD(fdw_scan_tlist);
    1922           0 :     READ_NODE_FIELD(fdw_recheck_quals);
    1923           0 :     READ_BITMAPSET_FIELD(fs_relids);
    1924           0 :     READ_BOOL_FIELD(fsSystemCol);
    1925             : 
    1926           0 :     READ_DONE();
    1927             : }
    1928             : 
    1929             : /*
    1930             :  * _readCustomScan
    1931             :  */
    1932             : static CustomScan *
    1933           0 : _readCustomScan(void)
    1934             : {
    1935           0 :     READ_LOCALS(CustomScan);
    1936             :     char       *custom_name;
    1937             :     const CustomScanMethods *methods;
    1938             : 
    1939           0 :     ReadCommonScan(&local_node->scan);
    1940             : 
    1941           0 :     READ_UINT_FIELD(flags);
    1942           0 :     READ_NODE_FIELD(custom_plans);
    1943           0 :     READ_NODE_FIELD(custom_exprs);
    1944           0 :     READ_NODE_FIELD(custom_private);
    1945           0 :     READ_NODE_FIELD(custom_scan_tlist);
    1946           0 :     READ_BITMAPSET_FIELD(custom_relids);
    1947             : 
    1948             :     /* Lookup CustomScanMethods by CustomName */
    1949           0 :     token = pg_strtok(&length); /* skip methods: */
    1950           0 :     token = pg_strtok(&length); /* CustomName */
    1951           0 :     custom_name = nullable_string(token, length);
    1952           0 :     methods = GetCustomScanMethods(custom_name, false);
    1953           0 :     local_node->methods = methods;
    1954             : 
    1955           0 :     READ_DONE();
    1956             : }
    1957             : 
    1958             : /*
    1959             :  * ReadCommonJoin
    1960             :  *  Assign the basic stuff of all nodes that inherit from Join
    1961             :  */
    1962             : static void
    1963           4 : ReadCommonJoin(Join *local_node)
    1964             : {
    1965             :     READ_TEMP_LOCALS();
    1966             : 
    1967           4 :     ReadCommonPlan(&local_node->plan);
    1968             : 
    1969           4 :     READ_ENUM_FIELD(jointype, JoinType);
    1970           4 :     READ_BOOL_FIELD(inner_unique);
    1971           4 :     READ_NODE_FIELD(joinqual);
    1972           4 : }
    1973             : 
    1974             : /*
    1975             :  * _readJoin
    1976             :  */
    1977             : static Join *
    1978           0 : _readJoin(void)
    1979             : {
    1980           0 :     READ_LOCALS_NO_FIELDS(Join);
    1981             : 
    1982           0 :     ReadCommonJoin(local_node);
    1983             : 
    1984           0 :     READ_DONE();
    1985             : }
    1986             : 
    1987             : /*
    1988             :  * _readNestLoop
    1989             :  */
    1990             : static NestLoop *
    1991           0 : _readNestLoop(void)
    1992             : {
    1993           0 :     READ_LOCALS(NestLoop);
    1994             : 
    1995           0 :     ReadCommonJoin(&local_node->join);
    1996             : 
    1997           0 :     READ_NODE_FIELD(nestParams);
    1998             : 
    1999           0 :     READ_DONE();
    2000             : }
    2001             : 
    2002             : /*
    2003             :  * _readMergeJoin
    2004             :  */
    2005             : static MergeJoin *
    2006           4 : _readMergeJoin(void)
    2007             : {
    2008             :     int         numCols;
    2009             : 
    2010           4 :     READ_LOCALS(MergeJoin);
    2011             : 
    2012           4 :     ReadCommonJoin(&local_node->join);
    2013             : 
    2014           4 :     READ_BOOL_FIELD(skip_mark_restore);
    2015           4 :     READ_NODE_FIELD(mergeclauses);
    2016             : 
    2017           4 :     numCols = list_length(local_node->mergeclauses);
    2018             : 
    2019           4 :     READ_OID_ARRAY(mergeFamilies, numCols);
    2020           4 :     READ_OID_ARRAY(mergeCollations, numCols);
    2021           4 :     READ_INT_ARRAY(mergeStrategies, numCols);
    2022           4 :     READ_BOOL_ARRAY(mergeNullsFirst, numCols);
    2023             : 
    2024           4 :     READ_DONE();
    2025             : }
    2026             : 
    2027             : /*
    2028             :  * _readHashJoin
    2029             :  */
    2030             : static HashJoin *
    2031           0 : _readHashJoin(void)
    2032             : {
    2033           0 :     READ_LOCALS(HashJoin);
    2034             : 
    2035           0 :     ReadCommonJoin(&local_node->join);
    2036             : 
    2037           0 :     READ_NODE_FIELD(hashclauses);
    2038             : 
    2039           0 :     READ_DONE();
    2040             : }
    2041             : 
    2042             : /*
    2043             :  * _readMaterial
    2044             :  */
    2045             : static Material *
    2046           0 : _readMaterial(void)
    2047             : {
    2048           0 :     READ_LOCALS_NO_FIELDS(Material);
    2049             : 
    2050           0 :     ReadCommonPlan(&local_node->plan);
    2051             : 
    2052           0 :     READ_DONE();
    2053             : }
    2054             : 
    2055             : /*
    2056             :  * _readSort
    2057             :  */
    2058             : static Sort *
    2059          21 : _readSort(void)
    2060             : {
    2061          21 :     READ_LOCALS(Sort);
    2062             : 
    2063          21 :     ReadCommonPlan(&local_node->plan);
    2064             : 
    2065          21 :     READ_INT_FIELD(numCols);
    2066          21 :     READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
    2067          21 :     READ_OID_ARRAY(sortOperators, local_node->numCols);
    2068          21 :     READ_OID_ARRAY(collations, local_node->numCols);
    2069          21 :     READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
    2070             : 
    2071          21 :     READ_DONE();
    2072             : }
    2073             : 
    2074             : /*
    2075             :  * _readGroup
    2076             :  */
    2077             : static Group *
    2078           0 : _readGroup(void)
    2079             : {
    2080           0 :     READ_LOCALS(Group);
    2081             : 
    2082           0 :     ReadCommonPlan(&local_node->plan);
    2083             : 
    2084           0 :     READ_INT_FIELD(numCols);
    2085           0 :     READ_ATTRNUMBER_ARRAY(grpColIdx, local_node->numCols);
    2086           0 :     READ_OID_ARRAY(grpOperators, local_node->numCols);
    2087             : 
    2088           0 :     READ_DONE();
    2089             : }
    2090             : 
    2091             : /*
    2092             :  * _readAgg
    2093             :  */
    2094             : static Agg *
    2095          65 : _readAgg(void)
    2096             : {
    2097          65 :     READ_LOCALS(Agg);
    2098             : 
    2099          65 :     ReadCommonPlan(&local_node->plan);
    2100             : 
    2101          65 :     READ_ENUM_FIELD(aggstrategy, AggStrategy);
    2102          65 :     READ_ENUM_FIELD(aggsplit, AggSplit);
    2103          65 :     READ_INT_FIELD(numCols);
    2104          65 :     READ_ATTRNUMBER_ARRAY(grpColIdx, local_node->numCols);
    2105          65 :     READ_OID_ARRAY(grpOperators, local_node->numCols);
    2106          65 :     READ_LONG_FIELD(numGroups);
    2107          65 :     READ_BITMAPSET_FIELD(aggParams);
    2108          65 :     READ_NODE_FIELD(groupingSets);
    2109          65 :     READ_NODE_FIELD(chain);
    2110             : 
    2111          65 :     READ_DONE();
    2112             : }
    2113             : 
    2114             : /*
    2115             :  * _readWindowAgg
    2116             :  */
    2117             : static WindowAgg *
    2118           0 : _readWindowAgg(void)
    2119             : {
    2120           0 :     READ_LOCALS(WindowAgg);
    2121             : 
    2122           0 :     ReadCommonPlan(&local_node->plan);
    2123             : 
    2124           0 :     READ_UINT_FIELD(winref);
    2125           0 :     READ_INT_FIELD(partNumCols);
    2126           0 :     READ_ATTRNUMBER_ARRAY(partColIdx, local_node->partNumCols);
    2127           0 :     READ_OID_ARRAY(partOperators, local_node->partNumCols);
    2128           0 :     READ_INT_FIELD(ordNumCols);
    2129           0 :     READ_ATTRNUMBER_ARRAY(ordColIdx, local_node->ordNumCols);
    2130           0 :     READ_OID_ARRAY(ordOperators, local_node->ordNumCols);
    2131           0 :     READ_INT_FIELD(frameOptions);
    2132           0 :     READ_NODE_FIELD(startOffset);
    2133           0 :     READ_NODE_FIELD(endOffset);
    2134             : 
    2135           0 :     READ_DONE();
    2136             : }
    2137             : 
    2138             : /*
    2139             :  * _readUnique
    2140             :  */
    2141             : static Unique *
    2142           0 : _readUnique(void)
    2143             : {
    2144           0 :     READ_LOCALS(Unique);
    2145             : 
    2146           0 :     ReadCommonPlan(&local_node->plan);
    2147             : 
    2148           0 :     READ_INT_FIELD(numCols);
    2149           0 :     READ_ATTRNUMBER_ARRAY(uniqColIdx, local_node->numCols);
    2150           0 :     READ_OID_ARRAY(uniqOperators, local_node->numCols);
    2151             : 
    2152           0 :     READ_DONE();
    2153             : }
    2154             : 
    2155             : /*
    2156             :  * _readGather
    2157             :  */
    2158             : static Gather *
    2159           0 : _readGather(void)
    2160             : {
    2161           0 :     READ_LOCALS(Gather);
    2162             : 
    2163           0 :     ReadCommonPlan(&local_node->plan);
    2164             : 
    2165           0 :     READ_INT_FIELD(num_workers);
    2166           0 :     READ_INT_FIELD(rescan_param);
    2167           0 :     READ_BOOL_FIELD(single_copy);
    2168           0 :     READ_BOOL_FIELD(invisible);
    2169             : 
    2170           0 :     READ_DONE();
    2171             : }
    2172             : 
    2173             : /*
    2174             :  * _readGatherMerge
    2175             :  */
    2176             : static GatherMerge *
    2177           0 : _readGatherMerge(void)
    2178             : {
    2179           0 :     READ_LOCALS(GatherMerge);
    2180             : 
    2181           0 :     ReadCommonPlan(&local_node->plan);
    2182             : 
    2183           0 :     READ_INT_FIELD(num_workers);
    2184           0 :     READ_INT_FIELD(rescan_param);
    2185           0 :     READ_INT_FIELD(numCols);
    2186           0 :     READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
    2187           0 :     READ_OID_ARRAY(sortOperators, local_node->numCols);
    2188           0 :     READ_OID_ARRAY(collations, local_node->numCols);
    2189           0 :     READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
    2190             : 
    2191           0 :     READ_DONE();
    2192             : }
    2193             : 
    2194             : /*
    2195             :  * _readHash
    2196             :  */
    2197             : static Hash *
    2198           0 : _readHash(void)
    2199             : {
    2200           0 :     READ_LOCALS(Hash);
    2201             : 
    2202           0 :     ReadCommonPlan(&local_node->plan);
    2203             : 
    2204           0 :     READ_OID_FIELD(skewTable);
    2205           0 :     READ_INT_FIELD(skewColumn);
    2206           0 :     READ_BOOL_FIELD(skewInherit);
    2207             : 
    2208           0 :     READ_DONE();
    2209             : }
    2210             : 
    2211             : /*
    2212             :  * _readSetOp
    2213             :  */
    2214             : static SetOp *
    2215           0 : _readSetOp(void)
    2216             : {
    2217           0 :     READ_LOCALS(SetOp);
    2218             : 
    2219           0 :     ReadCommonPlan(&local_node->plan);
    2220             : 
    2221           0 :     READ_ENUM_FIELD(cmd, SetOpCmd);
    2222           0 :     READ_ENUM_FIELD(strategy, SetOpStrategy);
    2223           0 :     READ_INT_FIELD(numCols);
    2224           0 :     READ_ATTRNUMBER_ARRAY(dupColIdx, local_node->numCols);
    2225           0 :     READ_OID_ARRAY(dupOperators, local_node->numCols);
    2226           0 :     READ_INT_FIELD(flagColIdx);
    2227           0 :     READ_INT_FIELD(firstFlag);
    2228           0 :     READ_LONG_FIELD(numGroups);
    2229             : 
    2230           0 :     READ_DONE();
    2231             : }
    2232             : 
    2233             : /*
    2234             :  * _readLockRows
    2235             :  */
    2236             : static LockRows *
    2237           0 : _readLockRows(void)
    2238             : {
    2239           0 :     READ_LOCALS(LockRows);
    2240             : 
    2241           0 :     ReadCommonPlan(&local_node->plan);
    2242             : 
    2243           0 :     READ_NODE_FIELD(rowMarks);
    2244           0 :     READ_INT_FIELD(epqParam);
    2245             : 
    2246           0 :     READ_DONE();
    2247             : }
    2248             : 
    2249             : /*
    2250             :  * _readLimit
    2251             :  */
    2252             : static Limit *
    2253           0 : _readLimit(void)
    2254             : {
    2255           0 :     READ_LOCALS(Limit);
    2256             : 
    2257           0 :     ReadCommonPlan(&local_node->plan);
    2258             : 
    2259           0 :     READ_NODE_FIELD(limitOffset);
    2260           0 :     READ_NODE_FIELD(limitCount);
    2261             : 
    2262           0 :     READ_DONE();
    2263             : }
    2264             : 
    2265             : /*
    2266             :  * _readNestLoopParam
    2267             :  */
    2268             : static NestLoopParam *
    2269           0 : _readNestLoopParam(void)
    2270             : {
    2271           0 :     READ_LOCALS(NestLoopParam);
    2272             : 
    2273           0 :     READ_INT_FIELD(paramno);
    2274           0 :     READ_NODE_FIELD(paramval);
    2275             : 
    2276           0 :     READ_DONE();
    2277             : }
    2278             : 
    2279             : /*
    2280             :  * _readPlanRowMark
    2281             :  */
    2282             : static PlanRowMark *
    2283           0 : _readPlanRowMark(void)
    2284             : {
    2285           0 :     READ_LOCALS(PlanRowMark);
    2286             : 
    2287           0 :     READ_UINT_FIELD(rti);
    2288           0 :     READ_UINT_FIELD(prti);
    2289           0 :     READ_UINT_FIELD(rowmarkId);
    2290           0 :     READ_ENUM_FIELD(markType, RowMarkType);
    2291           0 :     READ_INT_FIELD(allMarkTypes);
    2292           0 :     READ_ENUM_FIELD(strength, LockClauseStrength);
    2293           0 :     READ_ENUM_FIELD(waitPolicy, LockWaitPolicy);
    2294           0 :     READ_BOOL_FIELD(isParent);
    2295             : 
    2296           0 :     READ_DONE();
    2297             : }
    2298             : 
    2299             : /*
    2300             :  * _readPlanInvalItem
    2301             :  */
    2302             : static PlanInvalItem *
    2303           0 : _readPlanInvalItem(void)
    2304             : {
    2305           0 :     READ_LOCALS(PlanInvalItem);
    2306             : 
    2307           0 :     READ_INT_FIELD(cacheId);
    2308           0 :     READ_UINT_FIELD(hashValue);
    2309             : 
    2310           0 :     READ_DONE();
    2311             : }
    2312             : 
    2313             : /*
    2314             :  * _readSubPlan
    2315             :  */
    2316             : static SubPlan *
    2317           4 : _readSubPlan(void)
    2318             : {
    2319           4 :     READ_LOCALS(SubPlan);
    2320             : 
    2321           4 :     READ_ENUM_FIELD(subLinkType, SubLinkType);
    2322           4 :     READ_NODE_FIELD(testexpr);
    2323           4 :     READ_NODE_FIELD(paramIds);
    2324           4 :     READ_INT_FIELD(plan_id);
    2325           4 :     READ_STRING_FIELD(plan_name);
    2326           4 :     READ_OID_FIELD(firstColType);
    2327           4 :     READ_INT_FIELD(firstColTypmod);
    2328           4 :     READ_OID_FIELD(firstColCollation);
    2329           4 :     READ_BOOL_FIELD(useHashTable);
    2330           4 :     READ_BOOL_FIELD(unknownEqFalse);
    2331           4 :     READ_BOOL_FIELD(parallel_safe);
    2332           4 :     READ_NODE_FIELD(setParam);
    2333           4 :     READ_NODE_FIELD(parParam);
    2334           4 :     READ_NODE_FIELD(args);
    2335           4 :     READ_FLOAT_FIELD(startup_cost);
    2336           4 :     READ_FLOAT_FIELD(per_call_cost);
    2337             : 
    2338           4 :     READ_DONE();
    2339             : }
    2340             : 
    2341             : /*
    2342             :  * _readAlternativeSubPlan
    2343             :  */
    2344             : static AlternativeSubPlan *
    2345           0 : _readAlternativeSubPlan(void)
    2346             : {
    2347           0 :     READ_LOCALS(AlternativeSubPlan);
    2348             : 
    2349           0 :     READ_NODE_FIELD(subplans);
    2350             : 
    2351           0 :     READ_DONE();
    2352             : }
    2353             : 
    2354             : /*
    2355             :  * _readExtensibleNode
    2356             :  */
    2357             : static ExtensibleNode *
    2358           0 : _readExtensibleNode(void)
    2359             : {
    2360             :     const ExtensibleNodeMethods *methods;
    2361             :     ExtensibleNode *local_node;
    2362             :     const char *extnodename;
    2363             : 
    2364             :     READ_TEMP_LOCALS();
    2365             : 
    2366           0 :     token = pg_strtok(&length); /* skip :extnodename */
    2367           0 :     token = pg_strtok(&length); /* get extnodename */
    2368             : 
    2369           0 :     extnodename = nullable_string(token, length);
    2370           0 :     if (!extnodename)
    2371           0 :         elog(ERROR, "extnodename has to be supplied");
    2372           0 :     methods = GetExtensibleNodeMethods(extnodename, false);
    2373             : 
    2374           0 :     local_node = (ExtensibleNode *) newNode(methods->node_size,
    2375             :                                             T_ExtensibleNode);
    2376           0 :     local_node->extnodename = extnodename;
    2377             : 
    2378             :     /* deserialize the private fields */
    2379           0 :     methods->nodeRead(local_node);
    2380             : 
    2381           0 :     READ_DONE();
    2382             : }
    2383             : 
    2384             : /*
    2385             :  * _readPartitionBoundSpec
    2386             :  */
    2387             : static PartitionBoundSpec *
    2388         944 : _readPartitionBoundSpec(void)
    2389             : {
    2390         944 :     READ_LOCALS(PartitionBoundSpec);
    2391             : 
    2392         944 :     READ_CHAR_FIELD(strategy);
    2393         944 :     READ_NODE_FIELD(listdatums);
    2394         944 :     READ_NODE_FIELD(lowerdatums);
    2395         944 :     READ_NODE_FIELD(upperdatums);
    2396         944 :     READ_LOCATION_FIELD(location);
    2397             : 
    2398         944 :     READ_DONE();
    2399             : }
    2400             : 
    2401             : /*
    2402             :  * _readPartitionRangeDatum
    2403             :  */
    2404             : static PartitionRangeDatum *
    2405        1906 : _readPartitionRangeDatum(void)
    2406             : {
    2407        1906 :     READ_LOCALS(PartitionRangeDatum);
    2408             : 
    2409        1906 :     READ_ENUM_FIELD(kind, PartitionRangeDatumKind);
    2410        1906 :     READ_NODE_FIELD(value);
    2411        1906 :     READ_LOCATION_FIELD(location);
    2412             : 
    2413        1906 :     READ_DONE();
    2414             : }
    2415             : 
    2416             : /*
    2417             :  * parseNodeString
    2418             :  *
    2419             :  * Given a character string representing a node tree, parseNodeString creates
    2420             :  * the internal node structure.
    2421             :  *
    2422             :  * The string to be read must already have been loaded into pg_strtok().
    2423             :  */
    2424             : Node *
    2425       72619 : parseNodeString(void)
    2426             : {
    2427             :     void       *return_value;
    2428             : 
    2429             :     READ_TEMP_LOCALS();
    2430             : 
    2431       72619 :     token = pg_strtok(&length);
    2432             : 
    2433             : #define MATCH(tokname, namelen) \
    2434             :     (length == namelen && memcmp(token, tokname, namelen) == 0)
    2435             : 
    2436       72619 :     if (MATCH("QUERY", 5))
    2437        1661 :         return_value = _readQuery();
    2438       70958 :     else if (MATCH("WITHCHECKOPTION", 15))
    2439           0 :         return_value = _readWithCheckOption();
    2440       70958 :     else if (MATCH("SORTGROUPCLAUSE", 15))
    2441         229 :         return_value = _readSortGroupClause();
    2442       70729 :     else if (MATCH("GROUPINGSET", 11))
    2443           6 :         return_value = _readGroupingSet();
    2444       70723 :     else if (MATCH("WINDOWCLAUSE", 12))
    2445           3 :         return_value = _readWindowClause();
    2446       70720 :     else if (MATCH("ROWMARKCLAUSE", 13))
    2447           0 :         return_value = _readRowMarkClause();
    2448       70720 :     else if (MATCH("COMMONTABLEEXPR", 15))
    2449          10 :         return_value = _readCommonTableExpr();
    2450       70710 :     else if (MATCH("SETOPERATIONSTMT", 16))
    2451          82 :         return_value = _readSetOperationStmt();
    2452       70628 :     else if (MATCH("ALIAS", 5))
    2453        9088 :         return_value = _readAlias();
    2454       61540 :     else if (MATCH("RANGEVAR", 8))
    2455           0 :         return_value = _readRangeVar();
    2456       61540 :     else if (MATCH("INTOCLAUSE", 10))
    2457           0 :         return_value = _readIntoClause();
    2458       61540 :     else if (MATCH("TABLEFUNC", 9))
    2459           2 :         return_value = _readTableFunc();
    2460       61538 :     else if (MATCH("VAR", 3))
    2461       24567 :         return_value = _readVar();
    2462       36971 :     else if (MATCH("CONST", 5))
    2463        7833 :         return_value = _readConst();
    2464       29138 :     else if (MATCH("PARAM", 5))
    2465          25 :         return_value = _readParam();
    2466       29113 :     else if (MATCH("AGGREF", 6))
    2467         201 :         return_value = _readAggref();
    2468       28912 :     else if (MATCH("GROUPINGFUNC", 12))
    2469           2 :         return_value = _readGroupingFunc();
    2470       28910 :     else if (MATCH("WINDOWFUNC", 10))
    2471           3 :         return_value = _readWindowFunc();
    2472       28907 :     else if (MATCH("ARRAYREF", 8))
    2473         113 :         return_value = _readArrayRef();
    2474       28794 :     else if (MATCH("FUNCEXPR", 8))
    2475        2381 :         return_value = _readFuncExpr();
    2476       26413 :     else if (MATCH("NAMEDARGEXPR", 12))
    2477           6 :         return_value = _readNamedArgExpr();
    2478       26407 :     else if (MATCH("OPEXPR", 6))
    2479        3141 :         return_value = _readOpExpr();
    2480       23266 :     else if (MATCH("DISTINCTEXPR", 12))
    2481           2 :         return_value = _readDistinctExpr();
    2482       23264 :     else if (MATCH("NULLIFEXPR", 10))
    2483           2 :         return_value = _readNullIfExpr();
    2484       23262 :     else if (MATCH("SCALARARRAYOPEXPR", 17))
    2485         154 :         return_value = _readScalarArrayOpExpr();
    2486       23108 :     else if (MATCH("BOOLEXPR", 8))
    2487         542 :         return_value = _readBoolExpr();
    2488       22566 :     else if (MATCH("SUBLINK", 7))
    2489         164 :         return_value = _readSubLink();
    2490       22402 :     else if (MATCH("FIELDSELECT", 11))
    2491          98 :         return_value = _readFieldSelect();
    2492       22304 :     else if (MATCH("FIELDSTORE", 10))
    2493          28 :         return_value = _readFieldStore();
    2494       22276 :     else if (MATCH("RELABELTYPE", 11))
    2495         184 :         return_value = _readRelabelType();
    2496       22092 :     else if (MATCH("COERCEVIAIO", 11))
    2497          80 :         return_value = _readCoerceViaIO();
    2498       22012 :     else if (MATCH("ARRAYCOERCEEXPR", 15))
    2499          58 :         return_value = _readArrayCoerceExpr();
    2500       21954 :     else if (MATCH("CONVERTROWTYPEEXPR", 18))
    2501           0 :         return_value = _readConvertRowtypeExpr();
    2502       21954 :     else if (MATCH("COLLATE", 7))
    2503           8 :         return_value = _readCollateExpr();
    2504       21946 :     else if (MATCH("CASE", 4))
    2505         212 :         return_value = _readCaseExpr();
    2506       21734 :     else if (MATCH("WHEN", 4))
    2507         477 :         return_value = _readCaseWhen();
    2508       21257 :     else if (MATCH("CASETESTEXPR", 12))
    2509          69 :         return_value = _readCaseTestExpr();
    2510       21188 :     else if (MATCH("ARRAY", 5))
    2511         163 :         return_value = _readArrayExpr();
    2512       21025 :     else if (MATCH("ROW", 3))
    2513           2 :         return_value = _readRowExpr();
    2514       21023 :     else if (MATCH("ROWCOMPARE", 10))
    2515           0 :         return_value = _readRowCompareExpr();
    2516       21023 :     else if (MATCH("COALESCE", 8))
    2517          90 :         return_value = _readCoalesceExpr();
    2518       20933 :     else if (MATCH("MINMAX", 6))
    2519           2 :         return_value = _readMinMaxExpr();
    2520       20931 :     else if (MATCH("SQLVALUEFUNCTION", 16))
    2521          76 :         return_value = _readSQLValueFunction();
    2522       20855 :     else if (MATCH("XMLEXPR", 7))
    2523           2 :         return_value = _readXmlExpr();
    2524       20853 :     else if (MATCH("NULLTEST", 8))
    2525          36 :         return_value = _readNullTest();
    2526       20817 :     else if (MATCH("BOOLEANTEST", 11))
    2527           0 :         return_value = _readBooleanTest();
    2528       20817 :     else if (MATCH("COERCETODOMAIN", 14))
    2529         676 :         return_value = _readCoerceToDomain();
    2530       20141 :     else if (MATCH("COERCETODOMAINVALUE", 19))
    2531         204 :         return_value = _readCoerceToDomainValue();
    2532       19937 :     else if (MATCH("SETTODEFAULT", 12))
    2533           0 :         return_value = _readSetToDefault();
    2534       19937 :     else if (MATCH("CURRENTOFEXPR", 13))
    2535           0 :         return_value = _readCurrentOfExpr();
    2536       19937 :     else if (MATCH("NEXTVALUEEXPR", 13))
    2537           0 :         return_value = _readNextValueExpr();
    2538       19937 :     else if (MATCH("INFERENCEELEM", 13))
    2539           6 :         return_value = _readInferenceElem();
    2540       19931 :     else if (MATCH("TARGETENTRY", 11))
    2541        6786 :         return_value = _readTargetEntry();
    2542       13145 :     else if (MATCH("RANGETBLREF", 11))
    2543        2186 :         return_value = _readRangeTblRef();
    2544       10959 :     else if (MATCH("JOINEXPR", 8))
    2545         418 :         return_value = _readJoinExpr();
    2546       10541 :     else if (MATCH("FROMEXPR", 8))
    2547        1656 :         return_value = _readFromExpr();
    2548        8885 :     else if (MATCH("ONCONFLICTEXPR", 14))
    2549           8 :         return_value = _readOnConflictExpr();
    2550        8877 :     else if (MATCH("RTE", 3))
    2551        5478 :         return_value = _readRangeTblEntry();
    2552        3399 :     else if (MATCH("RANGETBLFUNCTION", 16))
    2553         152 :         return_value = _readRangeTblFunction();
    2554        3247 :     else if (MATCH("TABLESAMPLECLAUSE", 17))
    2555           8 :         return_value = _readTableSampleClause();
    2556        3239 :     else if (MATCH("NOTIFY", 6))
    2557           5 :         return_value = _readNotifyStmt();
    2558        3234 :     else if (MATCH("DEFELEM", 7))
    2559           0 :         return_value = _readDefElem();
    2560        3234 :     else if (MATCH("DECLARECURSOR", 13))
    2561           0 :         return_value = _readDeclareCursorStmt();
    2562        3234 :     else if (MATCH("PLANNEDSTMT", 11))
    2563         115 :         return_value = _readPlannedStmt();
    2564        3119 :     else if (MATCH("PLAN", 4))
    2565           0 :         return_value = _readPlan();
    2566        3119 :     else if (MATCH("RESULT", 6))
    2567           2 :         return_value = _readResult();
    2568        3117 :     else if (MATCH("PROJECTSET", 10))
    2569           1 :         return_value = _readProjectSet();
    2570        3116 :     else if (MATCH("MODIFYTABLE", 11))
    2571           0 :         return_value = _readModifyTable();
    2572        3116 :     else if (MATCH("APPEND", 6))
    2573           1 :         return_value = _readAppend();
    2574        3115 :     else if (MATCH("MERGEAPPEND", 11))
    2575           0 :         return_value = _readMergeAppend();
    2576        3115 :     else if (MATCH("RECURSIVEUNION", 14))
    2577           0 :         return_value = _readRecursiveUnion();
    2578        3115 :     else if (MATCH("BITMAPAND", 9))
    2579           0 :         return_value = _readBitmapAnd();
    2580        3115 :     else if (MATCH("BITMAPOR", 8))
    2581           0 :         return_value = _readBitmapOr();
    2582        3115 :     else if (MATCH("SCAN", 4))
    2583           0 :         return_value = _readScan();
    2584        3115 :     else if (MATCH("SEQSCAN", 7))
    2585          42 :         return_value = _readSeqScan();
    2586        3073 :     else if (MATCH("SAMPLESCAN", 10))
    2587           0 :         return_value = _readSampleScan();
    2588        3073 :     else if (MATCH("INDEXSCAN", 9))
    2589          17 :         return_value = _readIndexScan();
    2590        3056 :     else if (MATCH("INDEXONLYSCAN", 13))
    2591          24 :         return_value = _readIndexOnlyScan();
    2592        3032 :     else if (MATCH("BITMAPINDEXSCAN", 15))
    2593          44 :         return_value = _readBitmapIndexScan();
    2594        2988 :     else if (MATCH("BITMAPHEAPSCAN", 14))
    2595          44 :         return_value = _readBitmapHeapScan();
    2596        2944 :     else if (MATCH("TIDSCAN", 7))
    2597           0 :         return_value = _readTidScan();
    2598        2944 :     else if (MATCH("SUBQUERYSCAN", 12))
    2599           0 :         return_value = _readSubqueryScan();
    2600        2944 :     else if (MATCH("FUNCTIONSCAN", 12))
    2601           0 :         return_value = _readFunctionScan();
    2602        2944 :     else if (MATCH("VALUESSCAN", 10))
    2603           0 :         return_value = _readValuesScan();
    2604        2944 :     else if (MATCH("TABLEFUNCSCAN", 13))
    2605           0 :         return_value = _readTableFuncScan();
    2606        2944 :     else if (MATCH("CTESCAN", 7))
    2607           0 :         return_value = _readCteScan();
    2608        2944 :     else if (MATCH("WORKTABLESCAN", 13))
    2609           0 :         return_value = _readWorkTableScan();
    2610        2944 :     else if (MATCH("FOREIGNSCAN", 11))
    2611           0 :         return_value = _readForeignScan();
    2612        2944 :     else if (MATCH("CUSTOMSCAN", 10))
    2613           0 :         return_value = _readCustomScan();
    2614        2944 :     else if (MATCH("JOIN", 4))
    2615           0 :         return_value = _readJoin();
    2616        2944 :     else if (MATCH("NESTLOOP", 8))
    2617           0 :         return_value = _readNestLoop();
    2618        2944 :     else if (MATCH("MERGEJOIN", 9))
    2619           4 :         return_value = _readMergeJoin();
    2620        2940 :     else if (MATCH("HASHJOIN", 8))
    2621           0 :         return_value = _readHashJoin();
    2622        2940 :     else if (MATCH("MATERIAL", 8))
    2623           0 :         return_value = _readMaterial();
    2624        2940 :     else if (MATCH("SORT", 4))
    2625          21 :         return_value = _readSort();
    2626        2919 :     else if (MATCH("GROUP", 5))
    2627           0 :         return_value = _readGroup();
    2628        2919 :     else if (MATCH("AGG", 3))
    2629          65 :         return_value = _readAgg();
    2630        2854 :     else if (MATCH("WINDOWAGG", 9))
    2631           0 :         return_value = _readWindowAgg();
    2632        2854 :     else if (MATCH("UNIQUE", 6))
    2633           0 :         return_value = _readUnique();
    2634        2854 :     else if (MATCH("GATHER", 6))
    2635           0 :         return_value = _readGather();
    2636        2854 :     else if (MATCH("GATHERMERGE", 11))
    2637           0 :         return_value = _readGatherMerge();
    2638        2854 :     else if (MATCH("HASH", 4))
    2639           0 :         return_value = _readHash();
    2640        2854 :     else if (MATCH("SETOP", 5))
    2641           0 :         return_value = _readSetOp();
    2642        2854 :     else if (MATCH("LOCKROWS", 8))
    2643           0 :         return_value = _readLockRows();
    2644        2854 :     else if (MATCH("LIMIT", 5))
    2645           0 :         return_value = _readLimit();
    2646        2854 :     else if (MATCH("NESTLOOPPARAM", 13))
    2647           0 :         return_value = _readNestLoopParam();
    2648        2854 :     else if (MATCH("PLANROWMARK", 11))
    2649           0 :         return_value = _readPlanRowMark();
    2650        2854 :     else if (MATCH("PLANINVALITEM", 13))
    2651           0 :         return_value = _readPlanInvalItem();
    2652        2854 :     else if (MATCH("SUBPLAN", 7))
    2653           4 :         return_value = _readSubPlan();
    2654        2850 :     else if (MATCH("ALTERNATIVESUBPLAN", 18))
    2655           0 :         return_value = _readAlternativeSubPlan();
    2656        2850 :     else if (MATCH("EXTENSIBLENODE", 14))
    2657           0 :         return_value = _readExtensibleNode();
    2658        2850 :     else if (MATCH("PARTITIONBOUNDSPEC", 18))
    2659         944 :         return_value = _readPartitionBoundSpec();
    2660        1906 :     else if (MATCH("PARTITIONRANGEDATUM", 19))
    2661        1906 :         return_value = _readPartitionRangeDatum();
    2662             :     else
    2663             :     {
    2664           0 :         elog(ERROR, "badly formatted node string \"%.32s\"...", token);
    2665             :         return_value = NULL;    /* keep compiler quiet */
    2666             :     }
    2667             : 
    2668       72619 :     return (Node *) return_value;
    2669             : }
    2670             : 
    2671             : 
    2672             : /*
    2673             :  * readDatum
    2674             :  *
    2675             :  * Given a string representation of a constant, recreate the appropriate
    2676             :  * Datum.  The string representation embeds length info, but not byValue,
    2677             :  * so we must be told that.
    2678             :  */
    2679             : Datum
    2680        7353 : readDatum(bool typbyval)
    2681             : {
    2682             :     Size        length,
    2683             :                 i;
    2684             :     int         tokenLength;
    2685             :     char       *token;
    2686             :     Datum       res;
    2687             :     char       *s;
    2688             : 
    2689             :     /*
    2690             :      * read the actual length of the value
    2691             :      */
    2692        7353 :     token = pg_strtok(&tokenLength);
    2693        7353 :     length = atoui(token);
    2694             : 
    2695        7353 :     token = pg_strtok(&tokenLength);    /* read the '[' */
    2696        7353 :     if (token == NULL || token[0] != '[')
    2697           0 :         elog(ERROR, "expected \"[\" to start datum, but got \"%s\"; length = %zu",
    2698             :              token ? (const char *) token : "[NULL]", length);
    2699             : 
    2700        7353 :     if (typbyval)
    2701             :     {
    2702        5536 :         if (length > (Size) sizeof(Datum))
    2703           0 :             elog(ERROR, "byval datum but length = %zu", length);
    2704        5536 :         res = (Datum) 0;
    2705        5536 :         s = (char *) (&res);
    2706       27680 :         for (i = 0; i < (Size) sizeof(Datum); i++)
    2707             :         {
    2708       22144 :             token = pg_strtok(&tokenLength);
    2709       22144 :             s[i] = (char) atoi(token);
    2710             :         }
    2711             :     }
    2712        1817 :     else if (length <= 0)
    2713           0 :         res = (Datum) NULL;
    2714             :     else
    2715             :     {
    2716        1817 :         s = (char *) palloc(length);
    2717       27974 :         for (i = 0; i < length; i++)
    2718             :         {
    2719       26157 :             token = pg_strtok(&tokenLength);
    2720       26157 :             s[i] = (char) atoi(token);
    2721             :         }
    2722        1817 :         res = PointerGetDatum(s);
    2723             :     }
    2724             : 
    2725        7353 :     token = pg_strtok(&tokenLength);    /* read the ']' */
    2726        7353 :     if (token == NULL || token[0] != ']')
    2727           0 :         elog(ERROR, "expected \"]\" to end datum, but got \"%s\"; length = %zu",
    2728             :              token ? (const char *) token : "[NULL]", length);
    2729             : 
    2730        7353 :     return res;
    2731             : }
    2732             : 
    2733             : /*
    2734             :  * readAttrNumberCols
    2735             :  */
    2736             : AttrNumber *
    2737          86 : readAttrNumberCols(int numCols)
    2738             : {
    2739             :     int         tokenLength,
    2740             :                 i;
    2741             :     char       *token;
    2742             :     AttrNumber *attr_vals;
    2743             : 
    2744          86 :     if (numCols <= 0)
    2745          45 :         return NULL;
    2746             : 
    2747          41 :     attr_vals = (AttrNumber *) palloc(numCols * sizeof(AttrNumber));
    2748          82 :     for (i = 0; i < numCols; i++)
    2749             :     {
    2750          41 :         token = pg_strtok(&tokenLength);
    2751          41 :         attr_vals[i] = atoi(token);
    2752             :     }
    2753             : 
    2754          41 :     return attr_vals;
    2755             : }
    2756             : 
    2757             : /*
    2758             :  * readOidCols
    2759             :  */
    2760             : Oid *
    2761         115 : readOidCols(int numCols)
    2762             : {
    2763             :     int         tokenLength,
    2764             :                 i;
    2765             :     char       *token;
    2766             :     Oid        *oid_vals;
    2767             : 
    2768         115 :     if (numCols <= 0)
    2769          45 :         return NULL;
    2770             : 
    2771          70 :     oid_vals = (Oid *) palloc(numCols * sizeof(Oid));
    2772         140 :     for (i = 0; i < numCols; i++)
    2773             :     {
    2774          70 :         token = pg_strtok(&tokenLength);
    2775          70 :         oid_vals[i] = atooid(token);
    2776             :     }
    2777             : 
    2778          70 :     return oid_vals;
    2779             : }
    2780             : 
    2781             : /*
    2782             :  * readIntCols
    2783             :  */
    2784             : int *
    2785           4 : readIntCols(int numCols)
    2786             : {
    2787             :     int         tokenLength,
    2788             :                 i;
    2789             :     char       *token;
    2790             :     int        *int_vals;
    2791             : 
    2792           4 :     if (numCols <= 0)
    2793           0 :         return NULL;
    2794             : 
    2795           4 :     int_vals = (int *) palloc(numCols * sizeof(int));
    2796           8 :     for (i = 0; i < numCols; i++)
    2797             :     {
    2798           4 :         token = pg_strtok(&tokenLength);
    2799           4 :         int_vals[i] = atoi(token);
    2800             :     }
    2801             : 
    2802           4 :     return int_vals;
    2803             : }
    2804             : 
    2805             : /*
    2806             :  * readBoolCols
    2807             :  */
    2808             : bool *
    2809          25 : readBoolCols(int numCols)
    2810             : {
    2811             :     int         tokenLength,
    2812             :                 i;
    2813             :     char       *token;
    2814             :     bool       *bool_vals;
    2815             : 
    2816          25 :     if (numCols <= 0)
    2817           0 :         return NULL;
    2818             : 
    2819          25 :     bool_vals = (bool *) palloc(numCols * sizeof(bool));
    2820          50 :     for (i = 0; i < numCols; i++)
    2821             :     {
    2822          25 :         token = pg_strtok(&tokenLength);
    2823          25 :         bool_vals[i] = strtobool(token);
    2824             :     }
    2825             : 
    2826          25 :     return bool_vals;
    2827             : }

Generated by: LCOV version 1.11