Commit 42ad25fc authored by Tom Lane's avatar Tom Lane

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.
parent e57e991e
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
* *
* *
* IDENTIFICATION * 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 "postgres.h"
#include "access/heapam.h"
#include "catalog/pg_language.h" #include "catalog/pg_language.h"
#include "catalog/pg_proc.h" #include "catalog/pg_proc.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
...@@ -77,9 +78,11 @@ init_fcache(Oid foid, ...@@ -77,9 +78,11 @@ init_fcache(Oid foid,
/* ---------------- /* ----------------
* get the procedure tuple corresponding to the given functionOid * get the procedure tuple corresponding to the given functionOid
*
* NB: use SearchSysCacheTupleCopy to ensure tuple lives long enough
* ---------------- * ----------------
*/ */
procedureTuple = SearchSysCacheTuple(PROCOID, procedureTuple = SearchSysCacheTupleCopy(PROCOID,
ObjectIdGetDatum(foid), ObjectIdGetDatum(foid),
0, 0, 0); 0, 0, 0);
...@@ -245,6 +248,8 @@ init_fcache(Oid foid, ...@@ -245,6 +248,8 @@ init_fcache(Oid foid,
else else
retval->func.fn_addr = (PGFunction) NULL; retval->func.fn_addr = (PGFunction) NULL;
heap_freetuple(procedureTuple);
return retval; return retval;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment