Commit cb36c0f6 authored by Tom Lane's avatar Tom Lane

In RelationNameGetRelation(), replace temp table name by

real name before doing lookup.  We only want to index temp tables by their
real names in the relcache, to ensure there's not more than one relcache
entry for them.
parent 15dd1678
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.69 1999/09/04 18:42:13 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.70 1999/09/04 21:47:23 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/catcache.h" #include "utils/catcache.h"
#include "utils/relcache.h" #include "utils/relcache.h"
#include "utils/temprel.h"
static void RelationFlushRelation(Relation *relationPtr, static void RelationFlushRelation(Relation *relationPtr,
...@@ -1182,6 +1183,7 @@ RelationIdGetRelation(Oid relationId) ...@@ -1182,6 +1183,7 @@ RelationIdGetRelation(Oid relationId)
Relation Relation
RelationNameGetRelation(char *relationName) RelationNameGetRelation(char *relationName)
{ {
char *temprelname;
Relation rd; Relation rd;
RelationBuildDescInfo buildinfo; RelationBuildDescInfo buildinfo;
...@@ -1192,6 +1194,15 @@ RelationNameGetRelation(char *relationName) ...@@ -1192,6 +1194,15 @@ RelationNameGetRelation(char *relationName)
IncrHeapAccessStat(local_RelationNameGetRelation); IncrHeapAccessStat(local_RelationNameGetRelation);
IncrHeapAccessStat(global_RelationNameGetRelation); IncrHeapAccessStat(global_RelationNameGetRelation);
/* ----------------
* if caller is looking for a temp relation, substitute its real name;
* we only index temp rels by their real names.
* ----------------
*/
temprelname = get_temp_rel_by_name(relationName);
if (temprelname)
relationName = temprelname;
/* ---------------- /* ----------------
* first try and get a reldesc from the cache * first try and get a reldesc from the cache
* ---------------- * ----------------
...@@ -1212,26 +1223,6 @@ RelationNameGetRelation(char *relationName) ...@@ -1212,26 +1223,6 @@ RelationNameGetRelation(char *relationName)
return rd; return rd;
} }
/* ----------------
* old "getreldesc" interface.
* ----------------
*/
#ifdef NOT_USED
Relation
getreldesc(char *relationName)
{
/* ----------------
* increment access statistics
* ----------------
*/
IncrHeapAccessStat(local_getreldesc);
IncrHeapAccessStat(global_getreldesc);
return RelationNameGetRelation(relationName);
}
#endif
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* cache invalidation support routines * cache invalidation support routines
* ---------------------------------------------------------------- * ----------------------------------------------------------------
......
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