PostgreSQL Source Code: src/backend/access/index/amapi.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
15
20#include "utils/fmgrprotos.h"
22
23
24
25
26
27
28
29
30
31
34{
37
40
42 elog(ERROR, "index access method handler function %u did not return an IndexAmRoutine struct",
43 amhandler);
44
45 return routine;
46}
47
48
49
50
51
52
53
54
57{
61
62
65 {
66 if (noerror)
67 return NULL;
68 elog(ERROR, "cache lookup failed for access method %u",
69 amoid);
70 }
72
73
74 if (amform->amtype != AMTYPE_INDEX)
75 {
76 if (noerror)
77 {
79 return NULL;
80 }
82 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
83 errmsg("access method \"%s\" is not of type %s",
84 NameStr(amform->amname), "INDEX")));
85 }
86
87 amhandler = amform->amhandler;
88
89
91 {
92 if (noerror)
93 {
95 return NULL;
96 }
98 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
99 errmsg("index access method \"%s\" does not have a handler",
100 NameStr(amform->amname))));
101 }
102
104
105
107}
108
109
110
111
112
113
114
115
116
119{
122
123
124 if (amoid == BTREE_AM_OID &&
127
131 else
133
135 elog(ERROR, "could not translate strategy number %d for index AM %u", strategy, amoid);
136
137 return result;
138}
139
140
141
142
143
144
145
146
149{
152
153
154 if (amoid == BTREE_AM_OID &&
157
161 else
163
165 elog(ERROR, "could not translate compare type %u for index AM %u", cmptype, amoid);
166
167 return result;
168}
169
170
171
172
175{
177 bool result;
180 Oid amoid;
182
185 elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
187
188 amoid = classform->opcmethod;
189
191
193
195 elog(ERROR, "function amvalidate is not defined for index access method %u",
196 amoid);
197
198 result = amroutine->amvalidate(opclassoid);
199
200 pfree(amroutine);
201
203}
IndexAmRoutine * GetIndexAmRoutine(Oid amhandler)
StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok)
Datum amvalidate(PG_FUNCTION_ARGS)
CompareType IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily, bool missing_ok)
IndexAmRoutine * GetIndexAmRoutineByAmId(Oid amoid, bool noerror)
#define RegProcedureIsValid(p)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define OidFunctionCall0(functionId)
#define PG_RETURN_BOOL(x)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void pfree(void *pointer)
#define IsA(nodeptr, _type_)
FormData_pg_am * Form_pg_am
FormData_pg_opclass * Form_pg_opclass
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
#define BTMaxStrategyNumber
amtranslate_strategy_function amtranslatestrategy
amtranslate_cmptype_function amtranslatecmptype
amvalidate_function amvalidate
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)