do not ignore silent failures from view creation

We have an issue at the moment that when a materialized view fails
to be created, we just swallow the error and leave the database in
a funny state.

We have can_create_view() to detect those issues early, but not all
errors can be detected that early.
This commit is contained in:
Glauber Costa
2025-08-21 11:21:29 -05:00
committed by Pekka Enberg
parent 1a4a53e6ea
commit 911b4c38a6

View File

@@ -217,14 +217,13 @@ pub fn parse_schema_rows(
if should_create_new {
// Create a new IncrementalView
if let Ok(incremental_view) =
IncrementalView::from_sql(sql, schema)
{
let referenced_tables =
incremental_view.get_referenced_table_names();
schema.add_materialized_view(incremental_view);
views_to_process.push((view_name, referenced_tables));
}
// If this fails, we should propagate the error so the transaction rolls back
let incremental_view =
IncrementalView::from_sql(sql, schema)?;
let referenced_tables =
incremental_view.get_referenced_table_names();
schema.add_materialized_view(incremental_view);
views_to_process.push((view_name, referenced_tables));
}
}
Stmt::CreateView {