aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-11-16 22:30:52 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-11-16 22:30:52 +0000
commita933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch)
tree1c32737389b2530e7152dc2287161b36d9001e8c /src/backend/executor/functions.c
parentcff23842a4c68301ddf34559c7af383bb5557054 (diff)
downloadpostgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz
postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.zip
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/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index ca9c48e294d..98b28c61e10 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.40 2000/11/12 00:36:57 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.41 2000/11/16 22:30:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -183,14 +183,11 @@ init_sql_fcache(FmgrInfo *finfo)
/* ----------------
* get the procedure tuple corresponding to the given function Oid
- *
- * NB: use SearchSysCacheTupleCopy to ensure tuple lives long enough
* ----------------
*/
- procedureTuple = SearchSysCacheTupleCopy(PROCOID,
- ObjectIdGetDatum(foid),
- 0, 0, 0);
-
+ procedureTuple = SearchSysCache(PROCOID,
+ ObjectIdGetDatum(foid),
+ 0, 0, 0);
if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "init_sql_fcache: Cache lookup failed for procedure %u",
foid);
@@ -201,10 +198,9 @@ init_sql_fcache(FmgrInfo *finfo)
* get the return type from the procedure tuple
* ----------------
*/
- typeTuple = SearchSysCacheTuple(TYPEOID,
- ObjectIdGetDatum(procedureStruct->prorettype),
- 0, 0, 0);
-
+ typeTuple = SearchSysCache(TYPEOID,
+ ObjectIdGetDatum(procedureStruct->prorettype),
+ 0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "init_sql_fcache: Cache lookup failed for type %u",
procedureStruct->prorettype);
@@ -286,7 +282,8 @@ init_sql_fcache(FmgrInfo *finfo)
pfree(src);
- heap_freetuple(procedureTuple);
+ ReleaseSysCache(typeTuple);
+ ReleaseSysCache(procedureTuple);
finfo->fn_extra = (void *) fcache;
}