From 278cb4341103e967189997985b09981a73e23a34 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 24 Jul 2017 11:23:27 -0400 Subject: Be more consistent about errors for opfamily member lookup failures. Add error checks in some places that were calling get_opfamily_member or get_opfamily_proc and just assuming that the call could never fail. Also, standardize the wording for such errors in some other places. None of these errors are expected in normal use, hence they're just elog not ereport. But they may be handy for diagnosing omissions in custom opclasses. Rushabh Lathia found the oversight in RelationBuildPartitionKey(); I found the others by grepping for all callers of these functions. Discussion: https://postgr.es/m/CAGPqQf2R9Nk8htpv0FFi+FP776EwMyGuORpc9zYkZKC8sFQE3g@mail.gmail.com --- src/backend/utils/cache/relcache.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/backend/utils') diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 43238dd8cbd..6bd93b03d08 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -945,6 +945,10 @@ RelationBuildPartitionKey(Relation relation) opclassform->opcintype, opclassform->opcintype, BTORDER_PROC); + if (!OidIsValid(funcid)) /* should not happen */ + elog(ERROR, "missing support function %d(%u,%u) in opfamily %u", + BTORDER_PROC, opclassform->opcintype, opclassform->opcintype, + opclassform->opcfamily); fmgr_info(funcid, &key->partsupfunc[i]); -- cgit v1.2.3