summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/cluster.c13
-rw-r--r--src/backend/commands/createas.c2
-rw-r--r--src/backend/commands/matview.c15
3 files changed, 15 insertions, 15 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index ef9c5f1adc7..ed62246cc52 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -381,13 +381,14 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose,
check_index_is_clusterable(OldHeap, indexOid, recheck, AccessExclusiveLock);
/*
- * Quietly ignore the request if the a materialized view is not scannable.
- * No harm is done because there is nothing no data to deal with, and we
- * don't want to throw an error if this is part of a multi-relation
- * request -- for example, CLUSTER was run on the entire database.
+ * Quietly ignore the request if this is a materialized view which has not
+ * been populated from its query. No harm is done because there is no data
+ * to deal with, and we don't want to throw an error if this is part of a
+ * multi-relation request -- for example, CLUSTER was run on the entire
+ * database.
*/
if (OldHeap->rd_rel->relkind == RELKIND_MATVIEW &&
- !OldHeap->rd_isscannable)
+ !OldHeap->rd_ispopulated)
{
relation_close(OldHeap, AccessExclusiveLock);
return;
@@ -923,7 +924,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
if (OldHeap->rd_rel->relkind == RELKIND_MATVIEW)
/* Make sure the heap looks good even if no rows are written. */
- SetRelationIsScannable(NewHeap);
+ SetMatViewToPopulated(NewHeap);
/*
* Scan through the OldHeap, either in OldIndex order or sequentially;
diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c
index 06bbae5cc59..079fafa06fb 100644
--- a/src/backend/commands/createas.c
+++ b/src/backend/commands/createas.c
@@ -417,7 +417,7 @@ intorel_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
if (into->relkind == RELKIND_MATVIEW && !into->skipData)
/* Make sure the heap looks good even if no rows are written. */
- SetRelationIsScannable(intoRelationDesc);
+ SetMatViewToPopulated(intoRelationDesc);
/*
* Check INSERT permission on the constructed table.
diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c
index 1d2b3478289..ac7719e40da 100644
--- a/src/backend/commands/matview.c
+++ b/src/backend/commands/matview.c
@@ -52,22 +52,21 @@ static void refresh_matview_datafill(DestReceiver *dest, Query *query,
const char *queryString);
/*
- * SetRelationIsScannable
- * Make the relation appear scannable.
+ * SetMatViewToPopulated
+ * Indicate that the materialized view has been populated by its query.
*
- * NOTE: This is only implemented for materialized views. The heap starts out
- * in a state that doesn't look scannable, and can only transition from there
- * to scannable, unless a new heap is created.
+ * NOTE: The heap starts out in a state that doesn't look scannable, and can
+ * only transition from there to scannable at the time a new heap is created.
*
* NOTE: caller must be holding an appropriate lock on the relation.
*/
void
-SetRelationIsScannable(Relation relation)
+SetMatViewToPopulated(Relation relation)
{
Page page;
Assert(relation->rd_rel->relkind == RELKIND_MATVIEW);
- Assert(relation->rd_isscannable == false);
+ Assert(relation->rd_ispopulated == false);
page = (Page) palloc(BLCKSZ);
PageInit(page, BLCKSZ, 0);
@@ -323,7 +322,7 @@ transientrel_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
myState->hi_options |= HEAP_INSERT_SKIP_WAL;
myState->bistate = GetBulkInsertState();
- SetRelationIsScannable(transientrel);
+ SetMatViewToPopulated(transientrel);
/* Not using WAL requires smgr_targblock be initially invalid */
Assert(RelationGetTargetBlock(transientrel) == InvalidBlockNumber);