diff --git a/e2e_test/ddl/drop/drop_creating_mv.slt b/e2e_test/ddl/drop/drop_creating_mv.slt index 1eaeacf7f918..4d4b5fbef5dc 100644 --- a/e2e_test/ddl/drop/drop_creating_mv.slt +++ b/e2e_test/ddl/drop/drop_creating_mv.slt @@ -29,6 +29,7 @@ statement ok drop materialized view m1; ############## Test drop background mv BEFORE recovery + statement ok set background_ddl=true; diff --git a/src/frontend/src/catalog/schema_catalog.rs b/src/frontend/src/catalog/schema_catalog.rs index 0394da2a70f8..2a14799ce9ab 100644 --- a/src/frontend/src/catalog/schema_catalog.rs +++ b/src/frontend/src/catalog/schema_catalog.rs @@ -557,6 +557,14 @@ impl SchemaCatalog { } /// Iterate all materialized views, excluding the indices. + pub fn iter_all_mvs(&self) -> impl Iterator> { + self.table_by_name + .iter() + .filter(|(_, v)| v.is_mview() && valid_table_name(&v.name)) + .map(|(_, v)| v) + } + + /// Iterate created materialized views, excluding the indices. pub fn iter_created_mvs(&self) -> impl Iterator> { self.table_by_name .iter() diff --git a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_materialized_views.rs b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_materialized_views.rs index d45da04d1261..a0e8d98b24b6 100644 --- a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_materialized_views.rs +++ b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_materialized_views.rs @@ -47,7 +47,7 @@ fn read_rw_materialized_views(reader: &SysCatalogReaderImpl) -> Result