Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 119fc30

Browse files
committed
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> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
1 parent d61b966 commit 119fc30

File tree

6 files changed

+48
-28
lines changed

6 files changed

+48
-28
lines changed

contrib/btree_gist/btree_gist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
*/
44
#include "postgres.h"
55

6+
#include "access/cmptype.h"
67
#include "access/stratnum.h"
7-
#include "nodes/primnodes.h"
88
#include "utils/builtins.h"
99

1010
PG_MODULE_MAGIC;

src/backend/nodes/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ node_headers = \
4646
nodes/plannodes.h \
4747
nodes/execnodes.h \
4848
access/amapi.h \
49+
access/cmptype.h \
4950
access/sdir.h \
5051
access/tableam.h \
5152
access/tsmapi.h \

src/backend/nodes/gen_node_support.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ sub elem
5858
nodes/plannodes.h
5959
nodes/execnodes.h
6060
access/amapi.h
61+
access/cmptype.h
6162
access/sdir.h
6263
access/tableam.h
6364
access/tsmapi.h

src/include/access/cmptype.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* cmptype.h
4+
* POSTGRES compare type definitions.
5+
*
6+
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7+
* Portions Copyright (c) 1994, Regents of the University of California
8+
*
9+
* src/include/access/cmptype.h
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef CMPTYPE_H
14+
#define CMPTYPE_H
15+
16+
/*
17+
* CompareType - fundamental semantics of certain operators
18+
*
19+
* These enum symbols represent the fundamental semantics of certain operators
20+
* that the system needs to have some hardcoded knowledge about. (For
21+
* example, RowCompareExpr needs to know which operators can be determined to
22+
* act like =, <>, <, etc.) Index access methods map (some of) strategy
23+
* numbers to these values so that the system can know about the meaning of
24+
* (some of) the operators without needing hardcoded knowledge of index AM's
25+
* strategy numbering.
26+
*
27+
* XXX Currently, this mapping is not fully developed and most values are
28+
* chosen to match btree strategy numbers, which is not going to work very
29+
* well for other access methods.
30+
*/
31+
typedef enum CompareType
32+
{
33+
COMPARE_LT = 1, /* BTLessStrategyNumber */
34+
COMPARE_LE = 2, /* BTLessEqualStrategyNumber */
35+
COMPARE_EQ = 3, /* BTEqualStrategyNumber */
36+
COMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */
37+
COMPARE_GT = 5, /* BTGreaterStrategyNumber */
38+
COMPARE_NE = 6, /* no such btree strategy */
39+
COMPARE_OVERLAP,
40+
COMPARE_CONTAINED_BY,
41+
} CompareType;
42+
43+
#endif /* CMPTYPE_H */

src/include/nodes/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ node_support_input_i = [
88
'nodes/plannodes.h',
99
'nodes/execnodes.h',
1010
'access/amapi.h',
11+
'access/cmptype.h',
1112
'access/sdir.h',
1213
'access/tableam.h',
1314
'access/tsmapi.h',

src/include/nodes/primnodes.h

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define PRIMNODES_H
1919

2020
#include "access/attnum.h"
21+
#include "access/cmptype.h"
2122
#include "nodes/bitmapset.h"
2223
#include "nodes/pg_list.h"
2324

@@ -1451,33 +1452,6 @@ typedef struct RowExpr
14511452
ParseLoc location; /* token location, or -1 if unknown */
14521453
} RowExpr;
14531454

1454-
/*
1455-
* CompareType - fundamental semantics of certain operators
1456-
*
1457-
* These enum symbols represent the fundamental semantics of certain operators
1458-
* that the system needs to have some hardcoded knowledge about. (For
1459-
* example, RowCompareExpr needs to know which operators can be determined to
1460-
* act like =, <>, <, etc.) Index access methods map (some of) strategy
1461-
* numbers to these values so that the system can know about the meaning of
1462-
* (some of) the operators without needing hardcoded knowledge of index AM's
1463-
* strategy numbering.
1464-
*
1465-
* XXX Currently, this mapping is not fully developed and most values are
1466-
* chosen to match btree strategy numbers, which is not going to work very
1467-
* well for other access methods.
1468-
*/
1469-
typedef enum CompareType
1470-
{
1471-
COMPARE_LT = 1, /* BTLessStrategyNumber */
1472-
COMPARE_LE = 2, /* BTLessEqualStrategyNumber */
1473-
COMPARE_EQ = 3, /* BTEqualStrategyNumber */
1474-
COMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */
1475-
COMPARE_GT = 5, /* BTGreaterStrategyNumber */
1476-
COMPARE_NE = 6, /* no such btree strategy */
1477-
COMPARE_OVERLAP,
1478-
COMPARE_CONTAINED_BY,
1479-
} CompareType;
1480-
14811455
/*
14821456
* RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2)
14831457
*

0 commit comments

Comments
 (0)