v19.2-0004-Move-CompareType-to-separate-header-file.patch
text/plain
Filename: v19.2-0004-Move-CompareType-to-separate-header-file.patch
Type: text/plain
Part: 3
Message:
Re: Index AM API cleanup
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v19-0004
Subject: Move CompareType to separate header file
| File | + | − |
|---|---|---|
| contrib/btree_gist/btree_gist.c | 1 | 1 |
| src/backend/nodes/gen_node_support.pl | 1 | 0 |
| src/backend/nodes/Makefile | 1 | 0 |
| src/include/access/cmptype.h | 44 | 0 |
| src/include/nodes/meson.build | 1 | 0 |
| src/include/nodes/primnodes.h | 1 | 27 |
From 541a93828f4d1d1ec266f353ed2b5a96ae3cdb13 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Fri, 24 Jan 2025 23:00:49 +0100
Subject: [PATCH v19.2 4/6] Move CompareType to separate header file
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>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
---
contrib/btree_gist/btree_gist.c | 2 +-
src/backend/nodes/Makefile | 1 +
src/backend/nodes/gen_node_support.pl | 1 +
src/include/access/cmptype.h | 44 +++++++++++++++++++++++++++
src/include/nodes/meson.build | 1 +
src/include/nodes/primnodes.h | 28 +----------------
6 files changed, 49 insertions(+), 28 deletions(-)
create mode 100644 src/include/access/cmptype.h
diff --git a/contrib/btree_gist/btree_gist.c b/contrib/btree_gist/btree_gist.c
index fc6c7091795..7fcb0cd6d03 100644
--- a/contrib/btree_gist/btree_gist.c
+++ b/contrib/btree_gist/btree_gist.c
@@ -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;
diff --git a/src/backend/nodes/Makefile b/src/backend/nodes/Makefile
index 66bbad8e6e0..77ddb9ca53f 100644
--- a/src/backend/nodes/Makefile
+++ b/src/backend/nodes/Makefile
@@ -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 \
diff --git a/src/backend/nodes/gen_node_support.pl b/src/backend/nodes/gen_node_support.pl
index 7c012c27f88..1a657f7e0ae 100644
--- a/src/backend/nodes/gen_node_support.pl
+++ b/src/backend/nodes/gen_node_support.pl
@@ -58,6 +58,7 @@ sub elem
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
index 00000000000..339099564e9
--- /dev/null
+++ b/src/include/access/cmptype.h
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ *
+ * cmptype.h
+ * POSTGRES compare type definitions.
+ *
+ * Portions Copyright (c) 1996-2024, 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_INVALID = 0,
+ 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 */
diff --git a/src/include/nodes/meson.build b/src/include/nodes/meson.build
index f3dd5461fef..d1ca24dd32f 100644
--- a/src/include/nodes/meson.build
+++ b/src/include/nodes/meson.build
@@ -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',
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 59e7bb26bbd..839e71d52f4 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -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)
*
--
2.48.1