*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.93 1999/07/17 20:16:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.94 1999/09/04 22:00:29 momjian Exp $
*
*
* INTERFACE ROUTINES
if (istemp)
{
/* replace relname of caller */
- snprintf(relname, NAMEDATALEN, "pg_temp.%d.%u",
- MyProcPid, uniqueId++);
+ snprintf(relname, NAMEDATALEN, "pg_temp.%d.%u", MyProcPid, uniqueId++);
}
/* ----------------
(istemp && get_temp_rel_by_name(relname) != NULL))
elog(ERROR, "Relation '%s' already exists", relname);
- /* invalidate cache so non-temp table is masked by temp */
- if (istemp)
- {
- Oid relid = RelnameFindRelid(relname);
-
- if (relid != InvalidOid)
- RelationForgetRelation(relid);
- }
-
/* save user relation name because heap_create changes it */
if (istemp)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.87 1999/07/20 17:14:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.88 1999/09/04 22:00:29 momjian Exp $
*
*
* INTERFACE ROUTINES
numatts,
attNums);
- /* invalidate cache so possible non-temp index is masked by temp */
- if (istemp)
- {
- Oid relid = RelnameFindRelid(indexRelationName);
-
- if (relid != InvalidOid)
- RelationForgetRelation(relid);
- }
-
/* save user relation name because heap_create changes it */
if (istemp)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.43 1999/09/04 19:55:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.44 1999/09/04 22:00:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "catalog/pg_index.h"
#include "miscadmin.h"
#include "utils/syscache.h"
-#include "utils/temprel.h"
/*
* Names of indices on the following system catalogs:
Relation idesc;
ScanKeyData skey[1];
HeapTuple tuple;
- char *hold_rel;
- /*
- * we have to do this before looking in system tables because temp
- * table namespace takes precedence
- */
- if ((hold_rel = get_temp_rel_by_name(relName)) != NULL)
- relName = hold_rel;
-
ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0,
(AttrNumber) 1,
*
*
* 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
#include "catalog/pg_shadow.h"
#include "catalog/pg_type.h"
#include "utils/catcache.h"
+#include "utils/temprel.h"
extern bool AMI_OVERRIDE; /* XXX style */
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))
{
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
MemoryContext oldcxt;
List *l,
*prev;
+
+elog(NOTICE,"oid = %d", relid);
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
{
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);
TempTable *temp_rel = lfirst(l);
if (strcmp(temp_rel->user_relname, user_relname) == 0)
+ {
+ elog(NOTICE,"found");
return temp_rel->relname;
+ }
}
return NULL;
}