1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Add a "relistemp" boolean column to pg_class, which is true for temporary

relations (including a temp table's indexes and toast table/index), and
false for normal relations.  For ease of checking, this commit just adds
the column and fills it correctly --- revising the relation access machinery
to use it will come separately.
This commit is contained in:
Tom Lane
2009-03-31 17:59:56 +00:00
parent eeeb782e60
commit df13324f08
6 changed files with 69 additions and 45 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.284 2009/01/27 12:40:15 petere Exp $
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.285 2009/03/31 17:59:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1396,6 +1396,12 @@ formrdesc(const char *relationName, Oid relationReltype,
*/
relation->rd_rel->relisshared = false;
/*
* Likewise, we must know if a relation is temp ... but formrdesc is
* not used for any temp relations.
*/
relation->rd_rel->relistemp = false;
relation->rd_rel->relpages = 1;
relation->rd_rel->reltuples = 1;
relation->rd_rel->relkind = RELKIND_RELATION;
@ -2398,6 +2404,9 @@ RelationBuildLocalRelation(const char *relname,
*/
rel->rd_rel->relisshared = shared_relation;
/* it is temporary if and only if it is in my temp-table namespace */
rel->rd_rel->relistemp = isTempOrToastNamespace(relnamespace);
RelationGetRelid(rel) = relid;
for (i = 0; i < natts; i++)