From 80a7298b9eb7f108ef20be6ee00d9513a43c61a0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 29 Dec 2016 16:57:41 -0500 Subject: [PATCH] Remove manual breaks in NodeTag assignments to fix duplicate tag numbers. Commit f0e44751d added new node tags at a place in the tag numbering where there was no daylight left before the next hard-coded number, resulting in some duplicate tag assignments. This doesn't seem to have caused any big problem so far, but it's surely trouble waiting to happen. We could adjust the manually assigned breakpoints to make more room, but that just leaves the same hazard waiting to strike again in future. What seems like a better idea is to get rid of the manual assignments and leave NodeTags to be automatically assigned, consecutively from one on up. This means that any change in the tag list forces a backend-wide recompile, but realistically that's usually needed anyway. Discussion: https://postgr.es/m/29670.1482942811@sss.pgh.pa.us --- src/include/nodes/nodes.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index c514d3fc93..201f248774 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -18,10 +18,10 @@ * The first field of every node is NodeTag. Each node created (with makeNode) * will have one of the following tags as the value of its first field. * - * Note that the numbers of the node tags are not contiguous. We left holes - * here so that we can add more tags without changing the existing enum's. - * (Since node tag numbers never exist outside backend memory, there's no - * real harm in renumbering, it just costs a full rebuild ...) + * Note that inserting or deleting node types changes the numbers of other + * node types later in the list. This is no problem during development, since + * the node numbers are never stored on disk. But don't do it in a released + * branch, because that would represent an ABI break for extensions. */ typedef enum NodeTag { @@ -30,7 +30,7 @@ typedef enum NodeTag /* * TAGS FOR EXECUTOR NODES (execnodes.h) */ - T_IndexInfo = 10, + T_IndexInfo, T_ExprContext, T_ProjectionInfo, T_JunkFilter, @@ -41,7 +41,7 @@ typedef enum NodeTag /* * TAGS FOR PLAN NODES (plannodes.h) */ - T_Plan = 100, + T_Plan, T_Result, T_ModifyTable, T_Append, @@ -89,7 +89,7 @@ typedef enum NodeTag * * These should correspond one-to-one with Plan node types. */ - T_PlanState = 200, + T_PlanState, T_ResultState, T_ModifyTableState, T_AppendState, @@ -131,7 +131,7 @@ typedef enum NodeTag /* * TAGS FOR PRIMITIVE NODES (primnodes.h) */ - T_Alias = 300, + T_Alias, T_RangeVar, T_Expr, T_Var, @@ -188,7 +188,7 @@ typedef enum NodeTag * These correspond (not always one-for-one) to primitive nodes derived * from Expr. */ - T_ExprState = 400, + T_ExprState, T_GenericExprState, T_WholeRowVarExprState, T_AggrefExprState, @@ -220,7 +220,7 @@ typedef enum NodeTag /* * TAGS FOR PLANNER NODES (relation.h) */ - T_PlannerInfo = 500, + T_PlannerInfo, T_PlannerGlobal, T_RelOptInfo, T_IndexOptInfo, @@ -273,13 +273,13 @@ typedef enum NodeTag /* * TAGS FOR MEMORY NODES (memnodes.h) */ - T_MemoryContext = 600, + T_MemoryContext, T_AllocSetContext, /* * TAGS FOR VALUE NODES (value.h) */ - T_Value = 650, + T_Value, T_Integer, T_Float, T_String, @@ -301,7 +301,7 @@ typedef enum NodeTag /* * TAGS FOR STATEMENT NODES (mostly in parsenodes.h) */ - T_Query = 700, + T_Query, T_PlannedStmt, T_InsertStmt, T_DeleteStmt, @@ -411,7 +411,7 @@ typedef enum NodeTag /* * TAGS FOR PARSE TREE NODES (parsenodes.h) */ - T_A_Expr = 900, + T_A_Expr, T_ColumnRef, T_ParamRef, T_A_Const, @@ -478,7 +478,7 @@ typedef enum NodeTag * purposes (usually because they are involved in APIs where we want to * pass multiple object types through the same pointer). */ - T_TriggerData = 950, /* in commands/trigger.h */ + T_TriggerData, /* in commands/trigger.h */ T_EventTriggerData, /* in commands/event_trigger.h */ T_ReturnSetInfo, /* in nodes/execnodes.h */ T_WindowObjectData, /* private in nodeWindowAgg.c */ -- 2.40.0