This is an automated email from the ASF dual-hosted git repository.

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new 3d5c47b0642 Reset copyfuncs.c equalfuncs.c outfuncs.c readfuncs.c to 
old main
3d5c47b0642 is described below

commit 3d5c47b0642cb00fcb512023ba0800a526dbe716
Author: Jinbao Chen <[email protected]>
AuthorDate: Sun Sep 21 20:48:14 2025 +0800

    Reset copyfuncs.c equalfuncs.c outfuncs.c readfuncs.c to old main
---
 src/backend/nodes/copyfuncs.c  | 147 ++++++------
 src/backend/nodes/equalfuncs.c | 124 ++++++----
 src/backend/nodes/outfuncs.c   | 471 +++++++++++---------------------------
 src/backend/nodes/readfuncs.c  | 503 ++++++++++++-----------------------------
 4 files changed, 436 insertions(+), 809 deletions(-)

diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 8e24f550ddd..18ffeb3f784 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -3,14 +3,16 @@
  * copyfuncs.c
  *       Copy functions for Postgres tree nodes.
  *
+ * NOTE: we currently support copying all node types found in parse and
+ * plan trees.  We do not support copying executor state trees; there
+ * is no need for that, and no point in maintaining all the code that
+ * would be needed.  We also do not support copying Path trees, mainly
+ * because the circular linkages between RelOptInfo and Path nodes can't
+ * be handled easily in a simple depth-first traversal.
  *
-<<<<<<< HEAD
  *
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
- * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
@@ -24,7 +26,6 @@
 #include "catalog/gp_distribution_policy.h"
 #include "catalog/heap.h"
 #include "miscadmin.h"
-<<<<<<< HEAD
 #include "nodes/altertablenodes.h"
 #include "nodes/extensible.h"
 #include "nodes/pathnodes.h"
@@ -32,9 +33,6 @@
 #include "utils/datum.h"
 #include "cdb/cdbgang.h"
 #include "utils/rel.h"
-=======
-#include "utils/datum.h"
->>>>>>> REL_16_9
 
 /*
  * Macros to simplify copying of different kinds of fields.  Use these
@@ -58,10 +56,6 @@
 #define COPY_STRING_FIELD(fldname) \
        (newnode->fldname = from->fldname ? pstrdup(from->fldname) : (char *) 
NULL)
 
-/* Copy a field that is an inline array */
-#define COPY_ARRAY_FIELD(fldname) \
-       memcpy(newnode->fldname, from->fldname, sizeof(newnode->fldname))
-
 /* Copy a field that is a pointer to a simple palloc'd object of size sz */
 #define COPY_POINTER_FIELD(fldname, sz) \
        do { \
@@ -71,7 +65,6 @@
                        newnode->fldname = palloc(_size); \
                        memcpy(newnode->fldname, from->fldname, _size); \
                } \
-<<<<<<< HEAD
        } while (0)
 
 #define COPY_BINARY_FIELD(fldname, sz) \
@@ -88,8 +81,6 @@
                        newnode->fldname = (bytea *) DatumGetPointer( \
                                        
datumCopy(PointerGetDatum(from->fldname), false, len)); \
                } \
-=======
->>>>>>> REL_16_9
        } while (0)
 
 /* Copy a parse location field (for Copy, this is same as scalar case) */
@@ -97,7 +88,6 @@
        (newnode->fldname = from->fldname)
 
 
-<<<<<<< HEAD
 /* ****************************************************************
  *                                      plannodes.h copy functions
  * ****************************************************************
@@ -1986,15 +1976,6 @@ _copyVar(const Var *from)
 /*
  * _copyConst
  */
-=======
-#include "copyfuncs.funcs.c"
-
-
-/*
- * Support functions for nodes with custom_copy_equal attribute
- */
-
->>>>>>> REL_16_9
 static Const *
 _copyConst(const Const *from)
 {
@@ -2030,7 +2011,6 @@ _copyConst(const Const *from)
        return newnode;
 }
 
-<<<<<<< HEAD
 /*
  * _copyParam
  */
@@ -3373,40 +3353,30 @@ _copyParamRef(const ParamRef *from)
        return newnode;
 }
 
-=======
->>>>>>> REL_16_9
 static A_Const *
-_copyA_Const(const A_Const *from)
+_copyAConst(const A_Const *from)
 {
        A_Const    *newnode = makeNode(A_Const);
 
-       COPY_SCALAR_FIELD(isnull);
-       if (!from->isnull)
+       /* This part must duplicate _copyValue */
+       COPY_SCALAR_FIELD(val.type);
+       switch (from->val.type)
        {
-               /* This part must duplicate other _copy*() functions. */
-               COPY_SCALAR_FIELD(val.node.type);
-               switch (nodeTag(&from->val))
-               {
-                       case T_Integer:
-                               COPY_SCALAR_FIELD(val.ival.ival);
-                               break;
-                       case T_Float:
-                               COPY_STRING_FIELD(val.fval.fval);
-                               break;
-                       case T_Boolean:
-                               COPY_SCALAR_FIELD(val.boolval.boolval);
-                               break;
-                       case T_String:
-                               COPY_STRING_FIELD(val.sval.sval);
-                               break;
-                       case T_BitString:
-                               COPY_STRING_FIELD(val.bsval.bsval);
-                               break;
-                       default:
-                               elog(ERROR, "unrecognized node type: %d",
-                                        (int) nodeTag(&from->val));
-                               break;
-               }
+               case T_Integer:
+                       COPY_SCALAR_FIELD(val.val.ival);
+                       break;
+               case T_Float:
+               case T_String:
+               case T_BitString:
+                       COPY_STRING_FIELD(val.val.str);
+                       break;
+               case T_Null:
+                       /* nothing to do */
+                       break;
+               default:
+                       elog(ERROR, "unrecognized node type: %d",
+                                (int) from->val.type);
+                       break;
        }
 
        COPY_LOCATION_FIELD(location);
@@ -3414,7 +3384,6 @@ _copyA_Const(const A_Const *from)
        return newnode;
 }
 
-<<<<<<< HEAD
 static FuncCall *
 _copyFuncCall(const FuncCall *from)
 {
@@ -6234,8 +6203,6 @@ _copyDropSubscriptionStmt(const DropSubscriptionStmt 
*from)
  *                                     extensible.h copy functions
  * ****************************************************************
  */
-=======
->>>>>>> REL_16_9
 static ExtensibleNode *
 _copyExtensibleNode(const ExtensibleNode *from)
 {
@@ -6253,10 +6220,55 @@ _copyExtensibleNode(const ExtensibleNode *from)
        return newnode;
 }
 
-static Bitmapset *
-_copyBitmapset(const Bitmapset *from)
+/* ****************************************************************
+ *                                     value.h copy functions
+ * ****************************************************************
+ */
+static Value *
+_copyValue(const Value *from)
+{
+       Value      *newnode = makeNode(Value);
+
+       /* See also _copyAConst when changing this code! */
+
+       COPY_SCALAR_FIELD(type);
+       switch (from->type)
+       {
+               case T_Integer:
+                       COPY_SCALAR_FIELD(val.ival);
+                       break;
+               case T_Float:
+               case T_String:
+               case T_BitString:
+                       COPY_STRING_FIELD(val.str);
+                       break;
+               case T_Null:
+                       /* nothing to do */
+                       break;
+               default:
+                       elog(ERROR, "unrecognized node type: %d",
+                                (int) from->type);
+                       break;
+       }
+       return newnode;
+}
+
+
+static ForeignKeyCacheInfo *
+_copyForeignKeyCacheInfo(const ForeignKeyCacheInfo *from)
 {
-       return bms_copy(from);
+       ForeignKeyCacheInfo *newnode = makeNode(ForeignKeyCacheInfo);
+
+       COPY_SCALAR_FIELD(conoid);
+       COPY_SCALAR_FIELD(conrelid);
+       COPY_SCALAR_FIELD(confrelid);
+       COPY_SCALAR_FIELD(nkeys);
+       /* COPY_SCALAR_FIELD might work for these, but let's not assume that */
+       memcpy(newnode->conkey, from->conkey, sizeof(newnode->conkey));
+       memcpy(newnode->confkey, from->confkey, sizeof(newnode->confkey));
+       memcpy(newnode->conpfeqop, from->conpfeqop, sizeof(newnode->conpfeqop));
+
+       return newnode;
 }
 
 static AggExprId*
@@ -6385,7 +6397,6 @@ copyObjectImpl(const void *from)
 
        switch (nodeTag(from))
        {
-<<<<<<< HEAD
                        /*
                         * PLAN NODES
                         */
@@ -6823,25 +6834,19 @@ copyObjectImpl(const void *from)
                        /*
                         * LIST NODES
                         */
-=======
-#include "copyfuncs.switch.c"
-
->>>>>>> REL_16_9
                case T_List:
                        retval = list_copy_deep(from);
                        break;
 
                        /*
-                        * Lists of integers, OIDs and XIDs don't need to be 
deep-copied,
-                        * so we perform a shallow copy via list_copy()
+                        * Lists of integers and OIDs don't need to be 
deep-copied, so we
+                        * perform a shallow copy via list_copy()
                         */
                case T_IntList:
                case T_OidList:
-               case T_XidList:
                        retval = list_copy(from);
                        break;
 
-<<<<<<< HEAD
                        /*
                         * EXTENSIBLE NODES
                         */
@@ -7553,8 +7558,6 @@ copyObjectImpl(const void *from)
                case T_EphemeralNamedRelationInfo:
                        retval = _copyEphemeralNamedRelationInfo(from);
                        break;
-=======
->>>>>>> REL_16_9
                default:
                        elog(ERROR, "unrecognized node type: %d", (int) 
nodeTag(from));
                        retval = 0;                     /* keep compiler quiet 
*/
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 9c81624c082..9981c2fd023 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -3,18 +3,24 @@
  * equalfuncs.c
  *       Equality functions to compare node trees.
  *
+ * NOTE: we currently support comparing all node types found in parse
+ * trees.  We do not support comparing executor state trees; there
+ * is no need for that, and no point in maintaining all the code that
+ * would be needed.  We also do not support comparing Path trees, mainly
+ * because the circular linkages between RelOptInfo and Path nodes can't
+ * be handled easily in a simple depth-first traversal.
+ *
+ * Currently, in fact, equal() doesn't know how to compare Plan trees
+ * either.  This might need to be fixed someday.
+ *
  * NOTE: it is intentional that parse location fields (in nodes that have
  * one) are not compared.  This is because we want, for example, a variable
  * "x" to be considered equal() to another reference to "x" in the query.
  *
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2005-2010, Greenplum inc
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
- * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
@@ -26,6 +32,8 @@
 #include "postgres.h"
 
 #include "miscadmin.h"
+#include "nodes/extensible.h"
+#include "nodes/pathnodes.h"
 #include "utils/datum.h"
 #include "catalog/gp_distribution_policy.h"
 
@@ -69,13 +77,6 @@
 #define equalstr(a, b) \
        (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b))
 
-/* Compare a field that is an inline array */
-#define COMPARE_ARRAY_FIELD(fldname) \
-       do { \
-               if (memcmp(a->fldname, b->fldname, sizeof(a->fldname)) != 0) \
-                       return false; \
-       } while (0)
-
 /* Compare a field that is a pointer to a simple palloc'd object of size sz */
 #define COMPARE_POINTER_FIELD(fldname, sz) \
        do { \
@@ -109,9 +110,10 @@
        ((void) 0)
 
 
-#include "equalfuncs.funcs.c"
+/*
+ *     Stuff from primnodes.h
+ */
 
-<<<<<<< HEAD
 static bool
 _equalAlias(const Alias *a, const Alias *b)
 {
@@ -177,13 +179,34 @@ _equalIntoClause(const IntoClause *a, const IntoClause *b)
        COMPARE_STRING_FIELD(schedule);
        return true;
 }
-=======
->>>>>>> REL_16_9
 
 /*
- * Support functions for nodes with custom_copy_equal attribute
+ * We don't need an _equalExpr because Expr is an abstract supertype which
+ * should never actually get instantiated.  Also, since it has no common
+ * fields except NodeTag, there's no need for a helper routine to factor
+ * out comparing the common fields...
  */
 
+static bool
+_equalVar(const Var *a, const Var *b)
+{
+       COMPARE_SCALAR_FIELD(varno);
+       COMPARE_SCALAR_FIELD(varattno);
+       COMPARE_SCALAR_FIELD(vartype);
+       COMPARE_SCALAR_FIELD(vartypmod);
+       COMPARE_SCALAR_FIELD(varcollid);
+       COMPARE_SCALAR_FIELD(varlevelsup);
+
+       /*
+        * varnosyn/varattnosyn are intentionally ignored here, because Vars 
with
+        * different syntactic identifiers are semantically the same as long as
+        * their varno/varattno match.
+        */
+       COMPARE_LOCATION_FIELD(location);
+
+       return true;
+}
+
 static bool
 _equalConst(const Const *a, const Const *b)
 {
@@ -206,7 +229,6 @@ _equalConst(const Const *a, const Const *b)
 }
 
 static bool
-<<<<<<< HEAD
 _equalParam(const Param *a, const Param *b)
 {
        COMPARE_SCALAR_FIELD(paramkind);
@@ -982,8 +1004,6 @@ _equalPlaceHolderInfo(const PlaceHolderInfo *a, const 
PlaceHolderInfo *b)
  * Stuff from extensible.h
  */
 static bool
-=======
->>>>>>> REL_16_9
 _equalExtensibleNode(const ExtensibleNode *a, const ExtensibleNode *b)
 {
        const ExtensibleNodeMethods *methods;
@@ -1000,10 +1020,13 @@ _equalExtensibleNode(const ExtensibleNode *a, const 
ExtensibleNode *b)
        return true;
 }
 
+/*
+ * Stuff from parsenodes.h
+ */
+
 static bool
-_equalA_Const(const A_Const *a, const A_Const *b)
+_equalQuery(const Query *a, const Query *b)
 {
-<<<<<<< HEAD
        COMPARE_SCALAR_FIELD(commandType);
        COMPARE_SCALAR_FIELD(querySource);
        /* we intentionally ignore queryId, since it might not be set */
@@ -2798,12 +2821,6 @@ static bool
 _equalAConst(const A_Const *a, const A_Const *b)
 {
        if (!equal(&a->val, &b->val))   /* hack for in-line Value field */
-=======
-       COMPARE_SCALAR_FIELD(isnull);
-       /* Hack for in-line val field.  Also val is not valid if isnull is true 
*/
-       if (!a->isnull &&
-               !equal(&a->val, &b->val))
->>>>>>> REL_16_9
                return false;
        COMPARE_LOCATION_FIELD(location);
 
@@ -2811,9 +2828,8 @@ _equalAConst(const A_Const *a, const A_Const *b)
 }
 
 static bool
-_equalBitmapset(const Bitmapset *a, const Bitmapset *b)
+_equalFuncCall(const FuncCall *a, const FuncCall *b)
 {
-<<<<<<< HEAD
        COMPARE_NODE_FIELD(funcname);
        COMPARE_NODE_FIELD(args);
        COMPARE_NODE_FIELD(agg_order);
@@ -3449,9 +3465,6 @@ _equalPartitionCmd(const PartitionCmd *a, const 
PartitionCmd *b)
        COMPARE_SCALAR_FIELD(concurrent);
 
        return true;
-=======
-       return bms_equal(a, b);
->>>>>>> REL_16_9
 }
 
 static bool
@@ -3519,8 +3532,9 @@ _equalDropTaskStmt(const DropTaskStmt *a, const 
DropTaskStmt *b)
 }
 
 /*
- * Lists are handled specially
+ * Stuff from pg_list.h
  */
+
 static bool
 _equalList(const List *a, const List *b)
 {
@@ -3561,13 +3575,6 @@ _equalList(const List *a, const List *b)
                                        return false;
                        }
                        break;
-               case T_XidList:
-                       forboth(item_a, a, item_b, b)
-                       {
-                               if (lfirst_xid(item_a) != lfirst_xid(item_b))
-                                       return false;
-                       }
-                       break;
                default:
                        elog(ERROR, "unrecognized list node type: %d",
                                 (int) a->type);
@@ -3583,6 +3590,35 @@ _equalList(const List *a, const List *b)
        return true;
 }
 
+/*
+ * Stuff from value.h
+ */
+
+static bool
+_equalValue(const Value *a, const Value *b)
+{
+       COMPARE_SCALAR_FIELD(type);
+
+       switch (a->type)
+       {
+               case T_Integer:
+                       COMPARE_SCALAR_FIELD(val.ival);
+                       break;
+               case T_Float:
+               case T_String:
+               case T_BitString:
+                       COMPARE_STRING_FIELD(val.str);
+                       break;
+               case T_Null:
+                       /* nothing to do */
+                       break;
+               default:
+                       elog(ERROR, "unrecognized node type: %d", (int) 
a->type);
+                       break;
+       }
+
+       return true;
+}
 
 /*
  * equal
@@ -3613,7 +3649,6 @@ equal(const void *a, const void *b)
 
        switch (nodeTag(a))
        {
-<<<<<<< HEAD
                        /*
                         * PRIMITIVE NODES
                         */
@@ -3801,18 +3836,13 @@ equal(const void *a, const void *b)
                case T_PlaceHolderInfo:
                        retval = _equalPlaceHolderInfo(a, b);
                        break;
-=======
-#include "equalfuncs.switch.c"
->>>>>>> REL_16_9
 
                case T_List:
                case T_IntList:
                case T_OidList:
-               case T_XidList:
                        retval = _equalList(a, b);
                        break;
 
-<<<<<<< HEAD
                case T_Integer:
                case T_Float:
                case T_String:
@@ -4471,8 +4501,6 @@ equal(const void *a, const void *b)
                        retval = _equalDropTaskStmt(a, b);
                        break;
 
-=======
->>>>>>> REL_16_9
                default:
                        elog(ERROR, "unrecognized node type: %d",
                                 (int) nodeTag(a));
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index ea6d5700daf..38f34f40b62 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -3,20 +3,15 @@
  * outfuncs.c
  *       Output functions for Postgres tree nodes.
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2005-2010, Greenplum inc
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
- * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
  * IDENTIFICATION
  *       src/backend/nodes/outfuncs.c
  *
-<<<<<<< HEAD
  * NOTES
  *       Every node type that can appear in stored rules' parsetrees *must*
  *       have an output function defined here (as well as an input function
@@ -34,22 +29,19 @@
  *         are supplied in outfast.c for use in Greenplum Database 
serialization.  The
  *         function in this file are intended to produce legible output.
  *
-=======
->>>>>>> REL_16_9
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
 
 #include <ctype.h>
 
-#include "access/attnum.h"
-#include "common/shortest_dec.h"
 #include "lib/stringinfo.h"
 #include "miscadmin.h"
-#include "nodes/bitmapset.h"
-#include "nodes/nodes.h"
-#include "nodes/pg_list.h"
+#include "nodes/extensible.h"
+#include "nodes/pathnodes.h"
+#include "nodes/plannodes.h"
 #include "utils/datum.h"
+#include "utils/rel.h"
 
 #include "cdb/cdbgang.h"
 #include "nodes/altertablenodes.h"
@@ -62,7 +54,6 @@
  */
 #ifndef COMPILING_BINARY_FUNCS
 static void outChar(StringInfo str, char c);
-static void outDouble(StringInfo str, double d);
 
 
 /*
@@ -107,10 +98,9 @@ static void outDouble(StringInfo str, double d);
        appendStringInfo(str, " :" CppAsString(fldname) " %d", \
                                         (int) node->fldname)
 
-/* Write a float field (actually, they're double) */
-#define WRITE_FLOAT_FIELD(fldname) \
-       (appendStringInfo(str, " :" CppAsString(fldname) " "), \
-        outDouble(str, node->fldname))
+/* Write a float field --- caller must give format to define precision */
+#define WRITE_FLOAT_FIELD(fldname,format) \
+       appendStringInfo(str, " :" CppAsString(fldname) " " format, 
node->fldname)
 
 /* Write a boolean field */
 #define WRITE_BOOL_FIELD(fldname) \
@@ -136,34 +126,28 @@ static void outDouble(StringInfo str, double d);
        (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
         outBitmapset(str, node->fldname))
 
-/* Write a variable-length array (not a List) of Node pointers */
-#define WRITE_NODE_ARRAY(fldname, len) \
-       (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
-        writeNodeArray(str, (const Node * const *) node->fldname, len))
-
-/* Write a variable-length array of AttrNumber */
 #define WRITE_ATTRNUMBER_ARRAY(fldname, len) \
-       (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
-        writeAttrNumberCols(str, node->fldname, len))
+       do { \
+               appendStringInfoString(str, " :" CppAsString(fldname) " "); \
+               for (int i = 0; i < len; i++) \
+                       appendStringInfo(str, " %d", node->fldname[i]); \
+       } while(0)
 
-/* Write a variable-length array of Oid */
 #define WRITE_OID_ARRAY(fldname, len) \
-       (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
-        writeOidCols(str, node->fldname, len))
-
-/* Write a variable-length array of Index */
-#define WRITE_INDEX_ARRAY(fldname, len) \
-       (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
-        writeIndexCols(str, node->fldname, len))
+       do { \
+               appendStringInfoString(str, " :" CppAsString(fldname) " "); \
+               for (int i = 0; i < len; i++) \
+                       appendStringInfo(str, " %u", node->fldname[i]); \
+       } while(0)
 
-/* Write a variable-length array of int */
 #define WRITE_INT_ARRAY(fldname, len) \
-       (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
-        writeIntCols(str, node->fldname, len))
+       do { \
+               appendStringInfoString(str, " :" CppAsString(fldname) " "); \
+               for (int i = 0; i < len; i++) \
+                       appendStringInfo(str, " %d", node->fldname[i]); \
+       } while(0)
 
-/* Write a variable-length array of bool */
 #define WRITE_BOOL_ARRAY(fldname, len) \
-<<<<<<< HEAD
        do { \
                appendStringInfoString(str, " :" CppAsString(fldname) " "); \
                for (int i = 0; i < len; i++) \
@@ -181,10 +165,6 @@ static void outDouble(StringInfo str, double d);
 
 static void _outCdbPathLocus(StringInfo str, const CdbPathLocus *node);
 #endif /* COMPILING_BINARY_FUNCS */
-=======
-       (appendStringInfoString(str, " :" CppAsString(fldname) " "), \
-        writeBoolCols(str, node->fldname, len))
->>>>>>> REL_16_9
 
 #define booltostr(x)  ((x) ? "true" : "false")
 
@@ -195,23 +175,16 @@ static void _outCdbPathLocus(StringInfo str, const 
CdbPathLocus *node);
  *       Convert an ordinary string (eg, an identifier) into a form that
  *       will be decoded back to a plain token by read.c's functions.
  *
- *       If a null string pointer is given, it is encoded as '<>'.
- *       An empty string is encoded as '""'.  To avoid ambiguity, input
- *       strings beginning with '<' or '"' receive a leading backslash.
+ *       If a null or empty string is given, it is encoded as "<>".
  */
 void
 outToken(StringInfo str, const char *s)
 {
-       if (s == NULL)
+       if (s == NULL || *s == '\0')
        {
                appendStringInfoString(str, "<>");
                return;
        }
-       if (*s == '\0')
-       {
-               appendStringInfoString(str, "\"\"");
-               return;
-       }
 
        /*
         * Look for characters or patterns that are treated specially by read.c
@@ -245,86 +218,12 @@ outChar(StringInfo str, char c)
 {
        char            in[2];
 
-       /* Traditionally, we've represented \0 as <>, so keep doing that */
-       if (c == '\0')
-       {
-               appendStringInfoString(str, "<>");
-               return;
-       }
-
        in[0] = c;
        in[1] = '\0';
 
        outToken(str, in);
 }
 
-/*
- * Convert a double value, attempting to ensure the value is preserved exactly.
- */
-static void
-outDouble(StringInfo str, double d)
-{
-       char            buf[DOUBLE_SHORTEST_DECIMAL_LEN];
-
-       double_to_shortest_decimal_buf(d, buf);
-       appendStringInfoString(str, buf);
-}
-
-/*
- * common implementation for scalar-array-writing functions
- *
- * The data format is either "<>" for a NULL pointer or "(item item item)".
- * fmtstr must include a leading space, and the rest of it must produce
- * something that will be seen as a single simple token by pg_strtok().
- * convfunc can be empty, or the name of a conversion macro or function.
- */
-#define WRITE_SCALAR_ARRAY(fnname, datatype, fmtstr, convfunc) \
-static void \
-fnname(StringInfo str, const datatype *arr, int len) \
-{ \
-       if (arr != NULL) \
-       { \
-               appendStringInfoChar(str, '('); \
-               for (int i = 0; i < len; i++) \
-                       appendStringInfo(str, fmtstr, convfunc(arr[i])); \
-               appendStringInfoChar(str, ')'); \
-       } \
-       else \
-               appendStringInfoString(str, "<>"); \
-}
-
-WRITE_SCALAR_ARRAY(writeAttrNumberCols, AttrNumber, " %d",)
-WRITE_SCALAR_ARRAY(writeOidCols, Oid, " %u",)
-WRITE_SCALAR_ARRAY(writeIndexCols, Index, " %u",)
-WRITE_SCALAR_ARRAY(writeIntCols, int, " %d",)
-WRITE_SCALAR_ARRAY(writeBoolCols, bool, " %s", booltostr)
-
-/*
- * Print an array (not a List) of Node pointers.
- *
- * The decoration is identical to that of scalar arrays, but we can't
- * quite use appendStringInfo() in the loop.
- */
-static void
-writeNodeArray(StringInfo str, const Node *const *arr, int len)
-{
-       if (arr != NULL)
-       {
-               appendStringInfoChar(str, '(');
-               for (int i = 0; i < len; i++)
-               {
-                       appendStringInfoChar(str, ' ');
-                       outNode(str, arr[i]);
-               }
-               appendStringInfoChar(str, ')');
-       }
-       else
-               appendStringInfoString(str, "<>");
-}
-
-/*
- * Print a List.
- */
 static void
 _outList(StringInfo str, const List *node)
 {
@@ -336,8 +235,6 @@ _outList(StringInfo str, const List *node)
                appendStringInfoChar(str, 'i');
        else if (IsA(node, OidList))
                appendStringInfoChar(str, 'o');
-       else if (IsA(node, XidList))
-               appendStringInfoChar(str, 'x');
 
        foreach(lc, node)
        {
@@ -356,8 +253,6 @@ _outList(StringInfo str, const List *node)
                        appendStringInfo(str, " %d", lfirst_int(lc));
                else if (IsA(node, OidList))
                        appendStringInfo(str, " %u", lfirst_oid(lc));
-               else if (IsA(node, XidList))
-                       appendStringInfo(str, " %u", lfirst_xid(lc));
                else
                        elog(ERROR, "unrecognized list node type: %d",
                                 (int) node->type);
@@ -371,9 +266,6 @@ _outList(StringInfo str, const List *node)
  *        converts a bitmap set of integers
  *
  * Note: the output format is "(b int int ...)", similar to an integer List.
- *
- * We export this function for use by extensions that define extensible nodes.
- * That's somewhat historical, though, because calling outNode() will work.
  */
 void
 outBitmapset(StringInfo str, const Bitmapset *bms)
@@ -425,9 +317,10 @@ outDatum(StringInfo str, Datum value, int typlen, bool 
typbyval)
 
 #endif /* COMPILING_BINARY_FUNCS */
 
-#include "outfuncs.funcs.c"
+/*
+ *     Stuff from plannodes.h
+ */
 
-<<<<<<< HEAD
 static void
 _outPlannedStmt(StringInfo str, const PlannedStmt *node)
 {
@@ -494,14 +387,10 @@ _outPlannedStmt(StringInfo str, const PlannedStmt *node)
        WRITE_NODE_FIELD(extensionContext);
 
 }
-=======
->>>>>>> REL_16_9
 
 /*
- * Support functions for nodes with custom_read_write attribute or
- * special_read_write attribute
+ * print the basic stuff of all nodes that inherit from Plan
  */
-<<<<<<< HEAD
 static void
 _outPlanInfo(StringInfo str, const Plan *node)
 {
@@ -1431,8 +1320,6 @@ _outVar(StringInfo str, const Var *node)
        WRITE_INT_FIELD(varattnosyn);
        WRITE_LOCATION_FIELD(location);
 }
-=======
->>>>>>> REL_16_9
 
 #ifndef COMPILING_BINARY_FUNCS
 static void
@@ -1457,7 +1344,6 @@ _outConst(StringInfo str, const Const *node)
 #endif /* COMPILING_BINARY_FUNCS */
 
 static void
-<<<<<<< HEAD
 _outParam(StringInfo str, const Param *node)
 {
        WRITE_NODE_TYPE("PARAM");
@@ -1632,8 +1518,6 @@ _outScalarArrayOpExpr(StringInfo str, const 
ScalarArrayOpExpr *node)
 
 #ifndef COMPILING_BINARY_FUNCS
 static void
-=======
->>>>>>> REL_16_9
 _outBoolExpr(StringInfo str, const BoolExpr *node)
 {
        char       *opstr = NULL;
@@ -1662,7 +1546,6 @@ _outBoolExpr(StringInfo str, const BoolExpr *node)
 #endif /* COMPILING_BINARY_FUNCS */
 
 static void
-<<<<<<< HEAD
 _outSubLink(StringInfo str, const SubLink *node)
 {
        WRITE_NODE_TYPE("SUBLINK");
@@ -2763,8 +2646,6 @@ _outIndexOptInfo(StringInfo str, const IndexOptInfo *node)
 }
 
 static void
-=======
->>>>>>> REL_16_9
 _outForeignKeyOptInfo(StringInfo str, const ForeignKeyOptInfo *node)
 {
        int                     i;
@@ -2790,6 +2671,18 @@ _outForeignKeyOptInfo(StringInfo str, const 
ForeignKeyOptInfo *node)
                appendStringInfo(str, " %d", list_length(node->rinfos[i]));
 }
 
+static void
+_outStatisticExtInfo(StringInfo str, const StatisticExtInfo *node)
+{
+       WRITE_NODE_TYPE("STATISTICEXTINFO");
+
+       /* NB: this isn't a complete set of fields */
+       WRITE_OID_FIELD(statOid);
+       /* don't write rel, leads to infinite recursion in plan tree dump */
+       WRITE_CHAR_FIELD(kind);
+       WRITE_BITMAPSET_FIELD(keys);
+}
+
 static void
 _outEquivalenceClass(StringInfo str, const EquivalenceClass *node)
 {
@@ -2810,6 +2703,7 @@ _outEquivalenceClass(StringInfo str, const 
EquivalenceClass *node)
        WRITE_BITMAPSET_FIELD(ec_relids);
        WRITE_BOOL_FIELD(ec_has_const);
        WRITE_BOOL_FIELD(ec_has_volatile);
+       WRITE_BOOL_FIELD(ec_below_outer_join);
        WRITE_BOOL_FIELD(ec_broken);
        WRITE_UINT_FIELD(ec_sortref);
        WRITE_UINT_FIELD(ec_min_security);
@@ -2817,7 +2711,6 @@ _outEquivalenceClass(StringInfo str, const 
EquivalenceClass *node)
 }
 
 static void
-<<<<<<< HEAD
 _outEquivalenceMember(StringInfo str, const EquivalenceMember *node)
 {
        WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
@@ -3050,8 +2943,6 @@ _outPlannerParamItem(StringInfo str, const 
PlannerParamItem *node)
 
 #ifndef COMPILING_BINARY_FUNCS
 static void
-=======
->>>>>>> REL_16_9
 _outExtensibleNode(StringInfo str, const ExtensibleNode *node)
 {
        const ExtensibleNodeMethods *methods;
@@ -3067,7 +2958,6 @@ _outExtensibleNode(StringInfo str, const ExtensibleNode 
*node)
 }
 #endif /* COMPILING_BINARY_FUNCS */
 
-<<<<<<< HEAD
 /*****************************************************************************
  *
  *     Stuff from parsenodes.h.
@@ -3698,12 +3588,10 @@ _outSetOperationStmt(StringInfo str, const 
SetOperationStmt *node)
        WRITE_NODE_FIELD(groupClauses);
 }
 
-=======
->>>>>>> REL_16_9
 static void
 _outRangeTblEntry(StringInfo str, const RangeTblEntry *node)
 {
-       WRITE_NODE_TYPE("RANGETBLENTRY");
+       WRITE_NODE_TYPE("RTE");
 
        /* put alias + eref first to make dump more legible */
        WRITE_NODE_FIELD(alias);
@@ -3718,16 +3606,10 @@ _outRangeTblEntry(StringInfo str, const RangeTblEntry 
*node)
                        WRITE_CHAR_FIELD(relkind);
                        WRITE_INT_FIELD(rellockmode);
                        WRITE_NODE_FIELD(tablesample);
-                       WRITE_UINT_FIELD(perminfoindex);
                        break;
                case RTE_SUBQUERY:
                        WRITE_NODE_FIELD(subquery);
                        WRITE_BOOL_FIELD(security_barrier);
-                       /* we re-use these RELATION fields, too: */
-                       WRITE_OID_FIELD(relid);
-                       WRITE_CHAR_FIELD(relkind);
-                       WRITE_INT_FIELD(rellockmode);
-                       WRITE_UINT_FIELD(perminfoindex);
                        break;
                case RTE_JOIN:
                        WRITE_ENUM_FIELD(jointype, JoinType);
@@ -3765,12 +3647,11 @@ _outRangeTblEntry(StringInfo str, const RangeTblEntry 
*node)
                        break;
                case RTE_NAMEDTUPLESTORE:
                        WRITE_STRING_FIELD(enrname);
-                       WRITE_FLOAT_FIELD(enrtuples);
+                       WRITE_FLOAT_FIELD(enrtuples, "%.0f");
+                       WRITE_OID_FIELD(relid);
                        WRITE_NODE_FIELD(coltypes);
                        WRITE_NODE_FIELD(coltypmods);
                        WRITE_NODE_FIELD(colcollations);
-                       /* we re-use these RELATION fields, too: */
-                       WRITE_OID_FIELD(relid);
                        break;
                case RTE_RESULT:
                        /* no extra fields */
@@ -3785,15 +3666,20 @@ _outRangeTblEntry(StringInfo str, const RangeTblEntry 
*node)
        WRITE_BOOL_FIELD(lateral);
        WRITE_BOOL_FIELD(inh);
        WRITE_BOOL_FIELD(inFromCl);
+       WRITE_UINT_FIELD(requiredPerms);
+       WRITE_OID_FIELD(checkAsUser);
+       WRITE_BITMAPSET_FIELD(selectedCols);
+       WRITE_BITMAPSET_FIELD(insertedCols);
+       WRITE_BITMAPSET_FIELD(updatedCols);
+       WRITE_BITMAPSET_FIELD(extraUpdatedCols);
        WRITE_NODE_FIELD(securityQuals);
 
        WRITE_BOOL_FIELD(forceDistRandom);
 }
 
 static void
-_outA_Expr(StringInfo str, const A_Expr *node)
+_outRangeTblFunction(StringInfo str, const RangeTblFunction *node)
 {
-<<<<<<< HEAD
        WRITE_NODE_TYPE("RANGETBLFUNCTION");
 
        WRITE_NODE_FIELD(funcexpr);
@@ -3824,69 +3710,69 @@ static void
 _outAExpr(StringInfo str, const A_Expr *node)
 {
        WRITE_NODE_TYPE("AEXPR");
-=======
-       WRITE_NODE_TYPE("A_EXPR");
->>>>>>> REL_16_9
 
        switch (node->kind)
        {
                case AEXPR_OP:
+                       appendStringInfoChar(str, ' ');
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_OP_ANY:
-                       appendStringInfoString(str, " ANY");
+                       appendStringInfoChar(str, ' ');
                        WRITE_NODE_FIELD(name);
+                       appendStringInfoString(str, " ANY ");
                        break;
                case AEXPR_OP_ALL:
-                       appendStringInfoString(str, " ALL");
+                       appendStringInfoChar(str, ' ');
                        WRITE_NODE_FIELD(name);
+                       appendStringInfoString(str, " ALL ");
                        break;
                case AEXPR_DISTINCT:
-                       appendStringInfoString(str, " DISTINCT");
+                       appendStringInfoString(str, " DISTINCT ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_NOT_DISTINCT:
-                       appendStringInfoString(str, " NOT_DISTINCT");
+                       appendStringInfoString(str, " NOT_DISTINCT ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_NULLIF:
-                       appendStringInfoString(str, " NULLIF");
+                       appendStringInfoString(str, " NULLIF ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_IN:
-                       appendStringInfoString(str, " IN");
+                       appendStringInfoString(str, " IN ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_LIKE:
-                       appendStringInfoString(str, " LIKE");
+                       appendStringInfoString(str, " LIKE ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_ILIKE:
-                       appendStringInfoString(str, " ILIKE");
+                       appendStringInfoString(str, " ILIKE ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_SIMILAR:
-                       appendStringInfoString(str, " SIMILAR");
+                       appendStringInfoString(str, " SIMILAR ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_BETWEEN:
-                       appendStringInfoString(str, " BETWEEN");
+                       appendStringInfoString(str, " BETWEEN ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_NOT_BETWEEN:
-                       appendStringInfoString(str, " NOT_BETWEEN");
+                       appendStringInfoString(str, " NOT_BETWEEN ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_BETWEEN_SYM:
-                       appendStringInfoString(str, " BETWEEN_SYM");
+                       appendStringInfoString(str, " BETWEEN_SYM ");
                        WRITE_NODE_FIELD(name);
                        break;
                case AEXPR_NOT_BETWEEN_SYM:
-                       appendStringInfoString(str, " NOT_BETWEEN_SYM");
+                       appendStringInfoString(str, " NOT_BETWEEN_SYM ");
                        WRITE_NODE_FIELD(name);
                        break;
                default:
-                       elog(ERROR, "unrecognized A_Expr_Kind: %d", (int) 
node->kind);
+                       appendStringInfoString(str, " ??");
                        break;
        }
 
@@ -3896,61 +3782,85 @@ _outAExpr(StringInfo str, const A_Expr *node)
 }
 
 static void
-_outInteger(StringInfo str, const Integer *node)
+_outValue(StringInfo str, const Value *value)
 {
-       appendStringInfo(str, "%d", node->ival);
+       switch (value->type)
+       {
+               case T_Integer:
+                       appendStringInfo(str, "%d", value->val.ival);
+                       break;
+               case T_Float:
+
+                       /*
+                        * We assume the value is a valid numeric literal and 
so does not
+                        * need quoting.
+                        */
+                       appendStringInfoString(str, value->val.str);
+                       break;
+               case T_String:
+
+                       /*
+                        * We use outToken to provide escaping of the string's 
content,
+                        * but we don't want it to do anything with an empty 
string.
+                        */
+                       appendStringInfoChar(str, '"');
+                       if (value->val.str[0] != '\0')
+                               outToken(str, value->val.str);
+                       appendStringInfoChar(str, '"');
+                       break;
+               case T_BitString:
+                       /* internal representation already has leading 'b' */
+                       appendStringInfoString(str, value->val.str);
+                       break;
+               case T_Null:
+                       /* this is seen only within A_Const, not in transformed 
trees */
+                       appendStringInfoString(str, "NULL");
+                       break;
+               default:
+                       elog(ERROR, "unrecognized node type: %d", (int) 
value->type);
+                       break;
+       }
 }
 #endif /* COMPILING_BINARY_FUNCS */
 
 static void
-_outFloat(StringInfo str, const Float *node)
+_outColumnRef(StringInfo str, const ColumnRef *node)
 {
-       /*
-        * We assume the value is a valid numeric literal and so does not need
-        * quoting.
-        */
-       appendStringInfoString(str, node->fval);
-}
+       WRITE_NODE_TYPE("COLUMNREF");
 
-static void
-_outBoolean(StringInfo str, const Boolean *node)
-{
-       appendStringInfoString(str, node->boolval ? "true" : "false");
+       WRITE_NODE_FIELD(fields);
+       WRITE_LOCATION_FIELD(location);
 }
 
-#ifndef COMPILING_BINARY_FUNCS
 static void
-_outString(StringInfo str, const String *node)
+_outParamRef(StringInfo str, const ParamRef *node)
 {
-       /*
-        * We use outToken to provide escaping of the string's content, but we
-        * don't want it to convert an empty string to '""', because we're 
putting
-        * double quotes around the string already.
-        */
-       appendStringInfoChar(str, '"');
-       if (node->sval[0] != '\0')
-               outToken(str, node->sval);
-       appendStringInfoChar(str, '"');
+       WRITE_NODE_TYPE("PARAMREF");
+
+       WRITE_INT_FIELD(number);
+       WRITE_LOCATION_FIELD(location);
 }
 
+/*
+ * Node types found in raw parse trees (supported for debug purposes)
+ */
+
 static void
-_outBitString(StringInfo str, const BitString *node)
+_outRawStmt(StringInfo str, const RawStmt *node)
 {
-       /*
-        * The lexer will always produce a string starting with 'b' or 'x'.  
There
-        * might be characters following that that need escaping, but outToken
-        * won't escape the 'b' or 'x'.  This is relied on by nodeTokenType.
-        */
-       Assert(node->bsval[0] == 'b' || node->bsval[0] == 'x');
-       outToken(str, node->bsval);
+       WRITE_NODE_TYPE("RAWSTMT");
+
+       WRITE_NODE_FIELD(stmt);
+       WRITE_LOCATION_FIELD(stmt_location);
+       WRITE_INT_FIELD(stmt_len);
 }
 
+#ifndef COMPILING_BINARY_FUNCS
 static void
-_outA_Const(StringInfo str, const A_Const *node)
+_outAConst(StringInfo str, const A_Const *node)
 {
        WRITE_NODE_TYPE("A_CONST");
 
-<<<<<<< HEAD
        appendStringInfoString(str, " :val ");
        _outValue(str, &(node->val));
        WRITE_LOCATION_FIELD(location);
@@ -4100,15 +4010,6 @@ _outRangeTableFuncCol(StringInfo str, const 
RangeTableFuncCol *node)
        WRITE_BOOL_FIELD(is_not_null);
        WRITE_NODE_FIELD(colexpr);
        WRITE_NODE_FIELD(coldefexpr);
-=======
-       if (node->isnull)
-               appendStringInfoString(str, " NULL");
-       else
-       {
-               appendStringInfoString(str, " :val ");
-               outNode(str, &node->val);
-       }
->>>>>>> REL_16_9
        WRITE_LOCATION_FIELD(location);
 }
 #endif /* COMPILING_BINARY_FUNCS */
@@ -4135,23 +4036,14 @@ _outConstraint(StringInfo str, const Constraint *node)
 
        WRITE_NODE_FIELD(exclusions);
 
-<<<<<<< HEAD
        WRITE_NODE_FIELD(options);
        WRITE_STRING_FIELD(indexname);
        WRITE_STRING_FIELD(indexspace);
        WRITE_BOOL_FIELD(reset_default_tblspc);
-=======
-               case CONSTR_IDENTITY:
-                       appendStringInfoString(str, "IDENTITY");
-                       WRITE_NODE_FIELD(options);
-                       WRITE_CHAR_FIELD(generated_when);
-                       break;
->>>>>>> REL_16_9
 
        WRITE_STRING_FIELD(access_method);
        WRITE_NODE_FIELD(where_clause);
 
-<<<<<<< HEAD
        WRITE_NODE_FIELD(pktable);
        WRITE_NODE_FIELD(fk_attrs);
        WRITE_NODE_FIELD(pk_attrs);
@@ -4227,89 +4119,6 @@ _outPartitionRangeDatum(StringInfo str, const 
PartitionRangeDatum *node)
        WRITE_NODE_FIELD(value);
        WRITE_LOCATION_FIELD(location);
 }
-=======
-               case CONSTR_CHECK:
-                       appendStringInfoString(str, "CHECK");
-                       WRITE_BOOL_FIELD(is_no_inherit);
-                       WRITE_NODE_FIELD(raw_expr);
-                       WRITE_STRING_FIELD(cooked_expr);
-                       WRITE_BOOL_FIELD(skip_validation);
-                       WRITE_BOOL_FIELD(initially_valid);
-                       break;
-
-               case CONSTR_PRIMARY:
-                       appendStringInfoString(str, "PRIMARY_KEY");
-                       WRITE_NODE_FIELD(keys);
-                       WRITE_NODE_FIELD(including);
-                       WRITE_NODE_FIELD(options);
-                       WRITE_STRING_FIELD(indexname);
-                       WRITE_STRING_FIELD(indexspace);
-                       WRITE_BOOL_FIELD(reset_default_tblspc);
-                       /* access_method and where_clause not currently used */
-                       break;
-
-               case CONSTR_UNIQUE:
-                       appendStringInfoString(str, "UNIQUE");
-                       WRITE_BOOL_FIELD(nulls_not_distinct);
-                       WRITE_NODE_FIELD(keys);
-                       WRITE_NODE_FIELD(including);
-                       WRITE_NODE_FIELD(options);
-                       WRITE_STRING_FIELD(indexname);
-                       WRITE_STRING_FIELD(indexspace);
-                       WRITE_BOOL_FIELD(reset_default_tblspc);
-                       /* access_method and where_clause not currently used */
-                       break;
-
-               case CONSTR_EXCLUSION:
-                       appendStringInfoString(str, "EXCLUSION");
-                       WRITE_NODE_FIELD(exclusions);
-                       WRITE_NODE_FIELD(including);
-                       WRITE_NODE_FIELD(options);
-                       WRITE_STRING_FIELD(indexname);
-                       WRITE_STRING_FIELD(indexspace);
-                       WRITE_BOOL_FIELD(reset_default_tblspc);
-                       WRITE_STRING_FIELD(access_method);
-                       WRITE_NODE_FIELD(where_clause);
-                       break;
-
-               case CONSTR_FOREIGN:
-                       appendStringInfoString(str, "FOREIGN_KEY");
-                       WRITE_NODE_FIELD(pktable);
-                       WRITE_NODE_FIELD(fk_attrs);
-                       WRITE_NODE_FIELD(pk_attrs);
-                       WRITE_CHAR_FIELD(fk_matchtype);
-                       WRITE_CHAR_FIELD(fk_upd_action);
-                       WRITE_CHAR_FIELD(fk_del_action);
-                       WRITE_NODE_FIELD(fk_del_set_cols);
-                       WRITE_NODE_FIELD(old_conpfeqop);
-                       WRITE_OID_FIELD(old_pktable_oid);
-                       WRITE_BOOL_FIELD(skip_validation);
-                       WRITE_BOOL_FIELD(initially_valid);
-                       break;
-
-               case CONSTR_ATTR_DEFERRABLE:
-                       appendStringInfoString(str, "ATTR_DEFERRABLE");
-                       break;
-
-               case CONSTR_ATTR_NOT_DEFERRABLE:
-                       appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
-                       break;
-
-               case CONSTR_ATTR_DEFERRED:
-                       appendStringInfoString(str, "ATTR_DEFERRED");
-                       break;
-
-               case CONSTR_ATTR_IMMEDIATE:
-                       appendStringInfoString(str, "ATTR_IMMEDIATE");
-                       break;
-
-               default:
-                       elog(ERROR, "unrecognized ConstrType: %d", (int) 
node->contype);
-                       break;
-       }
-}
-
->>>>>>> REL_16_9
 
 static void
 _outCreateDirectoryTableStmt(StringInfo str, const CreateDirectoryTableStmt 
*node)
@@ -4376,28 +4185,21 @@ outNode(StringInfo str, const void *obj)
 
        if (obj == NULL)
                appendStringInfoString(str, "<>");
-       else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList) ||
-                        IsA(obj, XidList))
+       else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList))
                _outList(str, obj);
-       /* nodeRead does not want to see { } around these! */
-       else if (IsA(obj, Integer))
-               _outInteger(str, (Integer *) obj);
-       else if (IsA(obj, Float))
-               _outFloat(str, (Float *) obj);
-       else if (IsA(obj, Boolean))
-               _outBoolean(str, (Boolean *) obj);
-       else if (IsA(obj, String))
-               _outString(str, (String *) obj);
-       else if (IsA(obj, BitString))
-               _outBitString(str, (BitString *) obj);
-       else if (IsA(obj, Bitmapset))
-               outBitmapset(str, (Bitmapset *) obj);
+       else if (IsA(obj, Integer) ||
+                        IsA(obj, Float) ||
+                        IsA(obj, String) ||
+                        IsA(obj, BitString))
+       {
+               /* nodeRead does not want to see { } around these! */
+               _outValue(str, obj);
+       }
        else
        {
                appendStringInfoChar(str, '{');
                switch (nodeTag(obj))
                {
-<<<<<<< HEAD
                        case T_PlannedStmt:
                                _outPlannedStmt(str, obj);
                                break;
@@ -5383,9 +5185,6 @@ outNode(StringInfo str, const void *obj)
                        case T_GpDropPartitionCmd:
                                _outGpDropPartitionCmd(str, obj);
                                break;
-=======
-#include "outfuncs.switch.c"
->>>>>>> REL_16_9
 
                        case T_CreateSchemaStmt:
                                _outCreateSchemaStmt(str, obj);
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index d8c76ad74fe..636e79d1cf4 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -3,13 +3,9 @@
  * readfuncs.c
  *       Reader functions for Postgres tree nodes.
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2005-2010, Greenplum inc
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
- * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
@@ -17,7 +13,6 @@
  *       src/backend/nodes/readfuncs.c
  *
  * NOTES
-<<<<<<< HEAD
  *       Path nodes do not have any readfuncs support, because we never
  *       have occasion to read them in.  (There was once code here that
  *       claimed to read them, but it was broken as well as unused.)  We
@@ -32,14 +27,11 @@
  *    The purpose of these routines is to read serialized trees that were 
stored
  *    in the catalog, and reconstruct the trees.
  *
-=======
->>>>>>> REL_16_9
  *       Parse location fields are written out by outfuncs.c, but only for
  *       debugging use.  When reading a location field, we normally discard
  *       the stored value and set the location field to -1 (ie, "unknown").
  *       This is because nodes coming from a stored rule should not be thought
  *       to have a known location in the current query's text.
- *
  *       However, if restore_location_fields is true, we do restore location
  *       fields from the string.  This is currently intended only for use by 
the
  *       WRITE_READ_PARSE_PLAN_TREES test code, which doesn't want to cause
@@ -51,9 +43,13 @@
 
 #include <math.h>
 
+#include "fmgr.h"
 #include "miscadmin.h"
-#include "nodes/bitmapset.h"
+#include "nodes/extensible.h"
+#include "nodes/parsenodes.h"
+#include "nodes/plannodes.h"
 #include "nodes/readfuncs.h"
+#include "utils/builtins.h"
 
 #include "cdb/cdbgang.h"
 #include "nodes/altertablenodes.h"
@@ -105,7 +101,7 @@
 #define READ_UINT64_FIELD(fldname) \
        token = pg_strtok(&length);             /* skip :fldname */ \
        token = pg_strtok(&length);             /* get field value */ \
-       local_node->fldname = strtou64(token, NULL, 10)
+       local_node->fldname = pg_strtouint64(token, NULL, 10)
 
 /* Read a long integer field (anything written as ":fldname %ld") */
 #define READ_LONG_FIELD(fldname) \
@@ -215,18 +211,8 @@
 
 #define strtobool(x)  ((*(x) == 't') ? true : false)
 
-static char *
-nullable_string(const char *token, int length)
-{
-       /* outToken emits <> for NULL, and pg_strtok makes that an empty string 
*/
-       if (length == 0)
-               return NULL;
-       /* outToken emits "" for empty string */
-       if (length == 2 && token[0] == '"' && token[1] == '"')
-               return pstrdup("");
-       /* otherwise, we must remove protective backslashes added by outToken */
-       return debackslash(token, length);
-}
+#define nullable_string(token,length)  \
+       ((length) == 0 ? NULL : debackslash(token, length))
 
 
 #endif /* COMPILING_BINARY_FUNCS */
@@ -234,10 +220,6 @@ nullable_string(const char *token, int length)
 #ifndef COMPILING_BINARY_FUNCS
 /*
  * _readBitmapset
- *
- * Note: this code is used in contexts where we know that a Bitmapset
- * is expected.  There is equivalent code in nodeRead() that can read a
- * Bitmapset when we come across one in other contexts.
  */
 static Bitmapset *
 _readBitmapset(void)
@@ -278,8 +260,7 @@ _readBitmapset(void)
 }
 
 /*
- * We export this function for use by extensions that define extensible nodes.
- * That's somewhat historical, though, because calling nodeRead() will work.
+ * for use by extensions which define extensible nodes
  */
 Bitmapset *
 readBitmapset(void)
@@ -287,7 +268,6 @@ readBitmapset(void)
        return _readBitmapset();
 }
 
-<<<<<<< HEAD
 /*
  * _readQuery
  */
@@ -511,17 +491,12 @@ _readSetOperationStmt(void)
 
        READ_DONE();
 }
-=======
-#include "readfuncs.funcs.c"
->>>>>>> REL_16_9
 
 
 /*
- * Support functions for nodes with custom_read_write attribute or
- * special_read_write attribute
+ *     Stuff from primnodes.h.
  */
 
-<<<<<<< HEAD
 static Alias *
 _readAlias(void)
 {
@@ -624,8 +599,6 @@ _readVar(void)
 /*
  * _readConst
  */
-=======
->>>>>>> REL_16_9
 static Const *
 _readConst(void)
 {
@@ -649,7 +622,6 @@ _readConst(void)
 }
 #endif /* COMPILING_BINARY_FUNCS */
 
-<<<<<<< HEAD
 /*
  * _readParam
  */
@@ -884,8 +856,6 @@ _readScalarArrayOpExpr(void)
 /*
  * _readBoolExpr
  */
-=======
->>>>>>> REL_16_9
 static BoolExpr *
 _readBoolExpr(void)
 {
@@ -894,11 +864,11 @@ _readBoolExpr(void)
        /* do-it-yourself enum representation */
        token = pg_strtok(&length); /* skip :boolop */
        token = pg_strtok(&length); /* get field value */
-       if (length == 3 && strncmp(token, "and", 3) == 0)
+       if (strncmp(token, "and", 3) == 0)
                local_node->boolop = AND_EXPR;
-       else if (length == 2 && strncmp(token, "or", 2) == 0)
+       else if (strncmp(token, "or", 2) == 0)
                local_node->boolop = OR_EXPR;
-       else if (length == 3 && strncmp(token, "not", 3) == 0)
+       else if (strncmp(token, "not", 3) == 0)
                local_node->boolop = NOT_EXPR;
        else
                elog(ERROR, "unrecognized boolop \"%.*s\"", length, token);
@@ -910,193 +880,92 @@ _readBoolExpr(void)
 }
 #endif /* COMPILING_BINARY_FUNCS */
 
-static A_Const *
-_readA_Const(void)
+/*
+ * _readSubLink
+ */
+static SubLink *
+_readSubLink(void)
 {
-       READ_LOCALS(A_Const);
-
-       /* We expect either NULL or :val here */
-       token = pg_strtok(&length);
-       if (length == 4 && strncmp(token, "NULL", 4) == 0)
-               local_node->isnull = true;
-       else
-       {
-               union ValUnion *tmp = nodeRead(NULL, 0);
-
-               /* To forestall valgrind complaints, copy only the valid data */
-               switch (nodeTag(tmp))
-               {
-                       case T_Integer:
-                               memcpy(&local_node->val, tmp, sizeof(Integer));
-                               break;
-                       case T_Float:
-                               memcpy(&local_node->val, tmp, sizeof(Float));
-                               break;
-                       case T_Boolean:
-                               memcpy(&local_node->val, tmp, sizeof(Boolean));
-                               break;
-                       case T_String:
-                               memcpy(&local_node->val, tmp, sizeof(String));
-                               break;
-                       case T_BitString:
-                               memcpy(&local_node->val, tmp, 
sizeof(BitString));
-                               break;
-                       default:
-                               elog(ERROR, "unrecognized node type: %d",
-                                        (int) nodeTag(tmp));
-                               break;
-               }
-       }
+       READ_LOCALS(SubLink);
 
+       READ_ENUM_FIELD(subLinkType, SubLinkType);
+       READ_INT_FIELD(subLinkId);
+       READ_NODE_FIELD(testexpr);
+       READ_NODE_FIELD(operName);
+       READ_NODE_FIELD(subselect);
        READ_LOCATION_FIELD(location);
 
        READ_DONE();
 }
 
 /*
-<<<<<<< HEAD
  * _readFieldSelect
  */
 static FieldSelect *
 _readFieldSelect(void)
-=======
- * _readConstraint
- */
-static Constraint *
-_readConstraint(void)
->>>>>>> REL_16_9
 {
-       READ_LOCALS(Constraint);
+       READ_LOCALS(FieldSelect);
 
-       READ_STRING_FIELD(conname);
-       READ_BOOL_FIELD(deferrable);
-       READ_BOOL_FIELD(initdeferred);
-       READ_LOCATION_FIELD(location);
-
-       token = pg_strtok(&length); /* skip :contype */
-       token = pg_strtok(&length); /* get field value */
-       if (length == 4 && strncmp(token, "NULL", 4) == 0)
-               local_node->contype = CONSTR_NULL;
-       else if (length == 8 && strncmp(token, "NOT_NULL", 8) == 0)
-               local_node->contype = CONSTR_NOTNULL;
-       else if (length == 7 && strncmp(token, "DEFAULT", 7) == 0)
-               local_node->contype = CONSTR_DEFAULT;
-       else if (length == 8 && strncmp(token, "IDENTITY", 8) == 0)
-               local_node->contype = CONSTR_IDENTITY;
-       else if (length == 9 && strncmp(token, "GENERATED", 9) == 0)
-               local_node->contype = CONSTR_GENERATED;
-       else if (length == 5 && strncmp(token, "CHECK", 5) == 0)
-               local_node->contype = CONSTR_CHECK;
-       else if (length == 11 && strncmp(token, "PRIMARY_KEY", 11) == 0)
-               local_node->contype = CONSTR_PRIMARY;
-       else if (length == 6 && strncmp(token, "UNIQUE", 6) == 0)
-               local_node->contype = CONSTR_UNIQUE;
-       else if (length == 9 && strncmp(token, "EXCLUSION", 9) == 0)
-               local_node->contype = CONSTR_EXCLUSION;
-       else if (length == 11 && strncmp(token, "FOREIGN_KEY", 11) == 0)
-               local_node->contype = CONSTR_FOREIGN;
-       else if (length == 15 && strncmp(token, "ATTR_DEFERRABLE", 15) == 0)
-               local_node->contype = CONSTR_ATTR_DEFERRABLE;
-       else if (length == 19 && strncmp(token, "ATTR_NOT_DEFERRABLE", 19) == 0)
-               local_node->contype = CONSTR_ATTR_NOT_DEFERRABLE;
-       else if (length == 13 && strncmp(token, "ATTR_DEFERRED", 13) == 0)
-               local_node->contype = CONSTR_ATTR_DEFERRED;
-       else if (length == 14 && strncmp(token, "ATTR_IMMEDIATE", 14) == 0)
-               local_node->contype = CONSTR_ATTR_IMMEDIATE;
-
-       switch (local_node->contype)
-       {
-               case CONSTR_NULL:
-               case CONSTR_NOTNULL:
-                       /* no extra fields */
-                       break;
-
-               case CONSTR_DEFAULT:
-                       READ_NODE_FIELD(raw_expr);
-                       READ_STRING_FIELD(cooked_expr);
-                       break;
+       READ_NODE_FIELD(arg);
+       READ_INT_FIELD(fieldnum);
+       READ_OID_FIELD(resulttype);
+       READ_INT_FIELD(resulttypmod);
+       READ_OID_FIELD(resultcollid);
 
-               case CONSTR_IDENTITY:
-                       READ_NODE_FIELD(options);
-                       READ_CHAR_FIELD(generated_when);
-                       break;
+       READ_DONE();
+}
 
-               case CONSTR_GENERATED:
-                       READ_NODE_FIELD(raw_expr);
-                       READ_STRING_FIELD(cooked_expr);
-                       READ_CHAR_FIELD(generated_when);
-                       break;
+/*
+ * _readFieldStore
+ */
+static FieldStore *
+_readFieldStore(void)
+{
+       READ_LOCALS(FieldStore);
 
-               case CONSTR_CHECK:
-                       READ_BOOL_FIELD(is_no_inherit);
-                       READ_NODE_FIELD(raw_expr);
-                       READ_STRING_FIELD(cooked_expr);
-                       READ_BOOL_FIELD(skip_validation);
-                       READ_BOOL_FIELD(initially_valid);
-                       break;
+       READ_NODE_FIELD(arg);
+       READ_NODE_FIELD(newvals);
+       READ_NODE_FIELD(fieldnums);
+       READ_OID_FIELD(resulttype);
 
-               case CONSTR_PRIMARY:
-                       READ_NODE_FIELD(keys);
-                       READ_NODE_FIELD(including);
-                       READ_NODE_FIELD(options);
-                       READ_STRING_FIELD(indexname);
-                       READ_STRING_FIELD(indexspace);
-                       READ_BOOL_FIELD(reset_default_tblspc);
-                       /* access_method and where_clause not currently used */
-                       break;
+       READ_DONE();
+}
 
-               case CONSTR_UNIQUE:
-                       READ_BOOL_FIELD(nulls_not_distinct);
-                       READ_NODE_FIELD(keys);
-                       READ_NODE_FIELD(including);
-                       READ_NODE_FIELD(options);
-                       READ_STRING_FIELD(indexname);
-                       READ_STRING_FIELD(indexspace);
-                       READ_BOOL_FIELD(reset_default_tblspc);
-                       /* access_method and where_clause not currently used */
-                       break;
+/*
+ * _readRelabelType
+ */
+static RelabelType *
+_readRelabelType(void)
+{
+       READ_LOCALS(RelabelType);
 
-               case CONSTR_EXCLUSION:
-                       READ_NODE_FIELD(exclusions);
-                       READ_NODE_FIELD(including);
-                       READ_NODE_FIELD(options);
-                       READ_STRING_FIELD(indexname);
-                       READ_STRING_FIELD(indexspace);
-                       READ_BOOL_FIELD(reset_default_tblspc);
-                       READ_STRING_FIELD(access_method);
-                       READ_NODE_FIELD(where_clause);
-                       break;
+       READ_NODE_FIELD(arg);
+       READ_OID_FIELD(resulttype);
+       READ_INT_FIELD(resulttypmod);
+       READ_OID_FIELD(resultcollid);
+       READ_ENUM_FIELD(relabelformat, CoercionForm);
+       READ_LOCATION_FIELD(location);
 
-               case CONSTR_FOREIGN:
-                       READ_NODE_FIELD(pktable);
-                       READ_NODE_FIELD(fk_attrs);
-                       READ_NODE_FIELD(pk_attrs);
-                       READ_CHAR_FIELD(fk_matchtype);
-                       READ_CHAR_FIELD(fk_upd_action);
-                       READ_CHAR_FIELD(fk_del_action);
-                       READ_NODE_FIELD(fk_del_set_cols);
-                       READ_NODE_FIELD(old_conpfeqop);
-                       READ_OID_FIELD(old_pktable_oid);
-                       READ_BOOL_FIELD(skip_validation);
-                       READ_BOOL_FIELD(initially_valid);
-                       break;
+       READ_DONE();
+}
 
-               case CONSTR_ATTR_DEFERRABLE:
-               case CONSTR_ATTR_NOT_DEFERRABLE:
-               case CONSTR_ATTR_DEFERRED:
-               case CONSTR_ATTR_IMMEDIATE:
-                       /* no extra fields */
-                       break;
+/*
+ * _readCoerceViaIO
+ */
+static CoerceViaIO *
+_readCoerceViaIO(void)
+{
+       READ_LOCALS(CoerceViaIO);
 
-               default:
-                       elog(ERROR, "unrecognized ConstrType: %d", (int) 
local_node->contype);
-                       break;
-       }
+       READ_NODE_FIELD(arg);
+       READ_OID_FIELD(resulttype);
+       READ_OID_FIELD(resultcollid);
+       READ_ENUM_FIELD(coerceformat, CoercionForm);
+       READ_LOCATION_FIELD(location);
 
        READ_DONE();
 }
 
-<<<<<<< HEAD
 /*
  * _readArrayCoerceExpr
  */
@@ -1566,8 +1435,6 @@ _readAppendRelInfo(void)
 /*
  * _readRangeTblEntry
  */
-=======
->>>>>>> REL_16_9
 static RangeTblEntry *
 _readRangeTblEntry(void)
 {
@@ -1586,16 +1453,10 @@ _readRangeTblEntry(void)
                        READ_CHAR_FIELD(relkind);
                        READ_INT_FIELD(rellockmode);
                        READ_NODE_FIELD(tablesample);
-                       READ_UINT_FIELD(perminfoindex);
                        break;
                case RTE_SUBQUERY:
                        READ_NODE_FIELD(subquery);
                        READ_BOOL_FIELD(security_barrier);
-                       /* we re-use these RELATION fields, too: */
-                       READ_OID_FIELD(relid);
-                       READ_CHAR_FIELD(relkind);
-                       READ_INT_FIELD(rellockmode);
-                       READ_UINT_FIELD(perminfoindex);
                        break;
                case RTE_JOIN:
                        READ_ENUM_FIELD(jointype, JoinType);
@@ -1643,11 +1504,10 @@ _readRangeTblEntry(void)
                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);
-                       /* we re-use these RELATION fields, too: */
-                       READ_OID_FIELD(relid);
                        break;
                case RTE_RESULT:
                        /* no extra fields */
@@ -1663,6 +1523,12 @@ _readRangeTblEntry(void)
        READ_BOOL_FIELD(lateral);
        READ_BOOL_FIELD(inh);
        READ_BOOL_FIELD(inFromCl);
+       READ_UINT_FIELD(requiredPerms);
+       READ_OID_FIELD(checkAsUser);
+       READ_BITMAPSET_FIELD(selectedCols);
+       READ_BITMAPSET_FIELD(insertedCols);
+       READ_BITMAPSET_FIELD(updatedCols);
+       READ_BITMAPSET_FIELD(extraUpdatedCols);
        READ_NODE_FIELD(securityQuals);
 
        READ_BOOL_FIELD(forceDistRandom);
@@ -1670,12 +1536,14 @@ _readRangeTblEntry(void)
        READ_DONE();
 }
 
-static A_Expr *
-_readA_Expr(void)
+/*
+ * _readRangeTblFunction
+ */
+static RangeTblFunction *
+_readRangeTblFunction(void)
 {
-       READ_LOCALS(A_Expr);
+       READ_LOCALS(RangeTblFunction);
 
-<<<<<<< HEAD
        READ_NODE_FIELD(funcexpr);
        READ_INT_FIELD(funccolcount);
        READ_NODE_FIELD(funccolnames);
@@ -1687,84 +1555,10 @@ _readA_Expr(void)
        READ_BYTEA_FIELD(funcuserdata);
 #endif
        READ_BITMAPSET_FIELD(funcparams);
-=======
-       token = pg_strtok(&length);
->>>>>>> REL_16_9
 
-       if (length == 3 && strncmp(token, "ANY", 3) == 0)
-       {
-               local_node->kind = AEXPR_OP_ANY;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 3 && strncmp(token, "ALL", 3) == 0)
-       {
-               local_node->kind = AEXPR_OP_ALL;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 8 && strncmp(token, "DISTINCT", 8) == 0)
-       {
-               local_node->kind = AEXPR_DISTINCT;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 12 && strncmp(token, "NOT_DISTINCT", 12) == 0)
-       {
-               local_node->kind = AEXPR_NOT_DISTINCT;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 6 && strncmp(token, "NULLIF", 6) == 0)
-       {
-               local_node->kind = AEXPR_NULLIF;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 2 && strncmp(token, "IN", 2) == 0)
-       {
-               local_node->kind = AEXPR_IN;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 4 && strncmp(token, "LIKE", 4) == 0)
-       {
-               local_node->kind = AEXPR_LIKE;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 5 && strncmp(token, "ILIKE", 5) == 0)
-       {
-               local_node->kind = AEXPR_ILIKE;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 7 && strncmp(token, "SIMILAR", 7) == 0)
-       {
-               local_node->kind = AEXPR_SIMILAR;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 7 && strncmp(token, "BETWEEN", 7) == 0)
-       {
-               local_node->kind = AEXPR_BETWEEN;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 11 && strncmp(token, "NOT_BETWEEN", 11) == 0)
-       {
-               local_node->kind = AEXPR_NOT_BETWEEN;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 11 && strncmp(token, "BETWEEN_SYM", 11) == 0)
-       {
-               local_node->kind = AEXPR_BETWEEN_SYM;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 15 && strncmp(token, "NOT_BETWEEN_SYM", 15) == 0)
-       {
-               local_node->kind = AEXPR_NOT_BETWEEN_SYM;
-               READ_NODE_FIELD(name);
-       }
-       else if (length == 5 && strncmp(token, ":name", 5) == 0)
-       {
-               local_node->kind = AEXPR_OP;
-               local_node->name = nodeRead(NULL, 0);
-       }
-       else
-               elog(ERROR, "unrecognized A_Expr kind: \"%.*s\"", length, 
token);
+       READ_DONE();
+}
 
-<<<<<<< HEAD
 /*
  * Apache Cloudberry additions for serialization support
  * These are currently not used (see outfastc ad readfast.c)
@@ -1798,16 +1592,11 @@ _readDefElem(void)
        READ_STRING_FIELD(defname);
        READ_NODE_FIELD(arg);
        READ_ENUM_FIELD(defaction, DefElemAction);
-=======
-       READ_NODE_FIELD(lexpr);
-       READ_NODE_FIELD(rexpr);
->>>>>>> REL_16_9
        READ_LOCATION_FIELD(location);
 
        READ_DONE();
 }
 
-<<<<<<< HEAD
 /*
  *     Stuff from plannodes.h.
  */
@@ -3046,8 +2835,6 @@ _readAlternativeSubPlan(void)
 /*
  * _readExtensibleNode
  */
-=======
->>>>>>> REL_16_9
 static ExtensibleNode *
 _readExtensibleNode(void)
 {
@@ -3076,6 +2863,40 @@ _readExtensibleNode(void)
 }
 #endif /* COMPILING_BINARY_FUNCS */
 
+/*
+ * _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();
+}
 
 #include "readfuncs_common.c"
 #ifndef COMPILING_BINARY_FUNCS
@@ -3090,6 +2911,8 @@ _readExtensibleNode(void)
 Node *
 parseNodeString(void)
 {
+       void       *return_value;
+
        READ_TEMP_LOCALS();
 
        /* Guard against stack overflow due to overly complex expressions */
@@ -3100,7 +2923,6 @@ parseNodeString(void)
 #define MATCH(tokname, namelen) \
        (length == namelen && memcmp(token, tokname, namelen) == 0)
 
-<<<<<<< HEAD
        /*
         * Same as MATCH, but we make our life a bit easier by relying on the
         * compiler to be smart, and evaluate the strlen("<constant>") at
@@ -3603,12 +3425,8 @@ parseNodeString(void)
                                                length, token, PACKAGE_NAME)));
                return_value = NULL;    /* keep compiler quiet */
        }
-=======
-#include "readfuncs.switch.c"
->>>>>>> REL_16_9
 
-       elog(ERROR, "badly formatted node string \"%.32s\"...", token);
-       return NULL;                            /* keep compiler quiet */
+       return (Node *) return_value;
 }
 
 
@@ -3674,45 +3492,32 @@ readDatum(bool typbyval)
 }
 
 /*
- * common implementation for scalar-array-reading functions
- *
- * The data format is either "<>" for a NULL pointer (in which case numCols
- * is ignored) or "(item item item)" where the number of items must equal
- * numCols.  The convfunc must be okay with stopping at whitespace or a
- * right parenthesis, since pg_strtok won't null-terminate the token.
- */
-#define READ_SCALAR_ARRAY(fnname, datatype, convfunc) \
-datatype * \
-fnname(int numCols) \
-{ \
-       datatype   *vals; \
-       READ_TEMP_LOCALS(); \
-       token = pg_strtok(&length); \
-       if (token == NULL) \
-               elog(ERROR, "incomplete scalar array"); \
-       if (length == 0) \
-               return NULL;                    /* it was "<>", so return NULL 
pointer */ \
-       if (length != 1 || token[0] != '(') \
-               elog(ERROR, "unrecognized token: \"%.*s\"", length, token); \
-       vals = (datatype *) palloc(numCols * sizeof(datatype)); \
-       for (int i = 0; i < numCols; i++) \
-       { \
-               token = pg_strtok(&length); \
-               if (token == NULL || token[0] == ')') \
-                       elog(ERROR, "incomplete scalar array"); \
-               vals[i] = convfunc(token); \
-       } \
-       token = pg_strtok(&length); \
-       if (token == NULL || length != 1 || token[0] != ')') \
-               elog(ERROR, "incomplete scalar array"); \
-       return vals; \
-}
-
-/*
- * Note: these functions are exported in nodes.h for possible use by
- * extensions, so don't mess too much with their names or API.
- */
-<<<<<<< HEAD
+ * readAttrNumberCols
+ */
+AttrNumber *
+readAttrNumberCols(int numCols)
+{
+       int                     tokenLength,
+                               i;
+       const char *token;
+       AttrNumber *attr_vals;
+
+       if (numCols <= 0)
+               return NULL;
+
+       attr_vals = (AttrNumber *) palloc(numCols * sizeof(AttrNumber));
+       for (i = 0; i < numCols; i++)
+       {
+               token = pg_strtok(&tokenLength);
+               attr_vals[i] = atoi(token);
+       }
+
+       return attr_vals;
+}
+
+/*
+ * readOidCols
+ */
 Oid *
 readOidCols(int numCols)
 {
@@ -3782,11 +3587,3 @@ readBoolCols(int numCols)
        return bool_vals;
 }
 #endif
-=======
-READ_SCALAR_ARRAY(readAttrNumberCols, int16, atoi)
-READ_SCALAR_ARRAY(readOidCols, Oid, atooid)
-/* outfuncs.c has writeIndexCols, but we don't yet need that here */
-/* READ_SCALAR_ARRAY(readIndexCols, Index, atoui) */
-READ_SCALAR_ARRAY(readIntCols, int, atoi)
-READ_SCALAR_ARRAY(readBoolCols, bool, strtobool)
->>>>>>> REL_16_9


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to