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/commands/dbcommands.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/backend/commands/dbcommands.c') diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 70fd952db63..464a9b68fb2 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.67 2000/11/14 18:37:41 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.68 2000/11/16 22:30:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -445,9 +445,9 @@ get_user_info(Oid use_sysid, bool *use_super, bool *use_createdb) { HeapTuple utup; - utup = SearchSysCacheTuple(SHADOWSYSID, - ObjectIdGetDatum(use_sysid), - 0, 0, 0); + utup = SearchSysCache(SHADOWSYSID, + ObjectIdGetDatum(use_sysid), + 0, 0, 0); if (!HeapTupleIsValid(utup)) return false; @@ -457,6 +457,8 @@ get_user_info(Oid use_sysid, bool *use_super, bool *use_createdb) if (use_createdb) *use_createdb = ((Form_pg_shadow) GETSTRUCT(utup))->usecreatedb; + ReleaseSysCache(utup); + return true; } -- cgit v1.2.3