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/adt/regproc.c | |
parent | cff23842a4c68301ddf34559c7af383bb5557054 (diff) | |
download | postgresql-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/utils/adt/regproc.c')
-rw-r--r-- | src/backend/utils/adt/regproc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index 84c4694115d..4a2bb3c4fd6 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.58 2000/07/09 21:30:12 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.59 2000/11/16 22:30:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -55,13 +55,12 @@ regprocin(PG_FUNCTION_ARGS) if (pro_name_or_oid[0] >= '0' && pro_name_or_oid[0] <= '9') { - proctup = SearchSysCacheTuple(PROCOID, - DirectFunctionCall1(oidin, + result = (RegProcedure) + GetSysCacheOid(PROCOID, + DirectFunctionCall1(oidin, CStringGetDatum(pro_name_or_oid)), - 0, 0, 0); - if (HeapTupleIsValid(proctup)) - result = (RegProcedure) proctup->t_data->t_oid; - else + 0, 0, 0); + if (!RegProcedureIsValid(result)) elog(ERROR, "No procedure with oid %s", pro_name_or_oid); } else @@ -176,9 +175,9 @@ regprocout(PG_FUNCTION_ARGS) if (!IsBootstrapProcessingMode()) { - proctup = SearchSysCacheTuple(PROCOID, - ObjectIdGetDatum(proid), - 0, 0, 0); + proctup = SearchSysCache(PROCOID, + ObjectIdGetDatum(proid), + 0, 0, 0); if (HeapTupleIsValid(proctup)) { @@ -186,6 +185,7 @@ regprocout(PG_FUNCTION_ARGS) s = NameStr(((Form_pg_proc) GETSTRUCT(proctup))->proname); StrNCpy(result, s, NAMEDATALEN); + ReleaseSysCache(proctup); } else { |