@@ -816,27 +816,33 @@ refresh_by_heap_swap(Oid matviewOid, Oid OIDNewHeap)
816816RelationCacheInvalidateEntry (matviewOid );
817817}
818818
819- static void
820- OpenMatViewIncrementalMaintenance (void )
821- {
822- matview_maintenance_depth ++ ;
823- }
824-
825- static void
826- CloseMatViewIncrementalMaintenance (void )
827- {
828- matview_maintenance_depth -- ;
829- Assert (matview_maintenance_depth >=0 );
830- }
831819
832820/*
833821 * This should be used to test whether the backend is in a context where it is
834822 * OK to allow DML statements to modify materialized views. We only want to
835823 * allow that for internal code driven by the materialized view definition,
836824 * not for arbitrary user-supplied code.
825+ *
826+ * While the function names reflect the fact that their main intended use is
827+ * incremental maintenance of materialized views (in response to changes to
828+ * the data in referenced relations), they are initially used to allow REFRESH
829+ * without blocking concurrent reads.
837830 */
838831bool
839832MatViewIncrementalMaintenanceIsEnabled (void )
840833{
841834return matview_maintenance_depth > 0 ;
842835}
836+
837+ static void
838+ OpenMatViewIncrementalMaintenance (void )
839+ {
840+ matview_maintenance_depth ++ ;
841+ }
842+
843+ static void
844+ CloseMatViewIncrementalMaintenance (void )
845+ {
846+ matview_maintenance_depth -- ;
847+ Assert (matview_maintenance_depth >=0 );
848+ }