fix possibly dangling reference when inserting into mv

This commit is contained in:
Alexander Tokmakov 2020-10-14 22:25:31 +03:00
parent cb15e72229
commit de06a79738

View File

@ -414,6 +414,11 @@ BlockIO InterpreterInsertQuery::execute()
res.out = std::move(out_streams.at(0));
res.pipeline.addStorageHolder(table);
if (const auto * mv = dynamic_cast<const StorageMaterializedView *>(table.get()))
{
if (auto inner_table = mv->tryGetTargetTable())
res.pipeline.addStorageHolder(inner_table);
}
return res;
}