38{
39 bool result = true;
44 char *opclassname;
45 char *opfamilyname;
47 *oprlist;
54
55
58 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
60
61 opfamilyoid = classform->opcfamily;
62 opcintype = classform->opcintype;
63 opclassname =
NameStr(classform->opcname);
64
65
67
68
71
72
74 {
77 bool ok;
78
79
80 switch (procform->amprocnum)
81 {
84 1, 1, INTERNALOID);
85 break;
88 4, 4, INTERNALOID, INTERNALOID,
89 INTERNALOID, INTERNALOID);
90 break;
93 3, 4, INTERNALOID, INTERNALOID,
94 INTERNALOID, INT4OID);
95 break;
98 3, 3, INTERNALOID, INTERNALOID,
99 INTERNALOID);
100 break;
103 break;
104 default:
105
108 {
110 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
111 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
112 opfamilyname, "brin",
114 procform->amprocnum)));
115 result = false;
116 continue;
117 }
118
119 ok = true;
120 break;
121 }
122
123 if (!ok)
124 {
126 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
127 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
128 opfamilyname, "brin",
130 procform->amprocnum)));
131 result = false;
132 }
133
134
135 allfuncs |= ((
uint64) 1) << procform->amprocnum;
136 }
137
138
140 {
143
144
145 if (oprform->amopstrategy < 1 || oprform->amopstrategy > 63)
146 {
148 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
149 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
150 opfamilyname, "brin",
152 oprform->amopstrategy)));
153 result = false;
154 }
155 else
156 {
157
158
159
160
161
162
163
164
165
166
167
168 if (oprform->amoplefttype == oprform->amoprighttype)
169 allops |= ((
uint64) 1) << oprform->amopstrategy;
170 }
171
172
173 if (oprform->amoppurpose != AMOP_SEARCH ||
175 {
177 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
178 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
179 opfamilyname, "brin",
181 result = false;
182 }
183
184
186 oprform->amoplefttype,
187 oprform->amoprighttype))
188 {
190 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
191 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
192 opfamilyname, "brin",
194 result = false;
195 }
196 }
197
198
200 opclassgroup = NULL;
201 foreach(lc, grouplist)
202 {
204
205
206 if (thisgroup->
lefttype == opcintype &&
208 opclassgroup = thisgroup;
209
210
211
212
213
214
215
216
219 continue;
220
221
222
223
224
226 {
228 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
229 errmsg(
"operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
230 opfamilyname, "brin",
233 result = false;
234 }
236 {
238 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
239 errmsg(
"operator family \"%s\" of access method %s is missing support function(s) for types %s and %s",
240 opfamilyname, "brin",
243 result = false;
244 }
245 }
246
247
248 if (!opclassgroup || opclassgroup->
operatorset != allops)
249 {
251 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
252 errmsg(
"operator class \"%s\" of access method %s is missing operator(s)",
253 opclassname, "brin")));
254 result = false;
255 }
257 {
258 if (opclassgroup &&
260 continue;
262 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
263 errmsg(
"operator class \"%s\" of access method %s is missing support function %d",
264 opclassname,
"brin",
i)));
265 result = false;
266 }
267
271
272 return result;
273}
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)
#define BRIN_LAST_OPTIONAL_PROCNUM
#define BRIN_PROCNUM_UNION
#define BRIN_MANDATORY_NPROCS
#define BRIN_PROCNUM_OPTIONS
#define BRIN_FIRST_OPTIONAL_PROCNUM
#define BRIN_PROCNUM_OPCINFO
#define BRIN_PROCNUM_CONSISTENT
#define BRIN_PROCNUM_ADDVALUE
#define OidIsValid(objectId)
void ReleaseCatCacheList(CatCList *list)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
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)