33{
34 bool result = true;
40 char *opclassname;
41 char *opfamilyname;
43 *oprlist;
48
49
52 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
54
55 opfamilyoid = classform->opcfamily;
56 opcintype = classform->opcintype;
57 opckeytype = classform->opckeytype;
59 opckeytype = opcintype;
60 opclassname =
NameStr(classform->opcname);
61
62
64
65
68
69
71 {
74 bool ok;
75
76
77
78
79
80 if (procform->amproclefttype != procform->amprocrighttype)
81 {
83 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
84 errmsg(
"operator family \"%s\" of access method %s contains support function %s with different left and right input types",
85 opfamilyname, "gist",
87 result = false;
88 }
89
90
91
92
93
94 if (procform->amproclefttype != opcintype)
95 continue;
96
97
98 switch (procform->amprocnum)
99 {
102 5, 5, INTERNALOID, opcintype,
103 INT2OID, OIDOID, INTERNALOID);
104 break;
107 2, 2, INTERNALOID, INTERNALOID);
108 break;
113 1, 1, INTERNALOID);
114 break;
117 3, 3, INTERNALOID,
118 INTERNALOID, INTERNALOID);
119 break;
122 2, 2, INTERNALOID, INTERNALOID);
123 break;
126 3, 3, opckeytype, opckeytype,
127 INTERNALOID);
128 break;
131 5, 5, INTERNALOID, opcintype,
132 INT2OID, OIDOID, INTERNALOID);
133 break;
136 break;
139 1, 1, INTERNALOID);
140 break;
143 1, 1, INT4OID) &&
144 procform->amproclefttype == ANYOID &&
145 procform->amprocrighttype == ANYOID;
146 break;
147 default:
149 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
150 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
151 opfamilyname, "gist",
153 procform->amprocnum)));
154 result = false;
155 continue;
156 }
157
158 if (!ok)
159 {
161 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
162 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
163 opfamilyname, "gist",
165 procform->amprocnum)));
166 result = false;
167 }
168 }
169
170
172 {
176
177
178 if (oprform->amopstrategy < 1)
179 {
181 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
182 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
183 opfamilyname, "gist",
185 oprform->amopstrategy)));
186 result = false;
187 }
188
189
190 if (oprform->amoppurpose != AMOP_SEARCH)
191 {
192
194 oprform->amoplefttype,
195 oprform->amoplefttype,
197 {
199 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
200 errmsg(
"operator family \"%s\" of access method %s contains unsupported ORDER BY specification for operator %s",
201 opfamilyname, "gist",
203 result = false;
204 }
205
208 {
210 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
211 errmsg(
"operator family \"%s\" of access method %s contains incorrect ORDER BY opfamily specification for operator %s",
212 opfamilyname, "gist",
214 result = false;
215 }
216 }
217 else
218 {
219
220 op_rettype = BOOLOID;
221 }
222
223
225 oprform->amoplefttype,
226 oprform->amoprighttype))
227 {
229 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
230 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
231 opfamilyname, "gist",
233 result = false;
234 }
235 }
236
237
239 opclassgroup = NULL;
240 foreach(lc, grouplist)
241 {
243
244
245 if (thisgroup->
lefttype == opcintype &&
247 opclassgroup = thisgroup;
248
249
250
251
252
253
254
255
256
257 }
258
259
261 {
262 if (opclassgroup &&
264 continue;
269 continue;
271 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
272 errmsg(
"operator class \"%s\" of access method %s is missing support function %d",
273 opclassname,
"gist",
i)));
274 result = false;
275 }
276
280
281 return result;
282}
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 opfamily_can_sort_type(Oid opfamilyoid, Oid datatypeoid)
bool check_amoptsproc_signature(Oid funcid)
#define OidIsValid(objectId)
void ReleaseCatCacheList(CatCList *list)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
Oid get_op_rettype(Oid opno)
char * get_opfamily_name(Oid opfid, bool missing_ok)
FormData_pg_amop * Form_pg_amop
FormData_pg_amproc * Form_pg_amproc
FormData_pg_opclass * Form_pg_opclass
static Datum ObjectIdGetDatum(Oid X)
char * format_procedure(Oid procedure_oid)
char * format_operator(Oid operator_oid)
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define SearchSysCacheList1(cacheId, key1)