41{
42 bool result = true;
47 char *opclassname;
48 char *opfamilyname;
50 *oprlist;
54 int usefulgroups;
57
58
61 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
63
64 opfamilyoid = classform->opcfamily;
65 opcintype = classform->opcintype;
66 opclassname =
NameStr(classform->opcname);
67
68
70
71
74
75
77 {
80 bool ok;
81
82
83 switch (procform->amprocnum)
84 {
87 2, 2, procform->amproclefttype,
88 procform->amprocrighttype);
89 break;
92 1, 1, INTERNALOID);
93 break;
96 5, 5,
97 procform->amproclefttype,
98 procform->amproclefttype,
99 procform->amprocrighttype,
100 BOOLOID, BOOLOID);
101 break;
104 1, 1, OIDOID);
105 break;
108 break;
109 default:
111 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
112 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
113 opfamilyname, "btree",
115 procform->amprocnum)));
116 result = false;
117 continue;
118 }
119
120 if (!ok)
121 {
123 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
124 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
125 opfamilyname, "btree",
127 procform->amprocnum)));
128 result = false;
129 }
130 }
131
132
134 {
137
138
139 if (oprform->amopstrategy < 1 ||
141 {
143 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
144 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
145 opfamilyname, "btree",
147 oprform->amopstrategy)));
148 result = false;
149 }
150
151
152 if (oprform->amoppurpose != AMOP_SEARCH ||
154 {
156 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
157 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
158 opfamilyname, "btree",
160 result = false;
161 }
162
163
165 oprform->amoplefttype,
166 oprform->amoprighttype))
167 {
169 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
170 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
171 opfamilyname, "btree",
173 result = false;
174 }
175 }
176
177
179 usefulgroups = 0;
180 opclassgroup = NULL;
182 foreach(lc, grouplist)
183 {
185
186
187
188
189
190
191
192
193
196 continue;
197
198
199 usefulgroups++;
200
201
202 if (thisgroup->
lefttype == opcintype &&
204 opclassgroup = thisgroup;
205
206
207
208
209
210
213
214
215
216
217
218
225 {
227 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
228 errmsg(
"operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
229 opfamilyname, "btree",
232 result = false;
233 }
235 {
237 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
238 errmsg(
"operator family \"%s\" of access method %s is missing support function for types %s and %s",
239 opfamilyname, "btree",
242 result = false;
243 }
244 }
245
246
247
248 if (!opclassgroup)
249 {
251 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
252 errmsg(
"operator class \"%s\" of access method %s is missing operator(s)",
253 opclassname, "btree")));
254 result = false;
255 }
256
257
258
259
260
261
262
263
265 {
267 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
268 errmsg(
"operator family \"%s\" of access method %s is missing cross-type operator(s)",
269 opfamilyname, "btree")));
270 result = false;
271 }
272
276
277 return result;
278}
bool check_amproc_signature(Oid funcid, Oid restype, bool exact, int minargs, int maxargs,...)
bool check_amop_signature(Oid opno, Oid restype, Oid lefttype, Oid righttype)
List * identify_opfamily_groups(CatCList *oprlist, CatCList *proclist)
bool check_amoptsproc_signature(Oid funcid)
void ReleaseCatCacheList(CatCList *list)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
List * list_append_unique_oid(List *list, Oid datum)
char * get_opfamily_name(Oid opfid, bool missing_ok)
#define BTEQUALIMAGE_PROC
#define BTSORTSUPPORT_PROC
FormData_pg_amop * Form_pg_amop
FormData_pg_amproc * Form_pg_amproc
static int list_length(const List *l)
FormData_pg_opclass * Form_pg_opclass
static Datum ObjectIdGetDatum(Oid X)
char * format_procedure(Oid procedure_oid)
char * format_operator(Oid operator_oid)
#define BTGreaterStrategyNumber
#define BTMaxStrategyNumber
#define BTLessStrategyNumber
#define BTEqualStrategyNumber
#define BTLessEqualStrategyNumber
#define BTGreaterEqualStrategyNumber
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define SearchSysCacheList1(cacheId, key1)