On 5 August 2011 20:07, Tom Lane <t...@sss.pgh.pa.us> wrote:
> This patch is a truly horrid idea, as it eliminates the error checking
> the compiler is trying to provide, and does so globally not only in the
> trouble spots.

I think that the mistake I may have made here was assuming that the
existing code was perfect, and therefore it was a simply matter of
tweaking. With that assumption in mind, the only fix could have been a
global fix. I should not have acted in haste.

> If I were trying to get rid of this warning, I'd be wondering why
> ReplNodeTag is a distinct enum in the first place.

Indeed, that doesn't seem to be justified anywhere, and seems to be a
violation of the abstraction of Node as a pseudo base class which
would have broken any "downcasting" that we might have attempted to
do. Since ReplNodeTag wasn't being used directly, just its enumeration
constants, simply moving the constants to the global, generic NodeTag
enum fixes the issue.

That is what the attached patch does.

-- 
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index d8bc6b8..2c5e162 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -403,6 +403,13 @@ typedef enum NodeTag
 	T_CommonTableExpr,
 
 	/*
+	 * TAGS FOR REPLICATION PARSER (replnodes.h)
+	 */
+	T_IdentifySystemCmd = 950,
+	T_BaseBackupCmd,
+	T_StartReplicationCmd,
+
+	/*
 	 * TAGS FOR RANDOM OTHER STUFF
 	 *
 	 * These are objects that aren't part of parse/plan/execute node tree
@@ -410,7 +417,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 = 1000,		/* in commands/trigger.h */
 	T_ReturnSetInfo,			/* in nodes/execnodes.h */
 	T_WindowObjectData,			/* private in nodeWindowAgg.c */
 	T_TIDBitmap,				/* in nodes/tidbitmap.h */
diff --git a/src/include/replication/replnodes.h b/src/include/replication/replnodes.h
index e027f92..8523e7e 100644
--- a/src/include/replication/replnodes.h
+++ b/src/include/replication/replnodes.h
@@ -18,16 +18,6 @@
 #include "nodes/primnodes.h"
 #include "nodes/value.h"
 
-/*
- * NodeTags for replication parser
- */
-typedef enum ReplNodeTag
-{
-	T_IdentifySystemCmd = 10,
-	T_BaseBackupCmd,
-	T_StartReplicationCmd
-}	ReplNodeTag;
-
 /* ----------------------
  *		IDENTIFY_SYSTEM command
  * ----------------------
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to