Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 53bbc68

Browse files
committed
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
1 parent 37e666b commit 53bbc68

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/backend/nodes/copyfuncs.c

+2
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,7 @@ _copyRenameStmt(const RenameStmt *from)
28912891
RenameStmt *newnode = makeNode(RenameStmt);
28922892

28932893
COPY_SCALAR_FIELD(renameType);
2894+
COPY_SCALAR_FIELD(relationType);
28942895
COPY_NODE_FIELD(relation);
28952896
COPY_NODE_FIELD(object);
28962897
COPY_NODE_FIELD(objarg);
@@ -3047,6 +3048,7 @@ _copyViewStmt(const ViewStmt *from)
30473048
COPY_NODE_FIELD(aliases);
30483049
COPY_NODE_FIELD(query);
30493050
COPY_SCALAR_FIELD(replace);
3051+
COPY_NODE_FIELD(options);
30503052

30513053
return newnode;
30523054
}

src/backend/nodes/equalfuncs.c

+3
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ static bool
13061306
_equalRenameStmt(const RenameStmt *a, const RenameStmt *b)
13071307
{
13081308
COMPARE_SCALAR_FIELD(renameType);
1309+
COMPARE_SCALAR_FIELD(relationType);
13091310
COMPARE_NODE_FIELD(relation);
13101311
COMPARE_NODE_FIELD(object);
13111312
COMPARE_NODE_FIELD(objarg);
@@ -1438,6 +1439,7 @@ _equalViewStmt(const ViewStmt *a, const ViewStmt *b)
14381439
COMPARE_NODE_FIELD(aliases);
14391440
COMPARE_NODE_FIELD(query);
14401441
COMPARE_SCALAR_FIELD(replace);
1442+
COMPARE_NODE_FIELD(options);
14411443

14421444
return true;
14431445
}
@@ -2182,6 +2184,7 @@ _equalColumnDef(const ColumnDef *a, const ColumnDef *b)
21822184
COMPARE_NODE_FIELD(collClause);
21832185
COMPARE_SCALAR_FIELD(collOid);
21842186
COMPARE_NODE_FIELD(constraints);
2187+
COMPARE_NODE_FIELD(fdwoptions);
21852188

21862189
return true;
21872190
}

src/backend/nodes/outfuncs.c

+14-5
Original file line numberDiff line numberDiff line change
@@ -1927,11 +1927,12 @@ _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
19271927
*
19281928
*****************************************************************************/
19291929

1930+
/*
1931+
* print the basic stuff of all nodes that inherit from CreateStmt
1932+
*/
19301933
static void
1931-
_outCreateStmt(StringInfo str, const CreateStmt *node)
1934+
_outCreateStmtInfo(StringInfo str, const CreateStmt *node)
19321935
{
1933-
WRITE_NODE_TYPE("CREATESTMT");
1934-
19351936
WRITE_NODE_FIELD(relation);
19361937
WRITE_NODE_FIELD(tableElts);
19371938
WRITE_NODE_FIELD(inhRelations);
@@ -1943,12 +1944,20 @@ _outCreateStmt(StringInfo str, const CreateStmt *node)
19431944
WRITE_BOOL_FIELD(if_not_exists);
19441945
}
19451946

1947+
static void
1948+
_outCreateStmt(StringInfo str, const CreateStmt *node)
1949+
{
1950+
WRITE_NODE_TYPE("CREATESTMT");
1951+
1952+
_outCreateStmtInfo(str, (const CreateStmt *) node);
1953+
}
1954+
19461955
static void
19471956
_outCreateForeignTableStmt(StringInfo str, const CreateForeignTableStmt *node)
19481957
{
19491958
WRITE_NODE_TYPE("CREATEFOREIGNTABLESTMT");
19501959

1951-
_outCreateStmt(str, (const CreateStmt *) &node->base);
1960+
_outCreateStmtInfo(str, (const CreateStmt *) node);
19521961

19531962
WRITE_STRING_FIELD(servername);
19541963
WRITE_NODE_FIELD(options);
@@ -2088,7 +2097,7 @@ _outColumnDef(StringInfo str, const ColumnDef *node)
20882097
WRITE_BOOL_FIELD(is_local);
20892098
WRITE_BOOL_FIELD(is_not_null);
20902099
WRITE_BOOL_FIELD(is_from_type);
2091-
WRITE_INT_FIELD(storage);
2100+
WRITE_CHAR_FIELD(storage);
20922101
WRITE_NODE_FIELD(raw_default);
20932102
WRITE_NODE_FIELD(cooked_default);
20942103
WRITE_NODE_FIELD(collClause);

0 commit comments

Comments
 (0)