summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2003-11-09 21:30:38 +0000
committerTom Lane2003-11-09 21:30:38 +0000
commitc1d62bfd00f4d1ea0647e12947ca1de9fea39b33 (patch)
tree1afdccb5267627182cab94b347730657107ad6eb /src/include
parent723825afebb6de7212fa18882bcc78212d5c1743 (diff)
Add operator strategy and comparison-value datatype fields to ScanKey.
Remove the 'strategy map' code, which was a large amount of mechanism that no longer had any use except reverse-mapping from procedure OID to strategy number. Passing the strategy number to the index AM in the first place is simpler and faster. This is a preliminary step in planned support for cross-datatype index operations. I'm committing it now since the ScanKeyEntryInitialize() API change touches quite a lot of files, and I want to commit those changes before the tree drifts under me.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/gist.h4
-rw-r--r--src/include/access/istrat.h61
-rw-r--r--src/include/access/nbtree.h18
-rw-r--r--src/include/access/relscan.h3
-rw-r--r--src/include/access/rtree.h5
-rw-r--r--src/include/access/skey.h79
-rw-r--r--src/include/access/strat.h90
-rw-r--r--src/include/access/valid.h20
-rw-r--r--src/include/commands/sequence.h4
-rw-r--r--src/include/nodes/plannodes.h14
-rw-r--r--src/include/pg_config_manual.h3
-rw-r--r--src/include/storage/smgr.h3
-rw-r--r--src/include/utils/catcache.h3
-rw-r--r--src/include/utils/lsyscache.h5
-rw-r--r--src/include/utils/rel.h26
15 files changed, 107 insertions, 231 deletions
diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index fbe3e5a9f20..9aa6991a0d5 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: gist.h,v 1.37 2003/08/04 02:40:10 momjian Exp $
+ * $Id: gist.h,v 1.38 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -175,8 +175,6 @@ extern void freeGISTstate(GISTSTATE *giststate);
extern void gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
Datum k, Relation r, Page pg, OffsetNumber o,
int b, bool l, bool isNull);
-extern StrategyNumber RelationGetGISTStrategy(Relation, AttrNumber,
- RegProcedure);
extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
extern void gist_undo(XLogRecPtr lsn, XLogRecord *record);
diff --git a/src/include/access/istrat.h b/src/include/access/istrat.h
deleted file mode 100644
index b538d2aae09..00000000000
--- a/src/include/access/istrat.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * istrat.h
- * POSTGRES index strategy definitions.
- *
- *
- * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $Id: istrat.h,v 1.27 2003/08/04 02:40:10 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#ifndef ISTRAT_H
-#define ISTRAT_H
-
-#include "utils/rel.h"
-
-/*
- * StrategyNumberIsValid
- * True iff the strategy number is valid.
- */
-#define StrategyNumberIsValid(strategyNumber) \
- ((bool) ((strategyNumber) != InvalidStrategy))
-
-/*
- * StrategyNumberIsInBounds
- * True iff strategy number is within given bounds.
- *
- * Note:
- * Assumes StrategyNumber is an unsigned type.
- * Assumes the bounded interval to be (0,max].
- */
-#define StrategyNumberIsInBounds(strategyNumber, maxStrategyNumber) \
- ((bool)(InvalidStrategy < (strategyNumber) && \
- (strategyNumber) <= (maxStrategyNumber)))
-
-/*
- * StrategyMapIsValid
- * True iff the index strategy mapping is valid.
- */
-#define StrategyMapIsValid(map) PointerIsValid(map)
-
-/*
- * IndexStrategyIsValid
- * True iff the index strategy is valid.
- */
-#define IndexStrategyIsValid(s) PointerIsValid(s)
-
-extern ScanKey StrategyMapGetScanKeyEntry(StrategyMap map,
- StrategyNumber strategyNumber);
-extern StrategyMap IndexStrategyGetStrategyMap(IndexStrategy indexStrategy,
- StrategyNumber maxStrategyNum, AttrNumber attrNum);
-
-extern Size AttributeNumberGetIndexStrategySize(AttrNumber maxAttributeNumber,
- StrategyNumber maxStrategyNumber);
-extern StrategyNumber RelationGetStrategy(Relation relation,
- AttrNumber attributeNumber, StrategyEvaluation evaluation,
- RegProcedure procedure);
-
-#endif /* ISTRAT_H */
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index a852fa24925..80d412a52e5 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nbtree.h,v 1.71 2003/09/29 23:40:26 tgl Exp $
+ * $Id: nbtree.h,v 1.72 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -340,16 +340,10 @@ typedef struct xl_btree_newpage
/*
- * Operator strategy numbers -- ordering of these is <, <=, =, >=, >
+ * Operator strategy numbers for B-tree have been moved to access/skey.h,
+ * because many places need to use them in ScanKeyEntryInitialize() calls.
*/
-#define BTLessStrategyNumber 1
-#define BTLessEqualStrategyNumber 2
-#define BTEqualStrategyNumber 3
-#define BTGreaterEqualStrategyNumber 4
-#define BTGreaterStrategyNumber 5
-#define BTMaxStrategyNumber 5
-
/*
* When a new operator class is declared, we require that the user
* supply us with an amproc procedure for determining whether, for
@@ -480,12 +474,6 @@ extern bool _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
extern Buffer _bt_get_endpoint(Relation rel, uint32 level, bool rightmost);
/*
- * prototypes for functions in nbtstrat.c
- */
-extern StrategyNumber _bt_getstrat(Relation rel, AttrNumber attno,
- RegProcedure proc);
-
-/*
* prototypes for functions in nbtutils.c
*/
extern ScanKey _bt_mkscankey(Relation rel, IndexTuple itup);
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
index 63c6bcc56bc..d56b2ac958b 100644
--- a/src/include/access/relscan.h
+++ b/src/include/access/relscan.h
@@ -7,13 +7,14 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: relscan.h,v 1.32 2003/08/04 02:40:10 momjian Exp $
+ * $Id: relscan.h,v 1.33 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef RELSCAN_H
#define RELSCAN_H
+#include "access/skey.h"
#include "utils/tqual.h"
diff --git a/src/include/access/rtree.h b/src/include/access/rtree.h
index ed8dd6cf2e1..846090204aa 100644
--- a/src/include/access/rtree.h
+++ b/src/include/access/rtree.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rtree.h,v 1.30 2003/08/04 02:40:10 momjian Exp $
+ * $Id: rtree.h,v 1.31 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -132,7 +132,6 @@ extern void rtadjscans(Relation r, int op, BlockNumber blkno,
extern void AtEOXact_rtree(void);
/* rtstrat.c */
-extern RegProcedure RTMapOperator(Relation r, AttrNumber attnum,
- RegProcedure proc);
+extern StrategyNumber RTMapToInternalOperator(StrategyNumber strat);
#endif /* RTREE_H */
diff --git a/src/include/access/skey.h b/src/include/access/skey.h
index 2e66cfd894a..b7373dd6410 100644
--- a/src/include/access/skey.h
+++ b/src/include/access/skey.h
@@ -7,10 +7,8 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: skey.h,v 1.22 2003/08/04 02:40:10 momjian Exp $
+ * $Id: skey.h,v 1.23 2003/11/09 21:30:37 tgl Exp $
*
- * Note:
- * Needs more accessor/assignment routines.
*-------------------------------------------------------------------------
*/
#ifndef SKEY_H
@@ -20,32 +18,77 @@
#include "fmgr.h"
+/*
+ * Strategy numbers identify the semantics that particular operators have
+ * with respect to particular operator classes.
+ */
+typedef uint16 StrategyNumber;
+
+#define InvalidStrategy ((StrategyNumber) 0)
+
+/*
+ * We define the strategy numbers for B-tree indexes here, to avoid having
+ * to import access/nbtree.h into a lot of places that shouldn't need it.
+ */
+#define BTLessStrategyNumber 1
+#define BTLessEqualStrategyNumber 2
+#define BTEqualStrategyNumber 3
+#define BTGreaterEqualStrategyNumber 4
+#define BTGreaterStrategyNumber 5
+
+#define BTMaxStrategyNumber 5
+
+
+/*
+ * A ScanKey represents the application of a comparison operator between
+ * a table or index column and a constant. When it's part of an array of
+ * ScanKeys, the comparison conditions are implicitly ANDed. The index
+ * column is the left argument of the operator, if it's a binary operator.
+ * (The data structure can support unary indexable operators too; in that
+ * case sk_argument would go unused. This is not currently implemented.)
+ *
+ * For an index scan, sk_strategy must be set correctly for the operator.
+ * When using a ScanKey in a heap scan, sk_strategy is not used and may be
+ * set to InvalidStrategy.
+ *
+ * Note: in some places, ScanKeys are used as a convenient representation
+ * for the invocation of an access method support procedure. In this case
+ * sk_strategy is not meaningful, and sk_func may refer to a function that
+ * returns something other than boolean.
+ */
typedef struct ScanKeyData
{
- bits16 sk_flags; /* flags */
- AttrNumber sk_attno; /* domain number */
- RegProcedure sk_procedure; /* procedure OID */
- FmgrInfo sk_func; /* fmgr call info for procedure */
+ int sk_flags; /* flags, see below */
+ AttrNumber sk_attno; /* table or index column number */
+ StrategyNumber sk_strategy; /* operator strategy number */
+ FmgrInfo sk_func; /* lookup info for function to call */
Datum sk_argument; /* data to compare */
+ Oid sk_argtype; /* datatype of sk_argument */
} ScanKeyData;
typedef ScanKeyData *ScanKey;
-/* ScanKeyData flags */
-#define SK_ISNULL 0x1 /* sk_argument is NULL */
-#define SK_UNARY 0x2 /* unary function (currently unsupported) */
-#define SK_NEGATE 0x4 /* negate function result */
-#define SK_COMMUTE 0x8 /* commute function (not fully supported) */
+/* ScanKeyData sk_flags */
+#define SK_ISNULL 0x0001 /* sk_argument is NULL */
+#define SK_UNARY 0x0002 /* unary operator (currently unsupported) */
/*
* prototypes for functions in access/common/scankey.c
*/
-extern void ScanKeyEntrySetIllegal(ScanKey entry);
-extern void ScanKeyEntryInitialize(ScanKey entry, bits16 flags,
- AttrNumber attributeNumber, RegProcedure procedure, Datum argument);
-extern void ScanKeyEntryInitializeWithInfo(ScanKey entry, bits16 flags,
- AttrNumber attributeNumber, FmgrInfo *finfo,
- MemoryContext mcxt, Datum argument);
+extern void ScanKeyEntryInitialize(ScanKey entry,
+ int flags,
+ AttrNumber attributeNumber,
+ StrategyNumber strategy,
+ RegProcedure procedure,
+ Datum argument,
+ Oid argtype);
+extern void ScanKeyEntryInitializeWithInfo(ScanKey entry,
+ int flags,
+ AttrNumber attributeNumber,
+ StrategyNumber strategy,
+ FmgrInfo *finfo,
+ Datum argument,
+ Oid argtype);
#endif /* SKEY_H */
diff --git a/src/include/access/strat.h b/src/include/access/strat.h
deleted file mode 100644
index f697f79e4ee..00000000000
--- a/src/include/access/strat.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * strat.h
- * index strategy type definitions
- * (separated out from original istrat.h to avoid circular refs)
- *
- *
- * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $Id: strat.h,v 1.27 2003/08/04 02:40:10 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#ifndef STRAT_H
-#define STRAT_H
-
-#include "access/skey.h"
-
-
-typedef uint16 StrategyNumber;
-
-#define InvalidStrategy 0
-
-typedef struct StrategyTransformMapData
-{
- StrategyNumber strategy[1]; /* VARIABLE LENGTH ARRAY */
-} StrategyTransformMapData; /* VARIABLE LENGTH STRUCTURE */
-
-typedef StrategyTransformMapData *StrategyTransformMap;
-
-typedef struct StrategyOperatorData
-{
- StrategyNumber strategy;
- bits16 flags; /* scan qualification flags, see skey.h */
-} StrategyOperatorData;
-
-typedef StrategyOperatorData *StrategyOperator;
-
-typedef struct StrategyTermData
-{ /* conjunctive term */
- uint16 degree;
- StrategyOperatorData operatorData[1]; /* VARIABLE LENGTH ARRAY */
-} StrategyTermData; /* VARIABLE LENGTH STRUCTURE */
-
-typedef StrategyTermData *StrategyTerm;
-
-typedef struct StrategyExpressionData
-{ /* disjunctive normal form */
- StrategyTerm term[1]; /* VARIABLE LENGTH ARRAY */
-} StrategyExpressionData; /* VARIABLE LENGTH STRUCTURE */
-
-typedef StrategyExpressionData *StrategyExpression;
-
-typedef struct StrategyEvaluationData
-{
- StrategyNumber maxStrategy;
- /* each of these must point to an array of maxStrategy elements: */
- StrategyTransformMap negateTransform;
- StrategyTransformMap commuteTransform;
- StrategyTransformMap negateCommuteTransform;
- StrategyExpression *expression;
-} StrategyEvaluationData;
-
-typedef StrategyEvaluationData *StrategyEvaluation;
-
-/*
- * StrategyTransformMapIsValid
- * Returns true iff strategy transformation map is valid.
- */
-#define StrategyTransformMapIsValid(transform) PointerIsValid(transform)
-
-
-#define AMStrategies(foo) (foo)
-
-typedef struct StrategyMapData
-{
- ScanKeyData entry[1]; /* VARIABLE LENGTH ARRAY */
-} StrategyMapData; /* VARIABLE LENGTH STRUCTURE */
-
-typedef StrategyMapData *StrategyMap;
-
-typedef struct IndexStrategyData
-{
- StrategyMapData strategyMapData[1]; /* VARIABLE LENGTH ARRAY */
-} IndexStrategyData; /* VARIABLE LENGTH STRUCTURE */
-
-typedef IndexStrategyData *IndexStrategy;
-
-#endif /* STRAT_H */
diff --git a/src/include/access/valid.h b/src/include/access/valid.h
index 3109d3e7e4d..e16a392a243 100644
--- a/src/include/access/valid.h
+++ b/src/include/access/valid.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: valid.h,v 1.31 2003/09/25 18:58:35 tgl Exp $
+ * $Id: valid.h,v 1.32 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,15 +31,16 @@ do \
/* We use underscores to protect the variable passed in as parameters */ \
/* We use two underscore here because this macro is included in the \
macro below */ \
- bool __isnull; \
- Datum __atp; \
- Datum __test; \
int __cur_nkeys = (nkeys); \
ScanKey __cur_keys = (keys); \
\
(result) = true; /* may change */ \
for (; __cur_nkeys--; __cur_keys++) \
{ \
+ Datum __atp; \
+ bool __isnull; \
+ Datum __test; \
+ \
__atp = heap_getattr((tuple), \
__cur_keys->sk_attno, \
(tupdesc), \
@@ -58,16 +59,11 @@ do \
break; \
} \
\
- if (__cur_keys->sk_flags & SK_COMMUTE) \
- __test = FunctionCall2(&__cur_keys->sk_func, \
- __cur_keys->sk_argument, __atp); \
- else \
- __test = FunctionCall2(&__cur_keys->sk_func, \
- __atp, __cur_keys->sk_argument); \
+ __test = FunctionCall2(&__cur_keys->sk_func, \
+ __atp, __cur_keys->sk_argument); \
\
- if (DatumGetBool(__test) == !!(__cur_keys->sk_flags & SK_NEGATE)) \
+ if (!DatumGetBool(__test)) \
{ \
- /* XXX eventually should check if SK_ISNULL */ \
(result) = false; \
break; \
} \
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index 531e30bb6ce..8c83fec3cc7 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: sequence.h,v 1.26 2003/08/08 21:42:41 momjian Exp $
+ * $Id: sequence.h,v 1.27 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,6 +15,8 @@
#include "nodes/parsenodes.h"
#include "access/xlog.h"
+#include "fmgr.h"
+
/*
* On a machine with no 64-bit-int C datatype, sizeof(int64) will not be 8,
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index f56dc4653de..2312c0562e3 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: plannodes.h,v 1.68 2003/08/08 21:42:48 momjian Exp $
+ * $Id: plannodes.h,v 1.69 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -153,15 +153,19 @@ typedef Scan SeqScan;
/* ----------------
* index scan node
+ *
+ * Note: this can actually represent N indexscans, all on the same table
+ * but potentially using different indexes, put together with OR semantics.
* ----------------
*/
typedef struct IndexScan
{
Scan scan;
- List *indxid;
- List *indxqual;
- List *indxqualorig;
- ScanDirection indxorderdir;
+ List *indxid; /* list of index OIDs (1 per scan) */
+ List *indxqual; /* list of sublists of index quals */
+ List *indxqualorig; /* the same in original form */
+ List *indxstrategy; /* list of sublists of strategy numbers */
+ ScanDirection indxorderdir; /* forward or backward or don't care */
} IndexScan;
/* ----------------
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
index 98d357760dc..eed5c5ee9f3 100644
--- a/src/include/pg_config_manual.h
+++ b/src/include/pg_config_manual.h
@@ -6,7 +6,7 @@
* for developers. If you edit any of these, be sure to do a *full*
* rebuild (and an initdb if noted).
*
- * $Id: pg_config_manual.h,v 1.6 2003/09/21 17:57:21 tgl Exp $
+ * $Id: pg_config_manual.h,v 1.7 2003/11/09 21:30:37 tgl Exp $
*------------------------------------------------------------------------
*/
@@ -229,7 +229,6 @@
*/
/* #define IPORTAL_DEBUG */
/* #define HEAPDEBUGALL */
-/* #define ISTRATDEBUG */
/* #define ACLDEBUG */
/* #define RTDEBUG */
/* #define GISTDEBUG */
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 67b1d4b6ccf..a4d3097dffc 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: smgr.h,v 1.37 2003/08/04 02:40:15 momjian Exp $
+ * $Id: smgr.h,v 1.38 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,6 +15,7 @@
#define SMGR_H
#include "access/xlog.h"
+#include "fmgr.h"
#include "storage/relfilenode.h"
#include "storage/block.h"
#include "utils/rel.h"
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index d61b58a2cd4..df42020c04d 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catcache.h,v 1.46 2003/08/04 02:40:15 momjian Exp $
+ * $Id: catcache.h,v 1.47 2003/11/09 21:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,6 +21,7 @@
#define CATCACHE_H
#include "access/htup.h"
+#include "access/skey.h"
#include "lib/dllist.h"
/*
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index d6aaf2c1c25..36146f23d11 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: lsyscache.h,v 1.82 2003/10/04 18:22:59 tgl Exp $
+ * $Id: lsyscache.h,v 1.83 2003/11/09 21:30:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,8 @@ typedef enum IOFuncSelector
} IOFuncSelector;
extern bool op_in_opclass(Oid opno, Oid opclass);
-extern bool op_requires_recheck(Oid opno, Oid opclass);
+extern void get_op_opclass_properties(Oid opno, Oid opclass,
+ int *strategy, bool *recheck);
extern Oid get_opclass_member(Oid opclass, int16 strategy);
extern Oid get_op_hash_function(Oid opno);
extern Oid get_opclass_proc(Oid opclass, int16 procnum);
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 377822afc69..f08d6c0f1f8 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,14 +7,13 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.68 2003/09/24 18:54:01 tgl Exp $
+ * $Id: rel.h,v 1.69 2003/11/09 21:30:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef REL_H
#define REL_H
-#include "access/strat.h"
#include "access/tupdesc.h"
#include "catalog/pg_am.h"
#include "catalog/pg_class.h"
@@ -88,9 +87,8 @@ typedef struct TriggerDesc
} TriggerDesc;
-/* ----------
+/*
* Same for the statistics collector data in Relation and scan data.
- * ----------
*/
typedef struct PgStat_Info
{
@@ -138,9 +136,15 @@ typedef struct RelationData
/* "struct HeapTupleData *" avoids need to include htup.h here */
Form_pg_am rd_am; /* pg_am tuple for index's AM */
- /* index access support info (used only for an index relation) */
+ /*
+ * index access support info (used only for an index relation)
+ *
+ * Note: only operators and support procs for the index's own datatype
+ * are cached, not any cross-type operators. The arrays are indexed by
+ * strategy or support number, which is a sufficient identifier given
+ * that restriction.
+ */
MemoryContext rd_indexcxt; /* private memory cxt for this stuff */
- IndexStrategy rd_istrat; /* operator strategy map */
Oid *rd_operator; /* OIDs of index operators */
RegProcedure *rd_support; /* OIDs of support procedures */
struct FmgrInfo *rd_supportinfo; /* lookup info for support
@@ -242,16 +246,6 @@ typedef Relation *RelationPtr;
#define RelationGetDescr(relation) ((relation)->rd_att)
/*
- * RelationGetIndexStrategy
- * Returns index strategy for a relation.
- *
- * Note:
- * Assumes relation descriptor is valid.
- * Assumes relation descriptor is for an index relation.
- */
-#define RelationGetIndexStrategy(relation) ((relation)->rd_istrat)
-
-/*
* RelationGetRelationName
*
* Returns the rel's name.