1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Intercept temp table lookups further up to map temp names.

This commit is contained in:
Bruce Momjian
1999-09-04 22:00:30 +00:00
parent cb36c0f682
commit 0e14dfe0fb
5 changed files with 25 additions and 34 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.34 1999/08/09 03:13:30 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.35 1999/09/04 22:00:30 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@ -35,6 +35,7 @@
#include "catalog/pg_shadow.h"
#include "catalog/pg_type.h"
#include "utils/catcache.h"
#include "utils/temprel.h"
extern bool AMI_OVERRIDE; /* XXX style */
@ -487,6 +488,16 @@ SearchSysCacheTuple(int cacheId,/* cache selection code */
cacheId);
}
/* temp table name remapping */
if (cacheId == RELNAME)
{
char *nontemp_relname;
if ((nontemp_relname =
get_temp_rel_by_name(DatumGetPointer(key1))) != NULL)
key1 = PointerGetDatum(nontemp_relname);
}
tp = SearchSysCache(SysCache[cacheId], key1, key2, key3, key4);
if (!HeapTupleIsValid(tp))
{

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.12 1999/09/04 21:45:48 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.13 1999/09/04 22:00:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -117,6 +117,8 @@ remove_temp_relation(Oid relid)
MemoryContext oldcxt;
List *l,
*prev;
elog(NOTICE,"oid = %d", relid);
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
@ -126,8 +128,11 @@ remove_temp_relation(Oid relid)
{
TempTable *temp_rel = lfirst(l);
elog(NOTICE,"check oid = %d", temp_rel->relid);
if (temp_rel->relid == relid)
{
elog(NOTICE,"removed");
pfree(temp_rel->user_relname);
pfree(temp_rel->relname);
pfree(temp_rel);
@ -212,7 +217,10 @@ get_temp_rel_by_name(char *user_relname)
TempTable *temp_rel = lfirst(l);
if (strcmp(temp_rel->user_relname, user_relname) == 0)
{
elog(NOTICE,"found");
return temp_rel->relname;
}
}
return NULL;
}