42{
43 bool result = true;
48 char *opclassname;
51 char *opfamilyname;
53 *oprlist;
59
60
63 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
65
66 opfamilyoid = classform->opcfamily;
67 opcintype = classform->opcintype;
68 opclassname =
NameStr(classform->opcname);
69
70
73 elog(
ERROR,
"cache lookup failed for operator family %u", opfamilyoid);
75
76 opfamilyname =
NameStr(familyform->opfname);
77
78
81
82
84 {
87 bool ok;
88
89
90
91
92
93 if (procform->amproclefttype != procform->amprocrighttype)
94 {
96 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
97 errmsg(
"operator family \"%s\" of access method %s contains support function %s with different left and right input types",
98 opfamilyname, "hash",
100 result = false;
101 }
102
103
104 switch (procform->amprocnum)
105 {
108 1, 1, procform->amproclefttype);
109 break;
112 2, 2, procform->amproclefttype, INT8OID);
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, "hash",
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, "hash",
135 procform->amprocnum)));
136 result = false;
137 }
138
139
141 {
143 }
144 }
145
146
148 {
151
152
153 if (oprform->amopstrategy < 1 ||
155 {
157 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
158 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
159 opfamilyname, "hash",
161 oprform->amopstrategy)));
162 result = false;
163 }
164
165
166 if (oprform->amoppurpose != AMOP_SEARCH ||
168 {
170 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
171 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
172 opfamilyname, "hash",
174 result = false;
175 }
176
177
179 oprform->amoplefttype,
180 oprform->amoprighttype))
181 {
183 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
184 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
185 opfamilyname, "hash",
187 result = false;
188 }
189
190
193 {
195 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
196 errmsg(
"operator family \"%s\" of access method %s lacks support function for operator %s",
197 opfamilyname, "hash",
199 result = false;
200 }
201 }
202
203
205 opclassgroup = NULL;
206 foreach(lc, grouplist)
207 {
209
210
211 if (thisgroup->
lefttype == opcintype &&
213 opclassgroup = thisgroup;
214
215
216
217
218
219
221 {
223 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
224 errmsg(
"operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
225 opfamilyname, "hash",
228 result = false;
229 }
230 }
231
232
233
234 if (!opclassgroup)
235 {
237 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
238 errmsg(
"operator class \"%s\" of access method %s is missing operator(s)",
239 opclassname, "hash")));
240 result = false;
241 }
242
243
244
245
246
247
248
251 {
253 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
254 errmsg(
"operator family \"%s\" of access method %s is missing cross-type operator(s)",
255 opfamilyname, "hash")));
256 result = false;
257 }
258
263
264 return result;
265}
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)
List * list_append_unique_oid(List *list, Oid datum)
bool list_member_oid(const List *list, Oid datum)
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 HTMaxStrategyNumber
#define HTEqualStrategyNumber
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define SearchSysCacheList1(cacheId, key1)