66 elog(
ERROR,
"cache lookup failed for operator class %u", opclassoid);
69 opfamilyoid = classform->opcfamily;
70 opcintype = classform->opcintype;
71 opckeytype = classform->opckeytype;
72 opclassname =
NameStr(classform->opcname);
77 elog(
ERROR,
"cache lookup failed for operator family %u", opfamilyoid);
80 opfamilyname =
NameStr(familyform->opfname);
98 if (procform->amproclefttype != procform->amprocrighttype)
101 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
102 errmsg(
"operator family \"%s\" of access method %s contains support function %s with different left and right input types",
103 opfamilyname,
"spgist",
109 switch (procform->amprocnum)
113 2, 2, INTERNALOID, INTERNALOID);
114 configIn.
attType = procform->amproclefttype;
115 memset(&configOut, 0,
sizeof(configOut));
121 configOutLefttype = procform->amproclefttype;
122 configOutRighttype = procform->amprocrighttype;
126 configOutLeafType = opckeytype;
128 configOutLeafType = procform->amproclefttype;
132 configOutLeafType != configOut.
leafType)
135 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
136 errmsg(
"SP-GiST leaf data type %s does not match declared type %s",
140 configOutLeafType = configOut.
leafType;
148 if (configOutLeafType == configIn.
attType)
150 foreach(lc, grouplist)
154 if (group->
lefttype == procform->amproclefttype &&
155 group->
righttype == procform->amprocrighttype)
168 2, 2, INTERNALOID, INTERNALOID);
172 2, 2, INTERNALOID, INTERNALOID);
175 if (configOutLefttype != procform->amproclefttype ||
176 configOutRighttype != procform->amprocrighttype)
180 configOutLeafType,
true,
181 1, 1, procform->amproclefttype);
188 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
189 errmsg(
"operator family \"%s\" of access method %s contains function %s with invalid support number %d",
190 opfamilyname,
"spgist",
192 procform->amprocnum)));
200 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
201 errmsg(
"operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
202 opfamilyname,
"spgist",
204 procform->amprocnum)));
217 if (oprform->amopstrategy < 1 || oprform->amopstrategy > 63)
220 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
221 errmsg(
"operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
222 opfamilyname,
"spgist",
224 oprform->amopstrategy)));
229 if (oprform->amoppurpose != AMOP_SEARCH)
236 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
237 errmsg(
"operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
238 opfamilyname,
"spgist",
244 op_rettype = BOOLOID;
248 oprform->amoplefttype,
249 oprform->amoprighttype))
252 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
253 errmsg(
"operator family \"%s\" of access method %s contains operator %s with wrong signature",
254 opfamilyname,
"spgist",
262 foreach(lc, grouplist)
267 if (thisgroup->
lefttype == opcintype &&
269 opclassgroup = thisgroup;
279 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
280 errmsg(
"operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
281 opfamilyname,
"spgist",
296 if ((thisgroup->
functionset & (((uint64) 1) <<
i)) != 0)
301 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
302 errmsg(
"operator family \"%s\" of access method %s is missing support function %d for type %s",
303 opfamilyname,
"spgist",
i,
314 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
315 errmsg(
"operator class \"%s\" of access method %s is missing operator(s)",
316 opclassname,
"spgist")));
347 foreach(lc, operators)
386 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
387 errmsg(
"support function number %d is invalid for access method %s",
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 opfamily_can_sort_type(Oid opfamilyoid, Oid datatypeoid)
bool check_amoptsproc_signature(Oid funcid)
#define OidIsValid(objectId)
void ReleaseCatCacheList(CatCList *list)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define OidFunctionCall2(functionId, arg1, arg2)
#define HeapTupleIsValid(tuple)
Oid get_op_rettype(Oid opno)
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 PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static const struct fns functions
char * format_operator(Oid operator_oid)
char * format_procedure(Oid procedure_oid)
#define SPGIST_OPTIONS_PROC
#define SPGIST_COMPRESS_PROC
#define SPGIST_CHOOSE_PROC
#define SPGIST_LEAF_CONSISTENT_PROC
#define SPGIST_CONFIG_PROC
#define SPGIST_PICKSPLIT_PROC
#define SPGIST_INNER_CONSISTENT_PROC
bool spgvalidate(Oid opclassoid)
void spgadjustmembers(Oid opfamilyoid, Oid opclassoid, List *operators, List *functions)
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define SearchSysCacheList1(cacheId, key1)