aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-03-31 17:59:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-03-31 17:59:56 +0000
commitdf13324f0881be67ed53c6108ebdff6ed238bda6 (patch)
tree7a548bad32a9ccaf90f30061cdab9061f2aece98 /src/backend/utils/cache/relcache.c
parenteeeb782e60082327963d2f1742240d4a893eb9db (diff)
downloadpostgresql-df13324f0881be67ed53c6108ebdff6ed238bda6.tar.gz
postgresql-df13324f0881be67ed53c6108ebdff6ed238bda6.zip
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.
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 196ca0155f0..c39759ee1c9 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -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++)