1 /*-------------------------------------------------------------------------
4 * index strategy type definitions
5 * (separated out from original istrat.h to avoid circular refs)
8 * Copyright (c) 1994, Regents of the University of California
10 * $Id: strat.h,v 1.1 1996/08/27 21:50:25 scrappy Exp $
12 *-------------------------------------------------------------------------
18 #include "access/attnum.h"
19 #include "access/skey.h"
21 typedef uint16 StrategyNumber;
23 #define InvalidStrategy 0
25 typedef struct StrategyTransformMapData {
26 StrategyNumber strategy[1]; /* VARIABLE LENGTH ARRAY */
27 } StrategyTransformMapData; /* VARIABLE LENGTH STRUCTURE */
29 typedef StrategyTransformMapData *StrategyTransformMap;
31 typedef struct StrategyOperatorData {
32 StrategyNumber strategy;
33 bits16 flags; /* scan qualification flags h/skey.h */
34 } StrategyOperatorData;
36 typedef StrategyOperatorData *StrategyOperator;
38 typedef struct StrategyTermData { /* conjunctive term */
40 StrategyOperatorData operatorData[1]; /* VARIABLE LENGTH */
41 } StrategyTermData; /* VARIABLE LENGTH STRUCTURE */
43 typedef StrategyTermData *StrategyTerm;
45 typedef struct StrategyExpressionData { /* disjunctive normal form */
46 StrategyTerm term[1]; /* VARIABLE LENGTH ARRAY */
47 } StrategyExpressionData; /* VARIABLE LENGTH STRUCTURE */
49 typedef StrategyExpressionData *StrategyExpression;
51 typedef struct StrategyEvaluationData {
52 StrategyNumber maxStrategy;
53 StrategyTransformMap negateTransform;
54 StrategyTransformMap commuteTransform;
55 StrategyTransformMap negateCommuteTransform;
56 StrategyExpression expression[12]; /* XXX VARIABLE LENGTH */
57 } StrategyEvaluationData; /* VARIABLE LENGTH STRUCTURE */
59 typedef StrategyEvaluationData *StrategyEvaluation;
62 * StrategyTransformMapIsValid --
63 * Returns true iff strategy transformation map is valid.
65 #define StrategyTransformMapIsValid(transform) PointerIsValid(transform)
68 #ifndef CorrectStrategies /* XXX this should be removable */
69 #define AMStrategies(foo) 12
70 #else /* !defined(CorrectStrategies) */
71 #define AMStrategies(foo) (foo)
72 #endif /* !defined(CorrectStrategies) */
74 typedef struct StrategyMapData {
75 ScanKeyData entry[1]; /* VARIABLE LENGTH ARRAY */
76 } StrategyMapData; /* VARIABLE LENGTH STRUCTURE */
78 typedef StrategyMapData *StrategyMap;
80 typedef struct IndexStrategyData {
81 StrategyMapData strategyMapData[1]; /* VARIABLE LENGTH ARRAY */
82 } IndexStrategyData; /* VARIABLE LENGTH STRUCTURE */
84 typedef IndexStrategyData *IndexStrategy;