1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Improve index AMs' opclass validation procedures.

The amvalidate functions added in commit 65c5fcd353 were on the
crude side.  Improve them in a few ways:

* Perform signature checking for operators and support functions.

* Apply more thorough checks for missing operators and functions,
where possible.

* Instead of reporting problems as ERRORs, report most problems as INFO
messages and make the amvalidate function return FALSE.  This allows
more than one problem to be discovered per run.

* Report object names rather than OIDs, and work a bit harder on making
the messages understandable.

Also, remove a few more opr_sanity regression test queries that are
now superseded by the amvalidate checks.
This commit is contained in:
Tom Lane
2016-01-21 19:47:15 -05:00
parent b99551832e
commit be44ed27b8
13 changed files with 1414 additions and 771 deletions

View File

@ -1102,6 +1102,29 @@ get_opname(Oid opno)
return NULL;
}
/*
* get_op_rettype
* Given operator oid, return the operator's result type.
*/
Oid
get_op_rettype(Oid opno)
{
HeapTuple tp;
tp = SearchSysCache1(OPEROID, ObjectIdGetDatum(opno));
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
Oid result;
result = optup->oprresult;
ReleaseSysCache(tp);
return result;
}
else
return InvalidOid;
}
/*
* op_input_types
*