Fix potential seg fault with nullptr storage

This commit is contained in:
divanik 2024-09-13 12:23:19 +00:00
parent 6b4e5c75d2
commit 0c3679c76e
2 changed files with 5 additions and 7 deletions

View File

@ -409,12 +409,6 @@ InterpreterSelectQuery::InterpreterSelectQuery(
{
checkStackSize();
if (storage->hasExternalDynamicMetadata())
{
storage->updateExternalDynamicMetadata(context);
metadata_snapshot = storage->getInMemoryMetadataPtr();
}
if (!prepared_sets)
prepared_sets = std::make_shared<PreparedSets>();
@ -469,6 +463,11 @@ InterpreterSelectQuery::InterpreterSelectQuery(
if (storage)
{
if (storage->hasExternalDynamicMetadata())
{
storage->updateExternalDynamicMetadata(context);
metadata_snapshot = storage->getInMemoryMetadataPtr();
}
table_lock = storage->lockForShare(context->getInitialQueryId(), context->getSettingsRef().lock_acquire_timeout);
table_id = storage->getStorageID();

View File

@ -1783,7 +1783,6 @@ JoinTreeQueryPlan buildJoinTreeQueryPlan(const QueryTreeNodePtr & query_node,
* then left most table expression is responsible for providing valid JOIN TREE part of final query plan.
*
* Examples: Distributed, LiveView, Merge storages.
* Examples: Distributed, LiveView, Merge storages.
*/
auto left_table_expression = table_expressions_stack.front();
auto left_table_expression_query_plan = buildQueryPlanForTableExpression(left_table_expression,