TEMP tables applied

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: hackers(at)postgreSQL(dot)org (PostgreSQL-development)
Subject: TEMP tables applied
Date: 1999-02-02 03:57:04
Message-ID: 199902020357.WAA11757@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have applied TEMP tables to the tree, with documenation changes and a
regression test.

I am sure there are going to be some features that break with temp
tables.

First, there is no pg_type tuple to match the temp table name. There is
one to match the system-generated temp table name, pg_temp.pid##.seq##.
Temp table do not show up in \d, but you can see them in \dS as
pg_temp*.

Not sure if sequences/SERIAL/PRIMARY will work with temp tables. We
either need them to work, or prevent them from being created. Testing
will be necessary.

One item I was not 100% happy with. In backend/catalog/heap.c and
index.c, there is code that say:

---------------------------------------------------------------------------

/* invalidate cache so non-temp table is masked by temp */
if (istemp)
{
Oid relid = RelnameFindRelid(relname);

if (relid != InvalidOid)
{
/*
* This is heavy-handed, but appears necessary bjm 1999/02/01
* SystemCacheRelationFlushed(relid) is not enough either.
*/
RelationForgetRelation(relid);
ResetSystemCache();
}
}

---------------------------------------------------------------------------

I found that in my regression test where I create a table, and index,
then a temp table and index, when I go to delete the temp index and
table, the non-temps are deleted unless I use ResetSystemCache().

If I SystemCacheRelationFlushed(relid), the non-temp table is never
deleted from the cache. It only seems to be a problem with indexes.

Does anyone know why? Currently, it works, but I am not happy with it.
Does anyone understand why the cache would not flush? Can someone debug
a call to SystemCacheRelationFlushed(relid) and see why the invalidation
is not happening on the non-temp relid.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Browse pgsql-hackers by date

  From Date Subject
Next Message Erich Stamberger 1999-02-02 05:05:40 trouble with rules
Previous Message Bruce Momjian 1999-02-02 03:38:32 Re: [HACKERS] Re: [GENERAL] big bad join problems