77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.69 1999/09/0418:42:13 tgl Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.70 1999/09/0421:47:23 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
5656#include "utils/builtins.h"
5757#include "utils/catcache.h"
5858#include "utils/relcache.h"
59+ #include "utils/temprel.h"
5960
6061
6162static void RelationFlushRelation (Relation * relationPtr ,
@@ -1182,6 +1183,7 @@ RelationIdGetRelation(Oid relationId)
11821183Relation
11831184RelationNameGetRelation (char * relationName )
11841185{
1186+ char * temprelname ;
11851187Relation rd ;
11861188RelationBuildDescInfo buildinfo ;
11871189
@@ -1192,6 +1194,15 @@ RelationNameGetRelation(char *relationName)
11921194IncrHeapAccessStat (local_RelationNameGetRelation );
11931195IncrHeapAccessStat (global_RelationNameGetRelation );
11941196
1197+ /* ----------------
1198+ *if caller is looking for a temp relation, substitute its real name;
1199+ *we only index temp rels by their real names.
1200+ * ----------------
1201+ */
1202+ temprelname = get_temp_rel_by_name (relationName );
1203+ if (temprelname )
1204+ relationName = temprelname ;
1205+
11951206/* ----------------
11961207 *first try and get a reldesc from the cache
11971208 * ----------------
@@ -1212,26 +1223,6 @@ RelationNameGetRelation(char *relationName)
12121223return rd ;
12131224}
12141225
1215- /* ----------------
1216- *old "getreldesc" interface.
1217- * ----------------
1218- */
1219- #ifdef NOT_USED
1220- Relation
1221- getreldesc (char * relationName )
1222- {
1223- /* ----------------
1224- *increment access statistics
1225- * ----------------
1226- */
1227- IncrHeapAccessStat (local_getreldesc );
1228- IncrHeapAccessStat (global_getreldesc );
1229-
1230- return RelationNameGetRelation (relationName );
1231- }
1232-
1233- #endif
1234-
12351226/* ----------------------------------------------------------------
12361227 *cache invalidation support routines
12371228 * ----------------------------------------------------------------