41{
42 bool result = true;
47 char *opclassname;
48 char *opfamilyname;
50 *oprlist;
56
57
60 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
62
63 opfamilyoid = classform->opcfamily;
64 opcintype = classform->opcintype;
65 opclassname =
NameStr(classform->opcname);
66
67
69
70
73
74
76 {
79 bool ok;
80
81
82
83
84
85 if (procform->amproclefttype != procform->amprocrighttype)
86 {
88 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
89 errmsg(
"operator family \"%s\" of access method %s contains support function %s with different left and right input types",
90 opfamilyname, "hash",
92 result = false;
93 }
94
95
96 switch (procform->amprocnum)
97 {
100 1, 1, procform->amproclefttype);
101 break;
104 2, 2, procform->amproclefttype, INT8OID);
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, "hash",
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, "hash",
127 procform->amprocnum)));
128 result = false;
129 }
130
131
133 {
135 }
136 }
137
138
140 {
143
144
145 if (oprform->amopstrategy < 1 ||
147 {
149 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
150 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
151 opfamilyname, "hash",
153 oprform->amopstrategy)));
154 result = false;
155 }
156
157
158 if (oprform->amoppurpose != AMOP_SEARCH ||
160 {
162 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
163 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
164 opfamilyname, "hash",
166 result = false;
167 }
168
169
171 oprform->amoplefttype,
172 oprform->amoprighttype))
173 {
175 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
176 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
177 opfamilyname, "hash",
179 result = false;
180 }
181
182
185 {
187 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
188 errmsg(
"operator family \"%s\" of access method %s lacks support function for operator %s",
189 opfamilyname, "hash",
191 result = false;
192 }
193 }
194
195
197 opclassgroup = NULL;
198 foreach(lc, grouplist)
199 {
201
202
203 if (thisgroup->
lefttype == opcintype &&
205 opclassgroup = thisgroup;
206
207
208
209
210
211
213 {
215 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
216 errmsg(
"operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
217 opfamilyname, "hash",
220 result = false;
221 }
222 }
223
224
225
226 if (!opclassgroup)
227 {
229 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
230 errmsg(
"operator class \"%s\" of access method %s is missing operator(s)",
231 opclassname, "hash")));
232 result = false;
233 }
234
235
236
237
238
239
240
243 {
245 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
246 errmsg(
"operator family \"%s\" of access method %s is missing cross-type operator(s)",
247 opfamilyname, "hash")));
248 result = false;
249 }
250
254
255 return result;
256}
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 HASHEXTENDED_PROC
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
List * list_append_unique_oid(List *list, Oid datum)
bool list_member_oid(const List *list, Oid datum)
char * get_opfamily_name(Oid opfid, bool missing_ok)
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 HTMaxStrategyNumber
#define HTEqualStrategyNumber
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define SearchSysCacheList1(cacheId, key1)