31{
32 bool result = true;
38 char *opclassname;
39 char *opfamilyname;
41 *oprlist;
46
47
50 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
52
53 opfamilyoid = classform->opcfamily;
54 opcintype = classform->opcintype;
55 opckeytype = classform->opckeytype;
57 opckeytype = opcintype;
58 opclassname =
NameStr(classform->opcname);
59
60
62
63
66
67
69 {
72 bool ok;
73
74
75
76
77
78 if (procform->amproclefttype != procform->amprocrighttype)
79 {
81 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
82 errmsg(
"bloom opfamily %s contains support procedure %s with cross-type registration",
83 opfamilyname,
85 result = false;
86 }
87
88
89
90
91
92 if (procform->amproclefttype != opcintype)
93 continue;
94
95
96 switch (procform->amprocnum)
97 {
100 1, 1, opckeytype);
101 break;
104 break;
105 default:
107 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
108 errmsg(
"bloom opfamily %s contains function %s with invalid support number %d",
109 opfamilyname,
111 procform->amprocnum)));
112 result = false;
113 continue;
114 }
115
116 if (!ok)
117 {
119 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
120 errmsg(
"bloom opfamily %s contains function %s with wrong signature for support number %d",
121 opfamilyname,
123 procform->amprocnum)));
124 result = false;
125 }
126 }
127
128
130 {
133
134
135 if (oprform->amopstrategy < 1 ||
137 {
139 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
140 errmsg(
"bloom opfamily %s contains operator %s with invalid strategy number %d",
141 opfamilyname,
143 oprform->amopstrategy)));
144 result = false;
145 }
146
147
148 if (oprform->amoppurpose != AMOP_SEARCH ||
150 {
152 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
153 errmsg(
"bloom opfamily %s contains invalid ORDER BY specification for operator %s",
154 opfamilyname,
156 result = false;
157 }
158
159
161 oprform->amoplefttype,
162 oprform->amoprighttype))
163 {
165 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
166 errmsg(
"bloom opfamily %s contains operator %s with wrong signature",
167 opfamilyname,
169 result = false;
170 }
171 }
172
173
175 opclassgroup = NULL;
176 foreach(lc, grouplist)
177 {
179
180
181 if (thisgroup->
lefttype == opcintype &&
183 opclassgroup = thisgroup;
184
185
186
187
188
189
190
191
192
193 }
194
195
197 {
198 if (opclassgroup &&
200 continue;
202 continue;
204 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
205 errmsg(
"bloom opclass %s is missing support function %d",
207 result = false;
208 }
209
213
214 return result;
215}
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 BLOOM_NSTRATEGIES
#define BLOOM_OPTIONS_PROC
#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)