mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Backport #70144 to 24.9: Fix possible hung in ALTER COLUMN with Dynamic type
This commit is contained in:
parent
97d03dadc7
commit
659e1ac40f
@ -513,12 +513,6 @@ static void validateUpdateColumns(
|
||||
throw Exception(ErrorCodes::NO_SUCH_COLUMN_IN_TABLE, "There is no column {} in table", backQuote(column_name));
|
||||
}
|
||||
}
|
||||
else if (storage_columns.getColumn(GetColumnsOptions::Ordinary, column_name).type->hasDynamicSubcolumns())
|
||||
{
|
||||
throw Exception(ErrorCodes::CANNOT_UPDATE_COLUMN,
|
||||
"Cannot update column {} with type {}: updates of columns with dynamic subcolumns are not supported",
|
||||
backQuote(column_name), storage_columns.getColumn(GetColumnsOptions::Ordinary, column_name).type->getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1362,6 +1356,21 @@ void MutationsInterpreter::validate()
|
||||
}
|
||||
}
|
||||
|
||||
const auto & storage_columns = source.getStorageSnapshot(metadata_snapshot, context)->metadata->getColumns();
|
||||
for (const auto & command : commands)
|
||||
{
|
||||
for (const auto & [column_name, _] : command.column_to_update_expression)
|
||||
{
|
||||
auto column = storage_columns.tryGetColumn(GetColumnsOptions::Ordinary, column_name);
|
||||
if (column && column->type->hasDynamicSubcolumns())
|
||||
{
|
||||
throw Exception(ErrorCodes::CANNOT_UPDATE_COLUMN,
|
||||
"Cannot update column {} with type {}: updates of columns with dynamic subcolumns are not supported",
|
||||
backQuote(column_name), storage_columns.getColumn(GetColumnsOptions::Ordinary, column_name).type->getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QueryPlan plan;
|
||||
|
||||
initQueryPlan(stages.front(), plan);
|
||||
|
@ -0,0 +1,7 @@
|
||||
SET allow_experimental_dynamic_type = 1;
|
||||
DROP TABLE IF EXISTS t0;
|
||||
CREATE TABLE t0 (c0 Int) ENGINE = MergeTree() ORDER BY tuple();
|
||||
INSERT INTO t0 (c0) VALUES (1);
|
||||
ALTER TABLE t0 UPDATE c0 = EXISTS (SELECT 1 FROM t1 CROSS JOIN t0) WHERE 1;
|
||||
ALTER TABLE t0 MODIFY COLUMN c0 Dynamic; --{serverError UNFINISHED}
|
||||
DROP TABLE t0;
|
Loading…
Reference in New Issue
Block a user