/* Fetch opfamily information */
opfamilyname = get_opfamily_name(opfamilyoid, false);
/* Fetch all operators and support functions of the opfamily */
oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));
grouplist = identify_opfamily_groups(oprlist, proclist);
/* Check individual support functions */ for (i = 0; i < proclist->n_members; i++)
{
HeapTuple proctup = &proclist->members[i]->tuple;
Form_pg_amproc procform = (Form_pg_amproc) GETSTRUCT(proctup); bool ok;
/* *AllSP-GiSTsupportfunctionsshouldberegisteredwithmatching *left/righttypes
*/ if (procform->amproclefttype != procform->amprocrighttype)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types",
opfamilyname, "spgist",
format_procedure(procform->amproc))));
result = false;
}
/* Check procedure numbers and function signatures */ switch (procform->amprocnum)
{ case SPGIST_CONFIG_PROC:
ok = check_amproc_signature(procform->amproc, VOIDOID, true, 2, 2, INTERNALOID, INTERNALOID);
configIn.attType = procform->amproclefttype;
memset(&configOut, 0, sizeof(configOut));
/* Default leaf type is opckeytype or input type */ if (OidIsValid(opckeytype))
configOutLeafType = opckeytype; else
configOutLeafType = procform->amproclefttype;
/* If some other leaf datum type is specified, warn */ if (OidIsValid(configOut.leafType) &&
configOutLeafType != configOut.leafType)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("SP-GiST leaf data type %s does not match declared type %s",
format_type_be(configOut.leafType),
format_type_be(configOutLeafType))));
result = false;
configOutLeafType = configOut.leafType;
}
if (group->lefttype == procform->amproclefttype &&
group->righttype == procform->amprocrighttype)
{
group->functionset |=
((uint64) 1) << SPGIST_COMPRESS_PROC; break;
}
}
} break; case SPGIST_CHOOSE_PROC: case SPGIST_PICKSPLIT_PROC: case SPGIST_INNER_CONSISTENT_PROC:
ok = check_amproc_signature(procform->amproc, VOIDOID, true, 2, 2, INTERNALOID, INTERNALOID); break; case SPGIST_LEAF_CONSISTENT_PROC:
ok = check_amproc_signature(procform->amproc, BOOLOID, true, 2, 2, INTERNALOID, INTERNALOID); break; case SPGIST_COMPRESS_PROC: if (configOutLefttype != procform->amproclefttype ||
configOutRighttype != procform->amprocrighttype)
ok = false; else
ok = check_amproc_signature(procform->amproc,
configOutLeafType, true, 1, 1, procform->amproclefttype); break; case SPGIST_OPTIONS_PROC:
ok = check_amoptsproc_signature(procform->amproc); break; default:
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains function %s with invalid support number %d",
opfamilyname, "spgist",
format_procedure(procform->amproc),
procform->amprocnum)));
result = false; continue; /* don't want additional message */
}
if (!ok)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",
opfamilyname, "spgist",
format_procedure(procform->amproc),
procform->amprocnum)));
result = false;
}
}
/* Check individual operators */ for (i = 0; i < oprlist->n_members; i++)
{
HeapTuple oprtup = &oprlist->members[i]->tuple;
Form_pg_amop oprform = (Form_pg_amop) GETSTRUCT(oprtup);
Oid op_rettype;
/* TODO: Check that only allowed strategy numbers exist */ if (oprform->amopstrategy < 1 || oprform->amopstrategy > 63)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",
opfamilyname, "spgist",
format_operator(oprform->amopopr),
oprform->amopstrategy)));
result = false;
}
/* spgist supports ORDER BY operators */ if (oprform->amoppurpose != AMOP_SEARCH)
{ /* ... and operator result must match the claimed btree opfamily */
op_rettype = get_op_rettype(oprform->amopopr); if (!opfamily_can_sort_type(oprform->amopsortfamily, op_rettype))
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",
opfamilyname, "spgist",
format_operator(oprform->amopopr))));
result = false;
}
} else
op_rettype = BOOLOID;
/* Check operator signature --- same for all spgist strategies */ if (!check_amop_signature(oprform->amopopr, op_rettype,
oprform->amoplefttype,
oprform->amoprighttype))
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s contains operator %s with wrong signature",
opfamilyname, "spgist",
format_operator(oprform->amopopr))));
result = false;
}
}
/* Now check for inconsistent groups of operators/functions */
opclassgroup = NULL;
foreach(lc, grouplist)
{
OpFamilyOpFuncGroup *thisgroup = (OpFamilyOpFuncGroup *) lfirst(lc);
/* Remember the group exactly matching the test opclass */ if (thisgroup->lefttype == opcintype &&
thisgroup->righttype == opcintype)
opclassgroup = thisgroup;
/* *Complainifthereareanydatatypepairswithfunctionsbutno *operators.Thisisaboutthebestwecandofornowtodetect *missingoperators.
*/ if (thisgroup->operatorset == 0)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",
opfamilyname, "spgist",
format_type_be(thisgroup->lefttype),
format_type_be(thisgroup->righttype))));
result = false;
}
/* *Complainifwe'remissingfunctionsforanydatatype,remembering *thatSP-GiSTdoesn'tusecross-typesupportfunctions.
*/ if (thisgroup->lefttype != thisgroup->righttype) continue;
for (i = 1; i <= SPGISTNProc; i++)
{ if ((thisgroup->functionset & (((uint64) 1) << i)) != 0) continue; /* got it */ if (i == SPGIST_OPTIONS_PROC) continue; /* optional method */
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator family \"%s\" of access method %s is missing support function %d for type %s",
opfamilyname, "spgist", i,
format_type_be(thisgroup->lefttype))));
result = false;
}
}
/* Check that the originally-named opclass is supported */ /* (if group is there, we already checked it adequately above) */ if (!opclassgroup)
{
ereport(INFO,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("operator class \"%s\" of access method %s is missing operator(s)",
opclassname, "spgist")));
result = false;
}
/* *Precheckingfunctionforaddingoperators/functionstoanSP-GiSTopfamily.
*/ void
spgadjustmembers(Oid opfamilyoid,
Oid opclassoid,
List *operators,
List *functions)
{
ListCell *lc;
switch (op->number)
{ case SPGIST_CONFIG_PROC: case SPGIST_CHOOSE_PROC: case SPGIST_PICKSPLIT_PROC: case SPGIST_INNER_CONSISTENT_PROC: case SPGIST_LEAF_CONSISTENT_PROC: /* Required support function */
op->ref_is_hard = true; break; case SPGIST_COMPRESS_PROC: case SPGIST_OPTIONS_PROC: /* Optional, so force it to be a soft family dependency */
op->ref_is_hard = false;
op->ref_is_family = true;
op->refobjid = opfamilyoid; break; default:
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("support function number %d is invalid for access method %s",
op->number, "spgist"))); break;
}
}
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.18Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-08-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.