aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-06 17:44:25 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-06 17:44:25 +0000
commit42ad25fcd139253912dcee8628f866fbf023ae27 (patch)
treec6dfd4d90b12ef7dcf6bcea88c8cdc732d41fb97 /src
parente57e991e80110f39bb10c0f4752326f8d8c7cb6c (diff)
downloadpostgresql-42ad25fcd139253912dcee8628f866fbf023ae27.tar.gz
postgresql-42ad25fcd139253912dcee8628f866fbf023ae27.zip
init_fcache was being careless about using SearchSysCacheTuple result
over multiple lookups --- it should use SearchSysCacheTupleCopy instead. This accounts for rare failures like 'init_fcache: null probin for procedure 481' when running concurrently with a VACUUM.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/cache/fcache.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index 33528d7bb20..867de40baa9 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -8,12 +8,13 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.31 2000/05/28 17:56:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.32 2000/06/06 17:44:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
+#include "access/heapam.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
@@ -77,11 +78,13 @@ init_fcache(Oid foid,
/* ----------------
* get the procedure tuple corresponding to the given functionOid
+ *
+ * NB: use SearchSysCacheTupleCopy to ensure tuple lives long enough
* ----------------
*/
- procedureTuple = SearchSysCacheTuple(PROCOID,
- ObjectIdGetDatum(foid),
- 0, 0, 0);
+ procedureTuple = SearchSysCacheTupleCopy(PROCOID,
+ ObjectIdGetDatum(foid),
+ 0, 0, 0);
if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "init_fcache: Cache lookup failed for procedure %u",
@@ -245,6 +248,8 @@ init_fcache(Oid foid,
else
retval->func.fn_addr = (PGFunction) NULL;
+ heap_freetuple(procedureTuple);
+
return retval;
}