On Mon, Jul 24, 2017 at 7:23 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Rushabh Lathia <rushabh.lat...@gmail.com> writes: > > PFA patch, where added elog() to add the error message same as all other > > places. > > Some looking around says that this *isn't* the only place that just > blithely assumes that it will find an opfamily entry. But I agree > that not checking for that isn't up to project standards. > Thanks Tom. I go thorough the get_opfamily_proc() in the system and added the check for InvalidOid. Thanks, Rushabh Lathia www.EnterpriseDB.com
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c index 5267a01..c9c1a54 100644 --- a/src/backend/executor/execExpr.c +++ b/src/backend/executor/execExpr.c @@ -1640,6 +1640,9 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state, lefttype, righttype, BTORDER_PROC); + if (!OidIsValid(proc)) /* should not happen */ + elog(ERROR, "missing support function %d(%u,%u) in opfamily %u", + BTORDER_PROC, lefttype, righttype, opfamily); /* Set up the primary fmgr lookup information */ finfo = palloc0(sizeof(FmgrInfo)); diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index d8aceb1..ff758d6 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -1367,6 +1367,9 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, op_lefttype, op_righttype, BTORDER_PROC); + if (!OidIsValid(opfuncid)) /* should not happen */ + elog(ERROR, "missing support function %d(%u,%u) in opfamily %u", + BTORDER_PROC, op_lefttype, op_righttype, opfamily); inputcollation = lfirst_oid(collids_cell); collids_cell = lnext(collids_cell); diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 43238dd..6bd93b0 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]); diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index 7ec31eb..bc2f164 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -440,6 +440,10 @@ lookup_type_cache(Oid type_id, int flags) typentry->btree_opintype, typentry->btree_opintype, BTORDER_PROC); + if (!OidIsValid(cmp_proc)) /* should not happen */ + elog(ERROR, "missing support function %d(%u,%u) in opfamily %u", + BTORDER_PROC, typentry->btree_opintype, + typentry->btree_opintype, typentry->btree_opf); /* As above, make sure array_cmp or record_cmp will succeed */ if (cmp_proc == F_BTARRAYCMP &&
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers