aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-09-04 21:47:23 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-09-04 21:47:23 +0000
commitcb36c0f6821d52c30e99192bfe31d8becb9931ff (patch)
treea86c1e17261ff8bf7483f95e174a51476b485d5f
parent15dd16785418161def589bbe8e5dd86460214ba4 (diff)
downloadpostgresql-cb36c0f6821d52c30e99192bfe31d8becb9931ff.tar.gz
postgresql-cb36c0f6821d52c30e99192bfe31d8becb9931ff.zip
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.
-rw-r--r--src/backend/utils/cache/relcache.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 351ae7c6bc8..c534db71a43 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -7,7 +7,7 @@
*
*
* 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 @@
#include "utils/builtins.h"
#include "utils/catcache.h"
#include "utils/relcache.h"
+#include "utils/temprel.h"
static void RelationFlushRelation(Relation *relationPtr,
@@ -1182,6 +1183,7 @@ RelationIdGetRelation(Oid relationId)
Relation
RelationNameGetRelation(char *relationName)
{
+ char *temprelname;
Relation rd;
RelationBuildDescInfo buildinfo;
@@ -1193,6 +1195,15 @@ RelationNameGetRelation(char *relationName)
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
* ----------------
*/
@@ -1212,26 +1223,6 @@ RelationNameGetRelation(char *relationName)
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
* ----------------------------------------------------------------