From 1d6c72a55b23554cfb946527dc77f9d80044ae2c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 6 May 2013 13:26:51 -0400 Subject: Move materialized views' is-populated status into their pg_class entries. Previously this state was represented by whether the view's disk file had zero or nonzero size, which is problematic for numerous reasons, since it's breaking a fundamental assumption about heap storage. This was done to allow unlogged matviews to revert to unpopulated status after a crash despite our lack of any ability to update catalog entries post-crash. However, this poses enough risk of future problems that it seems better to not support unlogged matviews until we can find another way. Accordingly, revert that choice as well as a number of existing kluges forced by it in favor of creating a pg_class.relispopulated flag column. --- src/backend/commands/cluster.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/backend/commands/cluster.c') diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index ed62246cc52..878b6254f54 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -30,7 +30,6 @@ #include "catalog/objectaccess.h" #include "catalog/toasting.h" #include "commands/cluster.h" -#include "commands/matview.h" #include "commands/tablecmds.h" #include "commands/vacuum.h" #include "miscadmin.h" @@ -388,7 +387,7 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose, * database. */ if (OldHeap->rd_rel->relkind == RELKIND_MATVIEW && - !OldHeap->rd_ispopulated) + !RelationIsPopulated(OldHeap)) { relation_close(OldHeap, AccessExclusiveLock); return; @@ -922,10 +921,6 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, get_namespace_name(RelationGetNamespace(OldHeap)), RelationGetRelationName(OldHeap)))); - if (OldHeap->rd_rel->relkind == RELKIND_MATVIEW) - /* Make sure the heap looks good even if no rows are written. */ - SetMatViewToPopulated(NewHeap); - /* * Scan through the OldHeap, either in OldIndex order or sequentially; * copy each tuple into the NewHeap, or transiently to the tuplesort -- cgit v1.2.3