From a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 16 Nov 2000 22:30:52 +0000 Subject: Change SearchSysCache coding conventions so that a reference count is maintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info. --- src/backend/executor/nodeMergejoin.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/backend/executor/nodeMergejoin.c') diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c index 9d4ca0a8d54..dbeaa7a2a53 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.38 2000/09/12 21:06:48 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.39 2000/11/16 22:30:22 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -147,26 +147,29 @@ MJFormSkipQual(List *qualList, char *replaceopname) * if we search with the actual operand types. * ---------------- */ - optup = get_operator_tuple(op->opno); + optup = SearchSysCache(OPEROID, + ObjectIdGetDatum(op->opno), + 0, 0, 0); if (!HeapTupleIsValid(optup)) /* shouldn't happen */ elog(ERROR, "MJFormSkipQual: operator %u not found", op->opno); opform = (Form_pg_operator) GETSTRUCT(optup); oprleft = opform->oprleft; oprright = opform->oprright; + ReleaseSysCache(optup); /* ---------------- * Now look up the matching "<" or ">" operator. If there isn't one, * whoever marked the "=" operator mergejoinable was a loser. * ---------------- */ - optup = SearchSysCacheTuple(OPERNAME, - PointerGetDatum(replaceopname), - ObjectIdGetDatum(oprleft), - ObjectIdGetDatum(oprright), - CharGetDatum('b')); + optup = SearchSysCache(OPERNAME, + PointerGetDatum(replaceopname), + ObjectIdGetDatum(oprleft), + ObjectIdGetDatum(oprright), + CharGetDatum('b')); if (!HeapTupleIsValid(optup)) elog(ERROR, - "MJFormSkipQual: mergejoin operator %u has no matching %s op", + "MJFormSkipQual: mergejoin operator %u has no matching %s op", op->opno, replaceopname); opform = (Form_pg_operator) GETSTRUCT(optup); @@ -177,6 +180,7 @@ MJFormSkipQual(List *qualList, char *replaceopname) op->opno = optup->t_data->t_oid; op->opid = opform->oprcode; op->op_fcache = NULL; + ReleaseSysCache(optup); } return qualCopy; -- cgit v1.2.3