42{
43 bool result = true;
48 char *opclassname;
51 char *opfamilyname;
53 *oprlist;
57 int usefulgroups;
60
61
64 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
66
67 opfamilyoid = classform->opcfamily;
68 opcintype = classform->opcintype;
69 opclassname =
NameStr(classform->opcname);
70
71
74 elog(
ERROR,
"cache lookup failed for operator family %u", opfamilyoid);
76
77 opfamilyname =
NameStr(familyform->opfname);
78
79
82
83
85 {
88 bool ok;
89
90
91 switch (procform->amprocnum)
92 {
95 2, 2, procform->amproclefttype,
96 procform->amprocrighttype);
97 break;
100 1, 1, INTERNALOID);
101 break;
104 5, 5,
105 procform->amproclefttype,
106 procform->amproclefttype,
107 procform->amprocrighttype,
108 BOOLOID, BOOLOID);
109 break;
112 1, 1, OIDOID);
113 break;
116 break;
117 default:
119 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
120 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
121 opfamilyname, "btree",
123 procform->amprocnum)));
124 result = false;
125 continue;
126 }
127
128 if (!ok)
129 {
131 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
132 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
133 opfamilyname, "btree",
135 procform->amprocnum)));
136 result = false;
137 }
138 }
139
140
142 {
145
146
147 if (oprform->amopstrategy < 1 ||
149 {
151 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
152 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
153 opfamilyname, "btree",
155 oprform->amopstrategy)));
156 result = false;
157 }
158
159
160 if (oprform->amoppurpose != AMOP_SEARCH ||
162 {
164 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
165 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
166 opfamilyname, "btree",
168 result = false;
169 }
170
171
173 oprform->amoplefttype,
174 oprform->amoprighttype))
175 {
177 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
178 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
179 opfamilyname, "btree",
181 result = false;
182 }
183 }
184
185
187 usefulgroups = 0;
188 opclassgroup = NULL;
190 foreach(lc, grouplist)
191 {
193
194
195
196
197
198
199
200
201
204 continue;
205
206
207 usefulgroups++;
208
209
210 if (thisgroup->
lefttype == opcintype &&
212 opclassgroup = thisgroup;
213
214
215
216
217
218
221
222
223
224
225
226
233 {
235 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
236 errmsg(
"operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
237 opfamilyname, "btree",
240 result = false;
241 }
243 {
245 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
246 errmsg(
"operator family \"%s\" of access method %s is missing support function for types %s and %s",
247 opfamilyname, "btree",
250 result = false;
251 }
252 }
253
254
255
256 if (!opclassgroup)
257 {
259 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
260 errmsg(
"operator class \"%s\" of access method %s is missing operator(s)",
261 opclassname, "btree")));
262 result = false;
263 }
264
265
266
267
268
269
270
271
273 {
275 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
276 errmsg(
"operator family \"%s\" of access method %s is missing cross-type operator(s)",
277 opfamilyname, "btree")));
278 result = false;
279 }
280
285
286 return result;
287}
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)
List * list_append_unique_oid(List *list, Oid datum)
#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
FormData_pg_opfamily * Form_pg_opfamily
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)