Move CompareType to separate header file
authorPeter Eisentraut <peter@eisentraut.org>
Sun, 2 Feb 2025 07:11:57 +0000 (08:11 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sun, 2 Feb 2025 07:11:57 +0000 (08:11 +0100)
We'll want to make use of it in more places, and we'd prefer to not
have to include all of primnodes.h everywhere.

Author: Mark Dilger <mark.dilger@enterprisedb.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com

contrib/btree_gist/btree_gist.c
src/backend/nodes/Makefile
src/backend/nodes/gen_node_support.pl
src/include/access/cmptype.h [new file with mode: 0644]
src/include/nodes/meson.build
src/include/nodes/primnodes.h

index fc6c7091795091ff0e3517b0c40377dbdf8944b9..7fcb0cd6d03a291840cee9b2318aeb7e2b3af688 100644 (file)
@@ -3,8 +3,8 @@
  */
 #include "postgres.h"
 
+#include "access/cmptype.h"
 #include "access/stratnum.h"
-#include "nodes/primnodes.h"
 #include "utils/builtins.h"
 
 PG_MODULE_MAGIC;
index 66bbad8e6e02d522bef5c76bf7e3cc08e59efc9d..77ddb9ca53f1e18af2fe3200b1c963bbbc5968a9 100644 (file)
@@ -46,6 +46,7 @@ node_headers = \
    nodes/plannodes.h \
    nodes/execnodes.h \
    access/amapi.h \
+   access/cmptype.h \
    access/sdir.h \
    access/tableam.h \
    access/tsmapi.h \
index 7c012c27f8878b55f975cda9dbc0b428189ba68e..1a657f7e0aea27ed705715b462dff351843509c9 100644 (file)
@@ -58,6 +58,7 @@ my @all_input_files = qw(
   nodes/plannodes.h
   nodes/execnodes.h
   access/amapi.h
+  access/cmptype.h
   access/sdir.h
   access/tableam.h
   access/tsmapi.h
diff --git a/src/include/access/cmptype.h b/src/include/access/cmptype.h
new file mode 100644 (file)
index 0000000..2b96422
--- /dev/null
@@ -0,0 +1,43 @@
+/*-------------------------------------------------------------------------
+ *
+ * cmptype.h
+ *   POSTGRES compare type definitions.
+ *
+ * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/cmptype.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef CMPTYPE_H
+#define CMPTYPE_H
+
+/*
+ * CompareType - fundamental semantics of certain operators
+ *
+ * These enum symbols represent the fundamental semantics of certain operators
+ * that the system needs to have some hardcoded knowledge about.  (For
+ * example, RowCompareExpr needs to know which operators can be determined to
+ * act like =, <>, <, etc.)  Index access methods map (some of) strategy
+ * numbers to these values so that the system can know about the meaning of
+ * (some of) the operators without needing hardcoded knowledge of index AM's
+ * strategy numbering.
+ *
+ * XXX Currently, this mapping is not fully developed and most values are
+ * chosen to match btree strategy numbers, which is not going to work very
+ * well for other access methods.
+ */
+typedef enum CompareType
+{
+   COMPARE_LT = 1,             /* BTLessStrategyNumber */
+   COMPARE_LE = 2,             /* BTLessEqualStrategyNumber */
+   COMPARE_EQ = 3,             /* BTEqualStrategyNumber */
+   COMPARE_GE = 4,             /* BTGreaterEqualStrategyNumber */
+   COMPARE_GT = 5,             /* BTGreaterStrategyNumber */
+   COMPARE_NE = 6,             /* no such btree strategy */
+   COMPARE_OVERLAP,
+   COMPARE_CONTAINED_BY,
+} CompareType;
+
+#endif                         /* CMPTYPE_H */
index f3dd5461fefa1d841f15994882a8d73305416e48..d1ca24dd32f0bb77e87e0081e8c392b0ec9d441c 100644 (file)
@@ -8,6 +8,7 @@ node_support_input_i = [
   'nodes/plannodes.h',
   'nodes/execnodes.h',
   'access/amapi.h',
+  'access/cmptype.h',
   'access/sdir.h',
   'access/tableam.h',
   'access/tsmapi.h',
index 59e7bb26bbda2511026a9e2e82192c599e14ccba..839e71d52f47ba6e6250ae9a3bb31c1c33305759 100644 (file)
@@ -18,6 +18,7 @@
 #define PRIMNODES_H
 
 #include "access/attnum.h"
+#include "access/cmptype.h"
 #include "nodes/bitmapset.h"
 #include "nodes/pg_list.h"
 
@@ -1451,33 +1452,6 @@ typedef struct RowExpr
    ParseLoc    location;       /* token location, or -1 if unknown */
 } RowExpr;
 
-/*
- * CompareType - fundamental semantics of certain operators
- *
- * These enum symbols represent the fundamental semantics of certain operators
- * that the system needs to have some hardcoded knowledge about.  (For
- * example, RowCompareExpr needs to know which operators can be determined to
- * act like =, <>, <, etc.)  Index access methods map (some of) strategy
- * numbers to these values so that the system can know about the meaning of
- * (some of) the operators without needing hardcoded knowledge of index AM's
- * strategy numbering.
- *
- * XXX Currently, this mapping is not fully developed and most values are
- * chosen to match btree strategy numbers, which is not going to work very
- * well for other access methods.
- */
-typedef enum CompareType
-{
-   COMPARE_LT = 1,             /* BTLessStrategyNumber */
-   COMPARE_LE = 2,             /* BTLessEqualStrategyNumber */
-   COMPARE_EQ = 3,             /* BTEqualStrategyNumber */
-   COMPARE_GE = 4,             /* BTGreaterEqualStrategyNumber */
-   COMPARE_GT = 5,             /* BTGreaterStrategyNumber */
-   COMPARE_NE = 6,             /* no such btree strategy */
-   COMPARE_OVERLAP,
-   COMPARE_CONTAINED_BY,
-} CompareType;
-
 /*
  * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2)
  *