Commit 80a7298b authored by Tom Lane's avatar Tom Lane

Remove manual breaks in NodeTag assignments to fix duplicate tag numbers.

Commit f0e44751 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
parent db779d94
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
* The first field of every node is NodeTag. Each node created (with makeNode) * 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. * 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 * Note that inserting or deleting node types changes the numbers of other
* here so that we can add more tags without changing the existing enum's. * node types later in the list. This is no problem during development, since
* (Since node tag numbers never exist outside backend memory, there's no * the node numbers are never stored on disk. But don't do it in a released
* real harm in renumbering, it just costs a full rebuild ...) * branch, because that would represent an ABI break for extensions.
*/ */
typedef enum NodeTag typedef enum NodeTag
{ {
...@@ -30,7 +30,7 @@ typedef enum NodeTag ...@@ -30,7 +30,7 @@ typedef enum NodeTag
/* /*
* TAGS FOR EXECUTOR NODES (execnodes.h) * TAGS FOR EXECUTOR NODES (execnodes.h)
*/ */
T_IndexInfo = 10, T_IndexInfo,
T_ExprContext, T_ExprContext,
T_ProjectionInfo, T_ProjectionInfo,
T_JunkFilter, T_JunkFilter,
...@@ -41,7 +41,7 @@ typedef enum NodeTag ...@@ -41,7 +41,7 @@ typedef enum NodeTag
/* /*
* TAGS FOR PLAN NODES (plannodes.h) * TAGS FOR PLAN NODES (plannodes.h)
*/ */
T_Plan = 100, T_Plan,
T_Result, T_Result,
T_ModifyTable, T_ModifyTable,
T_Append, T_Append,
...@@ -89,7 +89,7 @@ typedef enum NodeTag ...@@ -89,7 +89,7 @@ typedef enum NodeTag
* *
* These should correspond one-to-one with Plan node types. * These should correspond one-to-one with Plan node types.
*/ */
T_PlanState = 200, T_PlanState,
T_ResultState, T_ResultState,
T_ModifyTableState, T_ModifyTableState,
T_AppendState, T_AppendState,
...@@ -131,7 +131,7 @@ typedef enum NodeTag ...@@ -131,7 +131,7 @@ typedef enum NodeTag
/* /*
* TAGS FOR PRIMITIVE NODES (primnodes.h) * TAGS FOR PRIMITIVE NODES (primnodes.h)
*/ */
T_Alias = 300, T_Alias,
T_RangeVar, T_RangeVar,
T_Expr, T_Expr,
T_Var, T_Var,
...@@ -188,7 +188,7 @@ typedef enum NodeTag ...@@ -188,7 +188,7 @@ typedef enum NodeTag
* These correspond (not always one-for-one) to primitive nodes derived * These correspond (not always one-for-one) to primitive nodes derived
* from Expr. * from Expr.
*/ */
T_ExprState = 400, T_ExprState,
T_GenericExprState, T_GenericExprState,
T_WholeRowVarExprState, T_WholeRowVarExprState,
T_AggrefExprState, T_AggrefExprState,
...@@ -220,7 +220,7 @@ typedef enum NodeTag ...@@ -220,7 +220,7 @@ typedef enum NodeTag
/* /*
* TAGS FOR PLANNER NODES (relation.h) * TAGS FOR PLANNER NODES (relation.h)
*/ */
T_PlannerInfo = 500, T_PlannerInfo,
T_PlannerGlobal, T_PlannerGlobal,
T_RelOptInfo, T_RelOptInfo,
T_IndexOptInfo, T_IndexOptInfo,
...@@ -273,13 +273,13 @@ typedef enum NodeTag ...@@ -273,13 +273,13 @@ typedef enum NodeTag
/* /*
* TAGS FOR MEMORY NODES (memnodes.h) * TAGS FOR MEMORY NODES (memnodes.h)
*/ */
T_MemoryContext = 600, T_MemoryContext,
T_AllocSetContext, T_AllocSetContext,
/* /*
* TAGS FOR VALUE NODES (value.h) * TAGS FOR VALUE NODES (value.h)
*/ */
T_Value = 650, T_Value,
T_Integer, T_Integer,
T_Float, T_Float,
T_String, T_String,
...@@ -301,7 +301,7 @@ typedef enum NodeTag ...@@ -301,7 +301,7 @@ typedef enum NodeTag
/* /*
* TAGS FOR STATEMENT NODES (mostly in parsenodes.h) * TAGS FOR STATEMENT NODES (mostly in parsenodes.h)
*/ */
T_Query = 700, T_Query,
T_PlannedStmt, T_PlannedStmt,
T_InsertStmt, T_InsertStmt,
T_DeleteStmt, T_DeleteStmt,
...@@ -411,7 +411,7 @@ typedef enum NodeTag ...@@ -411,7 +411,7 @@ typedef enum NodeTag
/* /*
* TAGS FOR PARSE TREE NODES (parsenodes.h) * TAGS FOR PARSE TREE NODES (parsenodes.h)
*/ */
T_A_Expr = 900, T_A_Expr,
T_ColumnRef, T_ColumnRef,
T_ParamRef, T_ParamRef,
T_A_Const, T_A_Const,
...@@ -478,7 +478,7 @@ typedef enum NodeTag ...@@ -478,7 +478,7 @@ typedef enum NodeTag
* purposes (usually because they are involved in APIs where we want to * purposes (usually because they are involved in APIs where we want to
* pass multiple object types through the same pointer). * 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_EventTriggerData, /* in commands/event_trigger.h */
T_ReturnSetInfo, /* in nodes/execnodes.h */ T_ReturnSetInfo, /* in nodes/execnodes.h */
T_WindowObjectData, /* private in nodeWindowAgg.c */ T_WindowObjectData, /* private in nodeWindowAgg.c */
......
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