32{
33 bool result = true;
39 char *opclassname;
42 char *opfamilyname;
44 *oprlist;
49
50
53 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
55
56 opfamilyoid = classform->opcfamily;
57 opcintype = classform->opcintype;
58 opckeytype = classform->opckeytype;
60 opckeytype = opcintype;
61 opclassname =
NameStr(classform->opcname);
62
63
66 elog(
ERROR,
"cache lookup failed for operator family %u", opfamilyoid);
68
69 opfamilyname =
NameStr(familyform->opfname);
70
71
74
75
77 {
80 bool ok;
81
82
83
84
85
86 if (procform->amproclefttype != procform->amprocrighttype)
87 {
89 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
90 errmsg(
"operator family \"%s\" of access method %s contains support function %s with different left and right input types",
91 opfamilyname, "gin",
93 result = false;
94 }
95
96
97
98
99
100 if (procform->amproclefttype != opcintype)
101 continue;
102
103
104 switch (procform->amprocnum)
105 {
108 2, 2, opckeytype, opckeytype);
109 break;
111
113 2, 3, opcintype, INTERNALOID,
114 INTERNALOID);
115 break;
117
119 5, 7, opcintype, INTERNALOID,
120 INT2OID, INTERNALOID, INTERNALOID,
121 INTERNALOID, INTERNALOID);
122 break;
124
126 6, 8, INTERNALOID, INT2OID,
127 opcintype, INT4OID,
128 INTERNALOID, INTERNALOID,
129 INTERNALOID, INTERNALOID);
130 break;
133 4, 4, opckeytype, opckeytype,
134 INT2OID, INTERNALOID);
135 break;
138 7, 7, INTERNALOID, INT2OID,
139 opcintype, INT4OID,
140 INTERNALOID, INTERNALOID,
141 INTERNALOID);
142 break;
145 break;
146 default:
148 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
149 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
150 opfamilyname, "gin",
152 procform->amprocnum)));
153 result = false;
154 continue;
155 }
156
157 if (!ok)
158 {
160 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
161 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
162 opfamilyname, "gin",
164 procform->amprocnum)));
165 result = false;
166 }
167 }
168
169
171 {
174
175
176 if (oprform->amopstrategy < 1 || oprform->amopstrategy > 63)
177 {
179 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
180 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
181 opfamilyname, "gin",
183 oprform->amopstrategy)));
184 result = false;
185 }
186
187
188 if (oprform->amoppurpose != AMOP_SEARCH ||
190 {
192 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
193 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
194 opfamilyname, "gin",
196 result = false;
197 }
198
199
201 oprform->amoplefttype,
202 oprform->amoprighttype))
203 {
205 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
206 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
207 opfamilyname, "gin",
209 result = false;
210 }
211 }
212
213
215 opclassgroup = NULL;
216 foreach(lc, grouplist)
217 {
219
220
221 if (thisgroup->
lefttype == opcintype &&
223 opclassgroup = thisgroup;
224
225
226
227
228
229
230
231
232
233 }
234
235
237 {
238 if (opclassgroup &&
240 continue;
243 continue;
245 continue;
247 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
248 errmsg(
"operator class \"%s\" of access method %s is missing support function %d",
249 opclassname,
"gin",
i)));
250 result = false;
251 }
252 if (!opclassgroup ||
255 {
257 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
258 errmsg(
"operator class \"%s\" of access method %s is missing support function %d or %d",
259 opclassname, "gin",
261 result = false;
262 }
263
264
269
270 return result;
271}
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 OidIsValid(objectId)
void ReleaseCatCacheList(CatCList *list)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *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)