34{
35 bool result = true;
41 char *opclassname;
44 char *opfamilyname;
46 *oprlist;
51
52
55 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
57
58 opfamilyoid = classform->opcfamily;
59 opcintype = classform->opcintype;
60 opckeytype = classform->opckeytype;
62 opckeytype = opcintype;
63 opclassname =
NameStr(classform->opcname);
64
65
68 elog(
ERROR,
"cache lookup failed for operator family %u", opfamilyoid);
70
71 opfamilyname =
NameStr(familyform->opfname);
72
73
76
77
79 {
82 bool ok;
83
84
85
86
87
88 if (procform->amproclefttype != procform->amprocrighttype)
89 {
91 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
92 errmsg(
"operator family \"%s\" of access method %s contains support function %s with different left and right input types",
93 opfamilyname, "gist",
95 result = false;
96 }
97
98
99
100
101
102 if (procform->amproclefttype != opcintype)
103 continue;
104
105
106 switch (procform->amprocnum)
107 {
110 5, 5, INTERNALOID, opcintype,
111 INT2OID, OIDOID, INTERNALOID);
112 break;
115 2, 2, INTERNALOID, INTERNALOID);
116 break;
121 1, 1, INTERNALOID);
122 break;
125 3, 3, INTERNALOID,
126 INTERNALOID, INTERNALOID);
127 break;
130 2, 2, INTERNALOID, INTERNALOID);
131 break;
134 3, 3, opckeytype, opckeytype,
135 INTERNALOID);
136 break;
139 5, 5, INTERNALOID, opcintype,
140 INT2OID, OIDOID, INTERNALOID);
141 break;
144 break;
147 1, 1, INTERNALOID);
148 break;
151 1, 1, INT4OID);
152 break;
153 default:
155 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
156 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
157 opfamilyname, "gist",
159 procform->amprocnum)));
160 result = false;
161 continue;
162 }
163
164 if (!ok)
165 {
167 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
168 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
169 opfamilyname, "gist",
171 procform->amprocnum)));
172 result = false;
173 }
174 }
175
176
178 {
182
183
184 if (oprform->amopstrategy < 1)
185 {
187 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
188 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
189 opfamilyname, "gist",
191 oprform->amopstrategy)));
192 result = false;
193 }
194
195
196 if (oprform->amoppurpose != AMOP_SEARCH)
197 {
198
200 oprform->amoplefttype,
201 oprform->amoplefttype,
203 {
205 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
206 errmsg(
"operator family \"%s\" of access method %s contains unsupported ORDER BY specification for operator %s",
207 opfamilyname, "gist",
209 result = false;
210 }
211
214 {
216 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
217 errmsg(
"operator family \"%s\" of access method %s contains incorrect ORDER BY opfamily specification for operator %s",
218 opfamilyname, "gist",
220 result = false;
221 }
222 }
223 else
224 {
225
226 op_rettype = BOOLOID;
227 }
228
229
231 oprform->amoplefttype,
232 oprform->amoprighttype))
233 {
235 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
236 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
237 opfamilyname, "gist",
239 result = false;
240 }
241 }
242
243
245 opclassgroup = NULL;
246 foreach(lc, grouplist)
247 {
249
250
251 if (thisgroup->
lefttype == opcintype &&
253 opclassgroup = thisgroup;
254
255
256
257
258
259
260
261
262
263 }
264
265
267 {
268 if (opclassgroup &&
270 continue;
275 continue;
277 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
278 errmsg(
"operator class \"%s\" of access method %s is missing support function %d",
279 opclassname,
"gist",
i)));
280 result = false;
281 }
282
287
288 return result;
289}
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)
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
Oid get_op_rettype(Oid opno)
FormData_pg_amop * Form_pg_amop
FormData_pg_amproc * Form_pg_amproc
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)
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define SearchSysCacheList1(cacheId, key1)