aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
authorKevin Grittner <kgrittn@postgresql.org>2013-04-09 13:02:49 -0500
committerKevin Grittner <kgrittn@postgresql.org>2013-04-09 13:02:49 -0500
commit52e6e33ab495cb2b0e694ee480ba7c6394315053 (patch)
treecf957e2ae91863e97b46f4692f09a339b5cf696f /src/backend/utils/cache/relcache.c
parent0bf42a5f3b62cde41cb366d3442585429c6d9c50 (diff)
downloadpostgresql-52e6e33ab495cb2b0e694ee480ba7c6394315053.tar.gz
postgresql-52e6e33ab495cb2b0e694ee480ba7c6394315053.zip
Create a distinction between a populated matview and a scannable one.
The intent was that being populated would, long term, be just one of the conditions which could affect whether a matview was scannable; being populated should be necessary but not always sufficient to scan the relation. Since only CREATE and REFRESH currently determine the scannability, names and comments accidentally conflated these concepts, leading to confusion. Also add missing locking for the SQL function which allows a test for scannability, and fix a modularity violatiion. Per complaints from Tom Lane, although its not clear that these will satisfy his concerns. Hopefully this will at least better frame the discussion.
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 5b1d1e5b10a..670fa8c1667 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -958,9 +958,9 @@ RelationBuildDesc(Oid targetRelId, bool insertIt)
if (relation->rd_rel->relkind == RELKIND_MATVIEW &&
heap_is_matview_init_state(relation))
- relation->rd_isscannable = false;
+ relation->rd_ispopulated = false;
else
- relation->rd_isscannable = true;
+ relation->rd_ispopulated = true;
/*
* now we can free the memory allocated for pg_class_tuple
@@ -1531,7 +1531,7 @@ formrdesc(const char *relationName, Oid relationReltype,
* initialize physical addressing information for the relation
*/
RelationInitPhysicalAddr(relation);
- relation->rd_isscannable = true;
+ relation->rd_ispopulated = true;
/*
* initialize the rel-has-index flag, using hardwired knowledge
@@ -1756,7 +1756,7 @@ RelationReloadIndexInfo(Relation relation)
heap_freetuple(pg_class_tuple);
/* We must recalculate physical address in case it changed */
RelationInitPhysicalAddr(relation);
- relation->rd_isscannable = true;
+ relation->rd_ispopulated = true;
/*
* For a non-system index, there are fields of the pg_index row that are
@@ -1907,9 +1907,9 @@ RelationClearRelation(Relation relation, bool rebuild)
RelationInitPhysicalAddr(relation);
if (relation->rd_rel->relkind == RELKIND_MATVIEW &&
heap_is_matview_init_state(relation))
- relation->rd_isscannable = false;
+ relation->rd_ispopulated = false;
else
- relation->rd_isscannable = true;
+ relation->rd_ispopulated = true;
if (relation->rd_rel->relkind == RELKIND_INDEX)
{
@@ -2700,9 +2700,9 @@ RelationBuildLocalRelation(const char *relname,
/* materialized view not initially scannable */
if (relkind == RELKIND_MATVIEW)
- rel->rd_isscannable = false;
+ rel->rd_ispopulated = false;
else
- rel->rd_isscannable = true;
+ rel->rd_ispopulated = true;
/*
* Okay to insert into the relcache hash tables.
@@ -4450,9 +4450,9 @@ load_relcache_init_file(bool shared)
RelationInitPhysicalAddr(rel);
if (rel->rd_rel->relkind == RELKIND_MATVIEW &&
heap_is_matview_init_state(rel))
- rel->rd_isscannable = false;
+ rel->rd_ispopulated = false;
else
- rel->rd_isscannable = true;
+ rel->rd_ispopulated = true;
}
/*