diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
| commit | a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch) | |
| tree | 1c32737389b2530e7152dc2287161b36d9001e8c /src/backend/utils/fmgr/fmgr.c | |
| parent | cff23842a4c68301ddf34559c7af383bb5557054 (diff) | |
| download | postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz | |
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.
Diffstat (limited to 'src/backend/utils/fmgr/fmgr.c')
| -rw-r--r-- | src/backend/utils/fmgr/fmgr.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index c7fbf251f9..5287615eea 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.46 2000/08/24 03:29:07 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.47 2000/11/16 22:30:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -134,9 +134,9 @@ fmgr_info(Oid functionId, FmgrInfo *finfo) } /* Otherwise we need the pg_proc entry */ - procedureTuple = SearchSysCacheTuple(PROCOID, - ObjectIdGetDatum(functionId), - 0, 0, 0); + procedureTuple = SearchSysCache(PROCOID, + ObjectIdGetDatum(functionId), + 0, 0, 0); if (!HeapTupleIsValid(procedureTuple)) elog(ERROR, "fmgr_info: function %u: cache lookup failed", functionId); @@ -149,6 +149,7 @@ fmgr_info(Oid functionId, FmgrInfo *finfo) if (!procedureStruct->proistrusted) { finfo->fn_addr = fmgr_untrusted; + ReleaseSysCache(procedureTuple); return; } @@ -202,14 +203,12 @@ fmgr_info(Oid functionId, FmgrInfo *finfo) /* * Might be a created procedural language; try to look it up. */ - languageTuple = SearchSysCacheTuple(LANGOID, - ObjectIdGetDatum(language), - 0, 0, 0); + languageTuple = SearchSysCache(LANGOID, + ObjectIdGetDatum(language), + 0, 0, 0); if (!HeapTupleIsValid(languageTuple)) - { elog(ERROR, "fmgr_info: cache lookup for language %u failed", language); - } languageStruct = (Form_pg_language) GETSTRUCT(languageTuple); if (languageStruct->lanispl) { @@ -231,8 +230,11 @@ fmgr_info(Oid functionId, FmgrInfo *finfo) elog(ERROR, "fmgr_info: function %u: unsupported language %u", functionId, language); } + ReleaseSysCache(languageTuple); break; } + + ReleaseSysCache(procedureTuple); } |
