diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-01-21 19:47:15 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-01-21 19:47:15 -0500 |
commit | be44ed27b86ebd165bbedf06a4ac5a8eb943d43c (patch) | |
tree | a8371a5b5e3052dbb3b3118c24956f67c9d3b591 /src/backend/utils/cache | |
parent | b99551832e79c915e4d877cf0a072120bd248748 (diff) | |
download | postgresql-be44ed27b86ebd165bbedf06a4ac5a8eb943d43c.tar.gz postgresql-be44ed27b86ebd165bbedf06a4ac5a8eb943d43c.zip |
Improve index AMs' opclass validation procedures.
The amvalidate functions added in commit 65c5fcd353a859da 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.
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index a180d2b507a..cb26d79afb0 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -1103,6 +1103,29 @@ get_opname(Oid opno) } /* + * 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 * * Returns the left and right input datatypes for an operator |