32{
33 bool result = true;
39 char *opclassname;
40 char *opfamilyname;
42 *oprlist;
47
48
51 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
53
54 opfamilyoid = classform->opcfamily;
55 opcintype = classform->opcintype;
56 opckeytype = classform->opckeytype;
58 opckeytype = opcintype;
59 opclassname =
NameStr(classform->opcname);
60
61
63
64
67
68
70 {
73 bool ok;
74
75
76
77
78
79 if (procform->amproclefttype != procform->amprocrighttype)
80 {
82 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
83 errmsg(
"operator family \"%s\" of access method %s contains support function %s with different left and right input types",
84 opfamilyname, "gin",
86 result = false;
87 }
88
89
90
91
92
93 if (procform->amproclefttype != opcintype)
94 continue;
95
96
97 switch (procform->amprocnum)
98 {
101 2, 2, opckeytype, opckeytype);
102 break;
104
106 2, 3, opcintype, INTERNALOID,
107 INTERNALOID);
108 break;
110
112 5, 7, opcintype, INTERNALOID,
113 INT2OID, INTERNALOID, INTERNALOID,
114 INTERNALOID, INTERNALOID);
115 break;
117
119 6, 8, INTERNALOID, INT2OID,
120 opcintype, INT4OID,
121 INTERNALOID, INTERNALOID,
122 INTERNALOID, INTERNALOID);
123 break;
126 4, 4, opckeytype, opckeytype,
127 INT2OID, INTERNALOID);
128 break;
131 7, 7, INTERNALOID, INT2OID,
132 opcintype, INT4OID,
133 INTERNALOID, INTERNALOID,
134 INTERNALOID);
135 break;
138 break;
139 default:
141 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
142 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
143 opfamilyname, "gin",
145 procform->amprocnum)));
146 result = false;
147 continue;
148 }
149
150 if (!ok)
151 {
153 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
154 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
155 opfamilyname, "gin",
157 procform->amprocnum)));
158 result = false;
159 }
160 }
161
162
164 {
167
168
169 if (oprform->amopstrategy < 1 || oprform->amopstrategy > 63)
170 {
172 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
173 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
174 opfamilyname, "gin",
176 oprform->amopstrategy)));
177 result = false;
178 }
179
180
181 if (oprform->amoppurpose != AMOP_SEARCH ||
183 {
185 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
186 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
187 opfamilyname, "gin",
189 result = false;
190 }
191
192
194 oprform->amoplefttype,
195 oprform->amoprighttype))
196 {
198 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
199 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
200 opfamilyname, "gin",
202 result = false;
203 }
204 }
205
206
208 opclassgroup = NULL;
209 foreach(lc, grouplist)
210 {
212
213
214 if (thisgroup->
lefttype == opcintype &&
216 opclassgroup = thisgroup;
217
218
219
220
221
222
223
224
225
226 }
227
228
230 {
231 if (opclassgroup &&
233 continue;
236 continue;
238 continue;
240 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
241 errmsg(
"operator class \"%s\" of access method %s is missing support function %d",
242 opclassname,
"gin",
i)));
243 result = false;
244 }
245 if (!opclassgroup ||
248 {
250 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
251 errmsg(
"operator class \"%s\" of access method %s is missing support function %d or %d",
252 opclassname, "gin",
254 result = false;
255 }
256
257
261
262 return result;
263}
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)
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)