]> granicus.if.org Git - postgresql/blobdiff - src/backend/nodes/readfuncs.c
Improve parse representation for MERGE
[postgresql] / src / backend / nodes / readfuncs.c
index 72368ab981d98bdc061ee64606e894275d2fe779..37e35685956729c3bfb70e78c60c909e54d0c710 100644 (file)
@@ -3,7 +3,7 @@
  * readfuncs.c
  *       Reader functions for Postgres tree nodes.
  *
- * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
 
 #include <math.h>
 
+#include "fmgr.h"
+#include "nodes/extensible.h"
 #include "nodes/parsenodes.h"
 #include "nodes/plannodes.h"
 #include "nodes/readfuncs.h"
+#include "utils/builtins.h"
 
 
 /*
        token = pg_strtok(&length);             /* get field value */ \
        local_node->fldname = atoui(token)
 
-/* Read an long integer field (anything written as ":fldname %ld") */
+/* Read an unsigned integer field (anything written using UINT64_FORMAT) */
+#define READ_UINT64_FIELD(fldname) \
+       token = pg_strtok(&length);             /* skip :fldname */ \
+       token = pg_strtok(&length);             /* get field value */ \
+       local_node->fldname = pg_strtouint64(token, NULL, 10)
+
+/* Read a long integer field (anything written as ":fldname %ld") */
 #define READ_LONG_FIELD(fldname) \
        token = pg_strtok(&length);             /* skip :fldname */ \
        token = pg_strtok(&length);             /* get field value */ \
@@ -84,7 +93,8 @@
 #define READ_CHAR_FIELD(fldname) \
        token = pg_strtok(&length);             /* skip :fldname */ \
        token = pg_strtok(&length);             /* get field value */ \
-       local_node->fldname = token[0]
+       /* avoid overhead of calling debackslash() for one char */ \
+       local_node->fldname = (length == 0) ? '\0' : (token[0] == '\\' ? token[1] : token[0])
 
 /* Read an enumerated-type field that was written as an integer code */
 #define READ_ENUM_FIELD(fldname, enumtype) \
  */
 #define atoui(x)  ((unsigned int) strtoul((x), NULL, 10))
 
-#define atooid(x)  ((Oid) strtoul((x), NULL, 10))
-
 #define strtobool(x)  ((*(x) == 't') ? true : false)
 
 #define nullable_string(token,length)  \
        ((length) == 0 ? NULL : debackslash(token, length))
 
 
-static Datum readDatum(bool typbyval);
-static bool *readBoolCols(int numCols);
-static int *readIntCols(int numCols);
-static Oid *readOidCols(int numCols);
-static AttrNumber *readAttrNumberCols(int numCols);
-
 /*
  * _readBitmapset
  */
@@ -217,6 +219,14 @@ _readBitmapset(void)
        return result;
 }
 
+/*
+ * for use by extensions which define extensible nodes
+ */
+Bitmapset *
+readBitmapset(void)
+{
+       return _readBitmapset();
+}
 
 /*
  * _readQuery
@@ -228,12 +238,13 @@ _readQuery(void)
 
        READ_ENUM_FIELD(commandType, CmdType);
        READ_ENUM_FIELD(querySource, QuerySource);
-       local_node->queryId = 0;        /* not saved in output format */
+       local_node->queryId = UINT64CONST(0);   /* not saved in output format */
        READ_BOOL_FIELD(canSetTag);
        READ_NODE_FIELD(utilityStmt);
        READ_INT_FIELD(resultRelation);
        READ_BOOL_FIELD(hasAggs);
        READ_BOOL_FIELD(hasWindowFuncs);
+       READ_BOOL_FIELD(hasTargetSRFs);
        READ_BOOL_FIELD(hasSubLinks);
        READ_BOOL_FIELD(hasDistinctOn);
        READ_BOOL_FIELD(hasRecursive);
@@ -244,7 +255,7 @@ _readQuery(void)
        READ_NODE_FIELD(rtable);
        READ_NODE_FIELD(jointree);
        READ_NODE_FIELD(targetList);
-       READ_NODE_FIELD(withCheckOptions);
+       READ_ENUM_FIELD(override, OverridingKind);
        READ_NODE_FIELD(onConflict);
        READ_NODE_FIELD(returningList);
        READ_NODE_FIELD(groupClause);
@@ -258,6 +269,12 @@ _readQuery(void)
        READ_NODE_FIELD(rowMarks);
        READ_NODE_FIELD(setOperations);
        READ_NODE_FIELD(constraintDeps);
+       /* withCheckOptions intentionally omitted, see comment in parsenodes.h */
+       READ_INT_FIELD(mergeTarget_relation);
+       READ_NODE_FIELD(mergeSourceTargetList);
+       READ_NODE_FIELD(mergeActionList);
+       READ_LOCATION_FIELD(stmt_location);
+       READ_LOCATION_FIELD(stmt_len);
 
        READ_DONE();
 }
@@ -355,6 +372,11 @@ _readWindowClause(void)
        READ_INT_FIELD(frameOptions);
        READ_NODE_FIELD(startOffset);
        READ_NODE_FIELD(endOffset);
+       READ_OID_FIELD(startInRangeFunc);
+       READ_OID_FIELD(endInRangeFunc);
+       READ_OID_FIELD(inRangeColl);
+       READ_BOOL_FIELD(inRangeAsc);
+       READ_BOOL_FIELD(inRangeNullsFirst);
        READ_UINT_FIELD(winref);
        READ_BOOL_FIELD(copiedOrder);
 
@@ -440,12 +462,11 @@ _readRangeVar(void)
 {
        READ_LOCALS(RangeVar);
 
-       local_node->catalogname = NULL;         /* not currently saved in output
-                                                                                * format */
+       local_node->catalogname = NULL; /* not currently saved in output format */
 
        READ_STRING_FIELD(schemaname);
        READ_STRING_FIELD(relname);
-       READ_ENUM_FIELD(inhOpt, InhOption);
+       READ_BOOL_FIELD(inh);
        READ_CHAR_FIELD(relpersistence);
        READ_NODE_FIELD(alias);
        READ_LOCATION_FIELD(location);
@@ -453,6 +474,31 @@ _readRangeVar(void)
        READ_DONE();
 }
 
+/*
+ * _readTableFunc
+ */
+static TableFunc *
+_readTableFunc(void)
+{
+       READ_LOCALS(TableFunc);
+
+       READ_NODE_FIELD(ns_uris);
+       READ_NODE_FIELD(ns_names);
+       READ_NODE_FIELD(docexpr);
+       READ_NODE_FIELD(rowexpr);
+       READ_NODE_FIELD(colnames);
+       READ_NODE_FIELD(coltypes);
+       READ_NODE_FIELD(coltypmods);
+       READ_NODE_FIELD(colcollations);
+       READ_NODE_FIELD(colexprs);
+       READ_NODE_FIELD(coldefexprs);
+       READ_BITMAPSET_FIELD(notnulls);
+       READ_INT_FIELD(ordinalitycol);
+       READ_LOCATION_FIELD(location);
+
+       READ_DONE();
+}
+
 static IntoClause *
 _readIntoClause(void)
 {
@@ -508,7 +554,7 @@ _readConst(void)
 
        token = pg_strtok(&length); /* skip :constvalue */
        if (local_node->constisnull)
-               token = pg_strtok(&length);             /* skip "<>" */
+               token = pg_strtok(&length); /* skip "<>" */
        else
                local_node->constvalue = readDatum(local_node->constbyval);
 
@@ -545,6 +591,8 @@ _readAggref(void)
        READ_OID_FIELD(aggtype);
        READ_OID_FIELD(aggcollid);
        READ_OID_FIELD(inputcollid);
+       READ_OID_FIELD(aggtranstype);
+       READ_NODE_FIELD(aggargtypes);
        READ_NODE_FIELD(aggdirectargs);
        READ_NODE_FIELD(args);
        READ_NODE_FIELD(aggorder);
@@ -554,6 +602,7 @@ _readAggref(void)
        READ_BOOL_FIELD(aggvariadic);
        READ_CHAR_FIELD(aggkind);
        READ_UINT_FIELD(agglevelsup);
+       READ_ENUM_FIELD(aggsplit, AggSplit);
        READ_LOCATION_FIELD(location);
 
        READ_DONE();
@@ -858,11 +907,10 @@ _readArrayCoerceExpr(void)
        READ_LOCALS(ArrayCoerceExpr);
 
        READ_NODE_FIELD(arg);
-       READ_OID_FIELD(elemfuncid);
+       READ_NODE_FIELD(elemexpr);
        READ_OID_FIELD(resulttype);
        READ_INT_FIELD(resulttypmod);
        READ_OID_FIELD(resultcollid);
-       READ_BOOL_FIELD(isExplicit);
        READ_ENUM_FIELD(coerceformat, CoercionForm);
        READ_LOCATION_FIELD(location);
 
@@ -1035,6 +1083,22 @@ _readMinMaxExpr(void)
        READ_DONE();
 }
 
+/*
+ * _readSQLValueFunction
+ */
+static SQLValueFunction *
+_readSQLValueFunction(void)
+{
+       READ_LOCALS(SQLValueFunction);
+
+       READ_ENUM_FIELD(op, SQLValueFunctionOp);
+       READ_OID_FIELD(type);
+       READ_INT_FIELD(typmod);
+       READ_LOCATION_FIELD(location);
+
+       READ_DONE();
+}
+
 /*
  * _readXmlExpr
  */
@@ -1152,6 +1216,20 @@ _readCurrentOfExpr(void)
        READ_DONE();
 }
 
+/*
+ * _readNextValueExpr
+ */
+static NextValueExpr *
+_readNextValueExpr(void)
+{
+       READ_LOCALS(NextValueExpr);
+
+       READ_OID_FIELD(seqid);
+       READ_OID_FIELD(typeId);
+
+       READ_DONE();
+}
+
 /*
  * _readInferenceElem
  */
@@ -1253,6 +1331,22 @@ _readOnConflictExpr(void)
        READ_DONE();
 }
 
+/*
+ * _readMergeAction
+ */
+static MergeAction *
+_readMergeAction(void)
+{
+       READ_LOCALS(MergeAction);
+
+       READ_BOOL_FIELD(matched);
+       READ_ENUM_FIELD(commandType, CmdType);
+       READ_NODE_FIELD(qual);
+       READ_NODE_FIELD(targetList);
+
+       READ_DONE();
+}
+
 /*
  *     Stuff from parsenodes.h.
  */
@@ -1289,17 +1383,30 @@ _readRangeTblEntry(void)
                        READ_NODE_FIELD(functions);
                        READ_BOOL_FIELD(funcordinality);
                        break;
+               case RTE_TABLEFUNC:
+                       READ_NODE_FIELD(tablefunc);
+                       break;
                case RTE_VALUES:
                        READ_NODE_FIELD(values_lists);
-                       READ_NODE_FIELD(values_collations);
+                       READ_NODE_FIELD(coltypes);
+                       READ_NODE_FIELD(coltypmods);
+                       READ_NODE_FIELD(colcollations);
                        break;
                case RTE_CTE:
                        READ_STRING_FIELD(ctename);
                        READ_UINT_FIELD(ctelevelsup);
                        READ_BOOL_FIELD(self_reference);
-                       READ_NODE_FIELD(ctecoltypes);
-                       READ_NODE_FIELD(ctecoltypmods);
-                       READ_NODE_FIELD(ctecolcollations);
+                       READ_NODE_FIELD(coltypes);
+                       READ_NODE_FIELD(coltypmods);
+                       READ_NODE_FIELD(colcollations);
+                       break;
+               case RTE_NAMEDTUPLESTORE:
+                       READ_STRING_FIELD(enrname);
+                       READ_FLOAT_FIELD(enrtuples);
+                       READ_OID_FIELD(relid);
+                       READ_NODE_FIELD(coltypes);
+                       READ_NODE_FIELD(coltypmods);
+                       READ_NODE_FIELD(colcollations);
                        break;
                default:
                        elog(ERROR, "unrecognized RTE kind: %d",
@@ -1366,6 +1473,7 @@ _readDefElem(void)
        READ_STRING_FIELD(defname);
        READ_NODE_FIELD(arg);
        READ_ENUM_FIELD(defaction, DefElemAction);
+       READ_LOCATION_FIELD(location);
 
        READ_DONE();
 }
@@ -1379,23 +1487,28 @@ _readPlannedStmt(void)
        READ_LOCALS(PlannedStmt);
 
        READ_ENUM_FIELD(commandType, CmdType);
-       READ_UINT_FIELD(queryId);
+       READ_UINT64_FIELD(queryId);
        READ_BOOL_FIELD(hasReturning);
        READ_BOOL_FIELD(hasModifyingCTE);
        READ_BOOL_FIELD(canSetTag);
        READ_BOOL_FIELD(transientPlan);
+       READ_BOOL_FIELD(dependsOnRole);
+       READ_BOOL_FIELD(parallelModeNeeded);
+       READ_BOOL_FIELD(jitFlags);
        READ_NODE_FIELD(planTree);
        READ_NODE_FIELD(rtable);
        READ_NODE_FIELD(resultRelations);
-       READ_NODE_FIELD(utilityStmt);
+       READ_NODE_FIELD(nonleafResultRelations);
+       READ_NODE_FIELD(rootResultRelations);
        READ_NODE_FIELD(subplans);
        READ_BITMAPSET_FIELD(rewindPlanIDs);
        READ_NODE_FIELD(rowMarks);
        READ_NODE_FIELD(relationOids);
        READ_NODE_FIELD(invalItems);
-       READ_INT_FIELD(nParamExec);
-       READ_BOOL_FIELD(hasRowSecurity);
-       READ_BOOL_FIELD(parallelModeNeeded);
+       READ_NODE_FIELD(paramExecTypes);
+       READ_NODE_FIELD(utilityStmt);
+       READ_LOCATION_FIELD(stmt_location);
+       READ_LOCATION_FIELD(stmt_len);
 
        READ_DONE();
 }
@@ -1413,6 +1526,8 @@ ReadCommonPlan(Plan *local_node)
        READ_FLOAT_FIELD(total_cost);
        READ_FLOAT_FIELD(plan_rows);
        READ_INT_FIELD(plan_width);
+       READ_BOOL_FIELD(parallel_aware);
+       READ_BOOL_FIELD(parallel_safe);
        READ_INT_FIELD(plan_node_id);
        READ_NODE_FIELD(targetlist);
        READ_NODE_FIELD(qual);
@@ -1451,6 +1566,19 @@ _readResult(void)
        READ_DONE();
 }
 
+/*
+ * _readProjectSet
+ */
+static ProjectSet *
+_readProjectSet(void)
+{
+       READ_LOCALS_NO_FIELDS(ProjectSet);
+
+       ReadCommonPlan(&local_node->plan);
+
+       READ_DONE();
+}
+
 /*
  * _readModifyTable
  */
@@ -1464,12 +1592,17 @@ _readModifyTable(void)
        READ_ENUM_FIELD(operation, CmdType);
        READ_BOOL_FIELD(canSetTag);
        READ_UINT_FIELD(nominalRelation);
+       READ_NODE_FIELD(partitioned_rels);
+       READ_BOOL_FIELD(partColsUpdated);
        READ_NODE_FIELD(resultRelations);
+       READ_INT_FIELD(mergeTargetRelation);
        READ_INT_FIELD(resultRelIndex);
+       READ_INT_FIELD(rootResultRelIndex);
        READ_NODE_FIELD(plans);
        READ_NODE_FIELD(withCheckOptionLists);
        READ_NODE_FIELD(returningLists);
        READ_NODE_FIELD(fdwPrivLists);
+       READ_BITMAPSET_FIELD(fdwDirectModifyPlans);
        READ_NODE_FIELD(rowMarks);
        READ_INT_FIELD(epqParam);
        READ_ENUM_FIELD(onConflictAction, OnConflictAction);
@@ -1478,6 +1611,27 @@ _readModifyTable(void)
        READ_NODE_FIELD(onConflictWhere);
        READ_UINT_FIELD(exclRelRTI);
        READ_NODE_FIELD(exclRelTlist);
+       READ_NODE_FIELD(mergeSourceTargetList);
+       READ_NODE_FIELD(mergeActionList);
+
+       READ_DONE();
+}
+
+/*
+ * _readMergeWhenClause
+ */
+static MergeWhenClause *
+_readMergeWhenClause(void)
+{
+       READ_LOCALS(MergeWhenClause);
+
+       READ_BOOL_FIELD(matched);
+       READ_ENUM_FIELD(commandType, CmdType);
+       READ_NODE_FIELD(condition);
+       READ_NODE_FIELD(targetList);
+       READ_NODE_FIELD(cols);
+       READ_NODE_FIELD(values);
+       READ_ENUM_FIELD(override, OverridingKind);
 
        READ_DONE();
 }
@@ -1492,7 +1646,9 @@ _readAppend(void)
 
        ReadCommonPlan(&local_node->plan);
 
+       READ_NODE_FIELD(partitioned_rels);
        READ_NODE_FIELD(appendplans);
+       READ_INT_FIELD(first_partial_plan);
 
        READ_DONE();
 }
@@ -1507,6 +1663,7 @@ _readMergeAppend(void)
 
        ReadCommonPlan(&local_node->plan);
 
+       READ_NODE_FIELD(partitioned_rels);
        READ_NODE_FIELD(mergeplans);
        READ_INT_FIELD(numCols);
        READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
@@ -1561,6 +1718,7 @@ _readBitmapOr(void)
 
        ReadCommonPlan(&local_node->plan);
 
+       READ_BOOL_FIELD(isshared);
        READ_NODE_FIELD(bitmapplans);
 
        READ_DONE();
@@ -1672,6 +1830,7 @@ _readBitmapIndexScan(void)
        ReadCommonScan(&local_node->scan);
 
        READ_OID_FIELD(indexid);
+       READ_BOOL_FIELD(isshared);
        READ_NODE_FIELD(indexqual);
        READ_NODE_FIELD(indexqualorig);
 
@@ -1754,6 +1913,21 @@ _readValuesScan(void)
        READ_DONE();
 }
 
+/*
+ * _readTableFuncScan
+ */
+static TableFuncScan *
+_readTableFuncScan(void)
+{
+       READ_LOCALS(TableFuncScan);
+
+       ReadCommonScan(&local_node->scan);
+
+       READ_NODE_FIELD(tablefunc);
+
+       READ_DONE();
+}
+
 /*
  * _readCteScan
  */
@@ -1795,16 +1969,47 @@ _readForeignScan(void)
 
        ReadCommonScan(&local_node->scan);
 
+       READ_ENUM_FIELD(operation, CmdType);
        READ_OID_FIELD(fs_server);
        READ_NODE_FIELD(fdw_exprs);
        READ_NODE_FIELD(fdw_private);
        READ_NODE_FIELD(fdw_scan_tlist);
+       READ_NODE_FIELD(fdw_recheck_quals);
        READ_BITMAPSET_FIELD(fs_relids);
        READ_BOOL_FIELD(fsSystemCol);
 
        READ_DONE();
 }
 
+/*
+ * _readCustomScan
+ */
+static CustomScan *
+_readCustomScan(void)
+{
+       READ_LOCALS(CustomScan);
+       char       *custom_name;
+       const CustomScanMethods *methods;
+
+       ReadCommonScan(&local_node->scan);
+
+       READ_UINT_FIELD(flags);
+       READ_NODE_FIELD(custom_plans);
+       READ_NODE_FIELD(custom_exprs);
+       READ_NODE_FIELD(custom_private);
+       READ_NODE_FIELD(custom_scan_tlist);
+       READ_BITMAPSET_FIELD(custom_relids);
+
+       /* Lookup CustomScanMethods by CustomName */
+       token = pg_strtok(&length); /* skip methods: */
+       token = pg_strtok(&length); /* CustomName */
+       custom_name = nullable_string(token, length);
+       methods = GetCustomScanMethods(custom_name, false);
+       local_node->methods = methods;
+
+       READ_DONE();
+}
+
 /*
  * ReadCommonJoin
  *     Assign the basic stuff of all nodes that inherit from Join
@@ -1817,6 +2022,7 @@ ReadCommonJoin(Join *local_node)
        ReadCommonPlan(&local_node->plan);
 
        READ_ENUM_FIELD(jointype, JoinType);
+       READ_BOOL_FIELD(inner_unique);
        READ_NODE_FIELD(joinqual);
 }
 
@@ -1860,6 +2066,7 @@ _readMergeJoin(void)
 
        ReadCommonJoin(&local_node->join);
 
+       READ_BOOL_FIELD(skip_mark_restore);
        READ_NODE_FIELD(mergeclauses);
 
        numCols = list_length(local_node->mergeclauses);
@@ -1947,10 +2154,12 @@ _readAgg(void)
        ReadCommonPlan(&local_node->plan);
 
        READ_ENUM_FIELD(aggstrategy, AggStrategy);
+       READ_ENUM_FIELD(aggsplit, AggSplit);
        READ_INT_FIELD(numCols);
        READ_ATTRNUMBER_ARRAY(grpColIdx, local_node->numCols);
        READ_OID_ARRAY(grpOperators, local_node->numCols);
        READ_LONG_FIELD(numGroups);
+       READ_BITMAPSET_FIELD(aggParams);
        READ_NODE_FIELD(groupingSets);
        READ_NODE_FIELD(chain);
 
@@ -1977,6 +2186,11 @@ _readWindowAgg(void)
        READ_INT_FIELD(frameOptions);
        READ_NODE_FIELD(startOffset);
        READ_NODE_FIELD(endOffset);
+       READ_OID_FIELD(startInRangeFunc);
+       READ_OID_FIELD(endInRangeFunc);
+       READ_OID_FIELD(inRangeColl);
+       READ_BOOL_FIELD(inRangeAsc);
+       READ_BOOL_FIELD(inRangeNullsFirst);
 
        READ_DONE();
 }
@@ -1998,6 +2212,47 @@ _readUnique(void)
        READ_DONE();
 }
 
+/*
+ * _readGather
+ */
+static Gather *
+_readGather(void)
+{
+       READ_LOCALS(Gather);
+
+       ReadCommonPlan(&local_node->plan);
+
+       READ_INT_FIELD(num_workers);
+       READ_INT_FIELD(rescan_param);
+       READ_BOOL_FIELD(single_copy);
+       READ_BOOL_FIELD(invisible);
+       READ_BITMAPSET_FIELD(initParam);
+
+       READ_DONE();
+}
+
+/*
+ * _readGatherMerge
+ */
+static GatherMerge *
+_readGatherMerge(void)
+{
+       READ_LOCALS(GatherMerge);
+
+       ReadCommonPlan(&local_node->plan);
+
+       READ_INT_FIELD(num_workers);
+       READ_INT_FIELD(rescan_param);
+       READ_INT_FIELD(numCols);
+       READ_ATTRNUMBER_ARRAY(sortColIdx, local_node->numCols);
+       READ_OID_ARRAY(sortOperators, local_node->numCols);
+       READ_OID_ARRAY(collations, local_node->numCols);
+       READ_BOOL_ARRAY(nullsFirst, local_node->numCols);
+       READ_BITMAPSET_FIELD(initParam);
+
+       READ_DONE();
+}
+
 /*
  * _readHash
  */
@@ -2011,8 +2266,7 @@ _readHash(void)
        READ_OID_FIELD(skewTable);
        READ_INT_FIELD(skewColumn);
        READ_BOOL_FIELD(skewInherit);
-       READ_OID_FIELD(skewColType);
-       READ_INT_FIELD(skewColTypmod);
+       READ_FLOAT_FIELD(rows_total);
 
        READ_DONE();
 }
@@ -2137,6 +2391,7 @@ _readSubPlan(void)
        READ_OID_FIELD(firstColCollation);
        READ_BOOL_FIELD(useHashTable);
        READ_BOOL_FIELD(unknownEqFalse);
+       READ_BOOL_FIELD(parallel_safe);
        READ_NODE_FIELD(setParam);
        READ_NODE_FIELD(parParam);
        READ_NODE_FIELD(args);
@@ -2159,6 +2414,71 @@ _readAlternativeSubPlan(void)
        READ_DONE();
 }
 
+/*
+ * _readExtensibleNode
+ */
+static ExtensibleNode *
+_readExtensibleNode(void)
+{
+       const ExtensibleNodeMethods *methods;
+       ExtensibleNode *local_node;
+       const char *extnodename;
+
+       READ_TEMP_LOCALS();
+
+       token = pg_strtok(&length); /* skip :extnodename */
+       token = pg_strtok(&length); /* get extnodename */
+
+       extnodename = nullable_string(token, length);
+       if (!extnodename)
+               elog(ERROR, "extnodename has to be supplied");
+       methods = GetExtensibleNodeMethods(extnodename, false);
+
+       local_node = (ExtensibleNode *) newNode(methods->node_size,
+                                                                                       T_ExtensibleNode);
+       local_node->extnodename = extnodename;
+
+       /* deserialize the private fields */
+       methods->nodeRead(local_node);
+
+       READ_DONE();
+}
+
+/*
+ * _readPartitionBoundSpec
+ */
+static PartitionBoundSpec *
+_readPartitionBoundSpec(void)
+{
+       READ_LOCALS(PartitionBoundSpec);
+
+       READ_CHAR_FIELD(strategy);
+       READ_BOOL_FIELD(is_default);
+       READ_INT_FIELD(modulus);
+       READ_INT_FIELD(remainder);
+       READ_NODE_FIELD(listdatums);
+       READ_NODE_FIELD(lowerdatums);
+       READ_NODE_FIELD(upperdatums);
+       READ_LOCATION_FIELD(location);
+
+       READ_DONE();
+}
+
+/*
+ * _readPartitionRangeDatum
+ */
+static PartitionRangeDatum *
+_readPartitionRangeDatum(void)
+{
+       READ_LOCALS(PartitionRangeDatum);
+
+       READ_ENUM_FIELD(kind, PartitionRangeDatumKind);
+       READ_NODE_FIELD(value);
+       READ_LOCATION_FIELD(location);
+
+       READ_DONE();
+}
+
 /*
  * parseNodeString
  *
@@ -2201,6 +2521,8 @@ parseNodeString(void)
                return_value = _readRangeVar();
        else if (MATCH("INTOCLAUSE", 10))
                return_value = _readIntoClause();
+       else if (MATCH("TABLEFUNC", 9))
+               return_value = _readTableFunc();
        else if (MATCH("VAR", 3))
                return_value = _readVar();
        else if (MATCH("CONST", 5))
@@ -2261,6 +2583,8 @@ parseNodeString(void)
                return_value = _readCoalesceExpr();
        else if (MATCH("MINMAX", 6))
                return_value = _readMinMaxExpr();
+       else if (MATCH("SQLVALUEFUNCTION", 16))
+               return_value = _readSQLValueFunction();
        else if (MATCH("XMLEXPR", 7))
                return_value = _readXmlExpr();
        else if (MATCH("NULLTEST", 8))
@@ -2275,6 +2599,8 @@ parseNodeString(void)
                return_value = _readSetToDefault();
        else if (MATCH("CURRENTOFEXPR", 13))
                return_value = _readCurrentOfExpr();
+       else if (MATCH("NEXTVALUEEXPR", 13))
+               return_value = _readNextValueExpr();
        else if (MATCH("INFERENCEELEM", 13))
                return_value = _readInferenceElem();
        else if (MATCH("TARGETENTRY", 11))
@@ -2287,6 +2613,8 @@ parseNodeString(void)
                return_value = _readFromExpr();
        else if (MATCH("ONCONFLICTEXPR", 14))
                return_value = _readOnConflictExpr();
+       else if (MATCH("MERGEACTION", 11))
+               return_value = _readMergeAction();
        else if (MATCH("RTE", 3))
                return_value = _readRangeTblEntry();
        else if (MATCH("RANGETBLFUNCTION", 16))
@@ -2305,8 +2633,12 @@ parseNodeString(void)
                return_value = _readPlan();
        else if (MATCH("RESULT", 6))
                return_value = _readResult();
+       else if (MATCH("PROJECTSET", 10))
+               return_value = _readProjectSet();
        else if (MATCH("MODIFYTABLE", 11))
                return_value = _readModifyTable();
+       else if (MATCH("MERGEWHENCLAUSE", 15))
+               return_value = _readMergeWhenClause();
        else if (MATCH("APPEND", 6))
                return_value = _readAppend();
        else if (MATCH("MERGEAPPEND", 11))
@@ -2339,12 +2671,16 @@ parseNodeString(void)
                return_value = _readFunctionScan();
        else if (MATCH("VALUESSCAN", 10))
                return_value = _readValuesScan();
+       else if (MATCH("TABLEFUNCSCAN", 13))
+               return_value = _readTableFuncScan();
        else if (MATCH("CTESCAN", 7))
                return_value = _readCteScan();
        else if (MATCH("WORKTABLESCAN", 13))
                return_value = _readWorkTableScan();
        else if (MATCH("FOREIGNSCAN", 11))
                return_value = _readForeignScan();
+       else if (MATCH("CUSTOMSCAN", 10))
+               return_value = _readCustomScan();
        else if (MATCH("JOIN", 4))
                return_value = _readJoin();
        else if (MATCH("NESTLOOP", 8))
@@ -2365,6 +2701,10 @@ parseNodeString(void)
                return_value = _readWindowAgg();
        else if (MATCH("UNIQUE", 6))
                return_value = _readUnique();
+       else if (MATCH("GATHER", 6))
+               return_value = _readGather();
+       else if (MATCH("GATHERMERGE", 11))
+               return_value = _readGatherMerge();
        else if (MATCH("HASH", 4))
                return_value = _readHash();
        else if (MATCH("SETOP", 5))
@@ -2383,6 +2723,12 @@ parseNodeString(void)
                return_value = _readSubPlan();
        else if (MATCH("ALTERNATIVESUBPLAN", 18))
                return_value = _readAlternativeSubPlan();
+       else if (MATCH("EXTENSIBLENODE", 14))
+               return_value = _readExtensibleNode();
+       else if (MATCH("PARTITIONBOUNDSPEC", 18))
+               return_value = _readPartitionBoundSpec();
+       else if (MATCH("PARTITIONRANGEDATUM", 19))
+               return_value = _readPartitionRangeDatum();
        else
        {
                elog(ERROR, "badly formatted node string \"%.32s\"...", token);
@@ -2400,7 +2746,7 @@ parseNodeString(void)
  * Datum.  The string representation embeds length info, but not byValue,
  * so we must be told that.
  */
-static Datum
+Datum
 readDatum(bool typbyval)
 {
        Size            length,
@@ -2457,7 +2803,7 @@ readDatum(bool typbyval)
 /*
  * readAttrNumberCols
  */
-static AttrNumber *
+AttrNumber *
 readAttrNumberCols(int numCols)
 {
        int                     tokenLength,
@@ -2481,7 +2827,7 @@ readAttrNumberCols(int numCols)
 /*
  * readOidCols
  */
-static Oid *
+Oid *
 readOidCols(int numCols)
 {
        int                     tokenLength,
@@ -2505,7 +2851,7 @@ readOidCols(int numCols)
 /*
  * readIntCols
  */
-static int *
+int *
 readIntCols(int numCols)
 {
        int                     tokenLength,
@@ -2529,7 +2875,7 @@ readIntCols(int numCols)
 /*
  * readBoolCols
  */
-static bool *
+bool *
 readBoolCols(int numCols)
 {
        int                     tokenLength,