diff options
author | Peter Eisentraut | 2025-01-15 07:31:46 +0000 |
---|---|---|
committer | Peter Eisentraut | 2025-01-15 07:44:01 +0000 |
commit | 6339f6468e8217f556e38482626250dc72d7cd00 (patch) | |
tree | 71a7eec03c515b4e25c8be754b8d512b1a0e7eaa /src/include | |
parent | 9a45a89c38f3257b13e09edf382e32fa28b918c2 (diff) |
Rename RowCompareType to CompareType
RowCompareType served as a way to describe the fundamental meaning of
an operator, notionally independent of an operator class (although so
far this was only really supported for btrees). Its original purpose
was for use inside RowCompareExpr, and it has also found some small
use outside, such as for get_op_btree_interpretation().
We want to expand this now, as a more general way to describe operator
semantics for other index access methods, including gist (to improve
GistTranslateStratnum()) and others not written yet. To avoid future
confusion, we rename the type to CompareType and the symbols from
ROWCOMPARE_XXX to COMPARE_XXX to reflect their more general purpose.
Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/executor/execExpr.h | 2 | ||||
-rw-r--r-- | src/include/nodes/primnodes.h | 41 |
2 files changed, 28 insertions, 15 deletions
diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index 8019e5490e9..1e42c131781 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -494,7 +494,7 @@ typedef struct ExprEvalStep /* for EEOP_ROWCOMPARE_FINAL */ struct { - RowCompareType rctype; + CompareType cmptype; } rowcompare_final; /* for EEOP_MINMAX */ diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 9c2957eb546..2893dba31c3 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -1436,6 +1436,31 @@ typedef struct RowExpr } 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 the 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 */ +} CompareType; + +/* * RowCompareExpr - row-wise comparison, such as (a, b) <= (1, 2) * * We support row comparison for any operator that can be determined to @@ -1446,26 +1471,14 @@ typedef struct RowExpr * * A RowCompareExpr node is only generated for the < <= > >= cases; * the = and <> cases are translated to simple AND or OR combinations - * of the pairwise comparisons. However, we include = and <> in the - * RowCompareType enum for the convenience of parser logic. + * of the pairwise comparisons. */ -typedef enum RowCompareType -{ - /* Values of this enum are chosen to match btree strategy numbers */ - ROWCOMPARE_LT = 1, /* BTLessStrategyNumber */ - ROWCOMPARE_LE = 2, /* BTLessEqualStrategyNumber */ - ROWCOMPARE_EQ = 3, /* BTEqualStrategyNumber */ - ROWCOMPARE_GE = 4, /* BTGreaterEqualStrategyNumber */ - ROWCOMPARE_GT = 5, /* BTGreaterStrategyNumber */ - ROWCOMPARE_NE = 6, /* no such btree strategy */ -} RowCompareType; - typedef struct RowCompareExpr { Expr xpr; /* LT LE GE or GT, never EQ or NE */ - RowCompareType rctype; + CompareType cmptype; /* OID list of pairwise comparison ops */ List *opnos pg_node_attr(query_jumble_ignore); /* OID list of containing operator families */ |