diff --git a/e2e_test/ddl/drop/drop_creating_mv.slt b/e2e_test/ddl/drop/drop_creating_mv.slt index e9d8423f3cdec..69febfd2936bc 100644 --- a/e2e_test/ddl/drop/drop_creating_mv.slt +++ b/e2e_test/ddl/drop/drop_creating_mv.slt @@ -18,6 +18,11 @@ risedev psql -c 'create materialized view m1 as select * from t;' & onlyif can-use-recover sleep 5s +query I +select background_ddl from rw_catalog.rw_materialized_views where name='m1'; +---- +f + onlyif can-use-recover statement ok drop materialized view m1; @@ -33,6 +38,11 @@ create materialized view m1 as select * from t; onlyif can-use-recover sleep 5s +query I +select background_ddl from rw_catalog.rw_materialized_views where name='m1'; +---- +t + onlyif can-use-recover statement ok drop materialized view m1; @@ -48,6 +58,11 @@ create materialized view m1 as select * from t; onlyif can-use-recover sleep 5s +query I +select background_ddl from rw_catalog.rw_materialized_views where name='m1'; +---- +t + onlyif can-use-recover statement ok recover; @@ -55,6 +70,11 @@ recover; onlyif can-use-recover sleep 10s +query I +select background_ddl from rw_catalog.rw_materialized_views where name='m1'; +---- +t + onlyif can-use-recover statement ok drop materialized view m1; @@ -69,6 +89,11 @@ set background_ddl=false; statement ok create materialized view m1 as select * from t; +query I +select background_ddl from rw_catalog.rw_materialized_views where name='m1'; +---- +f + statement ok drop materialized view m1; 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 c593b35b18f87..d45da04d12612 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 @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use risingwave_common::catalog::CreateType; use risingwave_common::types::{Fields, Timestamptz}; use risingwave_frontend_macro::system_catalog; use risingwave_pb::user::grant_privilege::Object; @@ -33,6 +34,7 @@ struct RwMaterializedView { created_at: Option, initialized_at_cluster_version: Option, created_at_cluster_version: Option, + background_ddl: bool, } #[system_catalog(table, "rw_catalog.rw_materialized_views")] @@ -62,6 +64,7 @@ fn read_rw_materialized_views(reader: &SysCatalogReaderImpl) -> Result