38{
39 bool result = true;
44 char *opclassname;
47 char *opfamilyname;
49 *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
70 elog(
ERROR,
"cache lookup failed for operator family %u", opfamilyoid);
72
73 opfamilyname =
NameStr(familyform->opfname);
74
75
78
79
81 {
84 bool ok;
85
86
87 switch (procform->amprocnum)
88 {
91 1, 1, INTERNALOID);
92 break;
95 4, 4, INTERNALOID, INTERNALOID,
96 INTERNALOID, INTERNALOID);
97 break;
100 3, 4, INTERNALOID, INTERNALOID,
101 INTERNALOID, INT4OID);
102 break;
105 3, 3, INTERNALOID, INTERNALOID,
106 INTERNALOID);
107 break;
110 break;
111 default:
112
115 {
117 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
118 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
119 opfamilyname, "brin",
121 procform->amprocnum)));
122 result = false;
123 continue;
124 }
125
126 ok = true;
127 break;
128 }
129
130 if (!ok)
131 {
133 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
134 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
135 opfamilyname, "brin",
137 procform->amprocnum)));
138 result = false;
139 }
140
141
142 allfuncs |= ((
uint64) 1) << procform->amprocnum;
143 }
144
145
147 {
150
151
152 if (oprform->amopstrategy < 1 || oprform->amopstrategy > 63)
153 {
155 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
156 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
157 opfamilyname, "brin",
159 oprform->amopstrategy)));
160 result = false;
161 }
162 else
163 {
164
165
166
167
168
169
170
171
172
173
174
175 if (oprform->amoplefttype == oprform->amoprighttype)
176 allops |= ((
uint64) 1) << oprform->amopstrategy;
177 }
178
179
180 if (oprform->amoppurpose != AMOP_SEARCH ||
182 {
184 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
185 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
186 opfamilyname, "brin",
188 result = false;
189 }
190
191
193 oprform->amoplefttype,
194 oprform->amoprighttype))
195 {
197 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
198 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
199 opfamilyname, "brin",
201 result = false;
202 }
203 }
204
205
207 opclassgroup = NULL;
208 foreach(lc, grouplist)
209 {
211
212
213 if (thisgroup->
lefttype == opcintype &&
215 opclassgroup = thisgroup;
216
217
218
219
220
221
222
223
226 continue;
227
228
229
230
231
233 {
235 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
236 errmsg(
"operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
237 opfamilyname, "brin",
240 result = false;
241 }
243 {
245 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
246 errmsg(
"operator family \"%s\" of access method %s is missing support function(s) for types %s and %s",
247 opfamilyname, "brin",
250 result = false;
251 }
252 }
253
254
255 if (!opclassgroup || opclassgroup->
operatorset != allops)
256 {
258 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
259 errmsg(
"operator class \"%s\" of access method %s is missing operator(s)",
260 opclassname, "brin")));
261 result = false;
262 }
264 {
265 if (opclassgroup &&
267 continue;
269 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
270 errmsg(
"operator class \"%s\" of access method %s is missing support function %d",
271 opclassname,
"brin",
i)));
272 result = false;
273 }
274
279
280 return result;
281}
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)
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)