Commit 53bbc681 authored by Robert Haas's avatar Robert Haas

Fix various infelicities in node functions.

Mostly, this consists of adding support for fields which exist in the
structure but aren't handled by copy/equal/outfuncs; but the create
foreign table case can actually produce garbage output.

Noah Misch
parent 37e666b8
...@@ -2891,6 +2891,7 @@ _copyRenameStmt(const RenameStmt *from) ...@@ -2891,6 +2891,7 @@ _copyRenameStmt(const RenameStmt *from)
RenameStmt *newnode = makeNode(RenameStmt); RenameStmt *newnode = makeNode(RenameStmt);
COPY_SCALAR_FIELD(renameType); COPY_SCALAR_FIELD(renameType);
COPY_SCALAR_FIELD(relationType);
COPY_NODE_FIELD(relation); COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(object); COPY_NODE_FIELD(object);
COPY_NODE_FIELD(objarg); COPY_NODE_FIELD(objarg);
...@@ -3047,6 +3048,7 @@ _copyViewStmt(const ViewStmt *from) ...@@ -3047,6 +3048,7 @@ _copyViewStmt(const ViewStmt *from)
COPY_NODE_FIELD(aliases); COPY_NODE_FIELD(aliases);
COPY_NODE_FIELD(query); COPY_NODE_FIELD(query);
COPY_SCALAR_FIELD(replace); COPY_SCALAR_FIELD(replace);
COPY_NODE_FIELD(options);
return newnode; return newnode;
} }
......
...@@ -1306,6 +1306,7 @@ static bool ...@@ -1306,6 +1306,7 @@ static bool
_equalRenameStmt(const RenameStmt *a, const RenameStmt *b) _equalRenameStmt(const RenameStmt *a, const RenameStmt *b)
{ {
COMPARE_SCALAR_FIELD(renameType); COMPARE_SCALAR_FIELD(renameType);
COMPARE_SCALAR_FIELD(relationType);
COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(relation);
COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(object);
COMPARE_NODE_FIELD(objarg); COMPARE_NODE_FIELD(objarg);
...@@ -1438,6 +1439,7 @@ _equalViewStmt(const ViewStmt *a, const ViewStmt *b) ...@@ -1438,6 +1439,7 @@ _equalViewStmt(const ViewStmt *a, const ViewStmt *b)
COMPARE_NODE_FIELD(aliases); COMPARE_NODE_FIELD(aliases);
COMPARE_NODE_FIELD(query); COMPARE_NODE_FIELD(query);
COMPARE_SCALAR_FIELD(replace); COMPARE_SCALAR_FIELD(replace);
COMPARE_NODE_FIELD(options);
return true; return true;
} }
...@@ -2182,6 +2184,7 @@ _equalColumnDef(const ColumnDef *a, const ColumnDef *b) ...@@ -2182,6 +2184,7 @@ _equalColumnDef(const ColumnDef *a, const ColumnDef *b)
COMPARE_NODE_FIELD(collClause); COMPARE_NODE_FIELD(collClause);
COMPARE_SCALAR_FIELD(collOid); COMPARE_SCALAR_FIELD(collOid);
COMPARE_NODE_FIELD(constraints); COMPARE_NODE_FIELD(constraints);
COMPARE_NODE_FIELD(fdwoptions);
return true; return true;
} }
......
...@@ -1927,11 +1927,12 @@ _outPlannerParamItem(StringInfo str, const PlannerParamItem *node) ...@@ -1927,11 +1927,12 @@ _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
* *
*****************************************************************************/ *****************************************************************************/
/*
* print the basic stuff of all nodes that inherit from CreateStmt
*/
static void static void
_outCreateStmt(StringInfo str, const CreateStmt *node) _outCreateStmtInfo(StringInfo str, const CreateStmt *node)
{ {
WRITE_NODE_TYPE("CREATESTMT");
WRITE_NODE_FIELD(relation); WRITE_NODE_FIELD(relation);
WRITE_NODE_FIELD(tableElts); WRITE_NODE_FIELD(tableElts);
WRITE_NODE_FIELD(inhRelations); WRITE_NODE_FIELD(inhRelations);
...@@ -1943,12 +1944,20 @@ _outCreateStmt(StringInfo str, const CreateStmt *node) ...@@ -1943,12 +1944,20 @@ _outCreateStmt(StringInfo str, const CreateStmt *node)
WRITE_BOOL_FIELD(if_not_exists); WRITE_BOOL_FIELD(if_not_exists);
} }
static void
_outCreateStmt(StringInfo str, const CreateStmt *node)
{
WRITE_NODE_TYPE("CREATESTMT");
_outCreateStmtInfo(str, (const CreateStmt *) node);
}
static void static void
_outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node) _outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
{ {
WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT"); WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
_outCreateStmt(str, (const CreateStmt *) &node->base); _outCreateStmtInfo(str, (const CreateStmt *) node);
WRITE_STRING_FIELD(servername); WRITE_STRING_FIELD(servername);
WRITE_NODE_FIELD(options); WRITE_NODE_FIELD(options);
...@@ -2088,7 +2097,7 @@ _outColumnDef(StringInfo str, const ColumnDef *node) ...@@ -2088,7 +2097,7 @@ _outColumnDef(StringInfo str, const ColumnDef *node)
WRITE_BOOL_FIELD(is_local); WRITE_BOOL_FIELD(is_local);
WRITE_BOOL_FIELD(is_not_null); WRITE_BOOL_FIELD(is_not_null);
WRITE_BOOL_FIELD(is_from_type); WRITE_BOOL_FIELD(is_from_type);
WRITE_INT_FIELD(storage); WRITE_CHAR_FIELD(storage);
WRITE_NODE_FIELD(raw_default); WRITE_NODE_FIELD(raw_default);
WRITE_NODE_FIELD(cooked_default); WRITE_NODE_FIELD(cooked_default);
WRITE_NODE_FIELD(collClause); WRITE_NODE_FIELD(collClause);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment