mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Do not use default scalars in MutationsInterpreter::prepareInterpreterSelectQuery
This commit is contained in:
parent
039af96b61
commit
cfb98d381c
@ -785,10 +785,12 @@ ASTPtr MutationsInterpreter::prepareInterpreterSelectQuery(std::vector<Stage> &
|
|||||||
for (const String & column : stage.output_columns)
|
for (const String & column : stage.output_columns)
|
||||||
all_asts->children.push_back(std::make_shared<ASTIdentifier>(column));
|
all_asts->children.push_back(std::make_shared<ASTIdentifier>(column));
|
||||||
|
|
||||||
bool execute_scalar_subqueries = !dynamic_cast<StorageMergeTree *>(storage.get()) || !dry_run;
|
/// Executing scalar subquery on that stage can lead to deadlock
|
||||||
|
/// e.g. ALTER referencing the same table in scalar subquery
|
||||||
|
bool execute_scalar_subqueries = !dry_run;
|
||||||
auto syntax_result = TreeRewriter(context).analyze(
|
auto syntax_result = TreeRewriter(context).analyze(
|
||||||
all_asts, all_columns, storage, metadata_snapshot, false, true, execute_scalar_subqueries);
|
all_asts, all_columns, storage, metadata_snapshot, false, true, execute_scalar_subqueries);
|
||||||
if (context->hasQueryContext())
|
if (execute_scalar_subqueries && context->hasQueryContext())
|
||||||
for (const auto & it : syntax_result->getScalars())
|
for (const auto & it : syntax_result->getScalars())
|
||||||
context->getQueryContext()->addScalar(it.first, it.second);
|
context->getQueryContext()->addScalar(it.first, it.second);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user