mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
StorageMaterializedView: update dependencies on DETACH TABLE
Previously the dependencies were updated only on DROP TABLE, so detaching a materialized view and inserting to source table thrown an exception.
This commit is contained in:
parent
fb1aa84973
commit
6d4f106f11
@ -175,6 +175,14 @@ bool StorageMaterializedView::optimize(const ASTPtr & query, const ASTPtr & part
|
||||
return getTargetTable()->optimize(query, partition, final, deduplicate, context);
|
||||
}
|
||||
|
||||
void StorageMaterializedView::shutdown()
|
||||
{
|
||||
/// Make sure the dependency is removed after DETACH TABLE
|
||||
global_context.removeDependency(
|
||||
DatabaseAndTableName(select_database_name, select_table_name),
|
||||
DatabaseAndTableName(database_name, table_name));
|
||||
}
|
||||
|
||||
StoragePtr StorageMaterializedView::getTargetTable() const
|
||||
{
|
||||
return global_context.getTable(target_database_name, target_table_name);
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
BlockOutputStreamPtr write(const ASTPtr & query, const Settings & settings) override;
|
||||
void drop() override;
|
||||
bool optimize(const ASTPtr & query, const ASTPtr & partition, bool final, bool deduplicate, const Context & context) override;
|
||||
void shutdown() override;
|
||||
|
||||
BlockInputStreams read(
|
||||
const Names & column_names,
|
||||
|
Loading…
Reference in New Issue
Block a user