Prevent dropping nested column if it can create empty part

This commit is contained in:
Antonio Andelic 2022-12-12 11:55:33 +00:00
parent bca18298a1
commit e18ac19ab3

View File

@ -2600,7 +2600,18 @@ void MergeTreeData::checkAlterIsPossible(const AlterCommands & commands, Context
}
}
dropped_columns.emplace(command.column_name);
if (old_metadata.columns.has(command.column_name))
{
dropped_columns.emplace(command.column_name);
}
else
{
const auto & nested = old_metadata.columns.getNested(command.column_name);
assert(!nested.empty());
for (const auto & nested_column : nested)
dropped_columns.emplace(nested_column.name);
}
}
else if (command.type == AlterCommand::RESET_SETTING)
{