This commit is contained in:
alesapin 2020-02-19 18:07:02 +03:00
parent 7a9b96a8f9
commit 60118b65d5
2 changed files with 5 additions and 4 deletions

View File

@ -765,8 +765,7 @@ void AlterCommands::validateDefaultExpressionForColumn(
auto default_with_cast = makeASTFunction("CAST", copy_expression, std::make_shared<ASTLiteral>(column_type->getName()));
auto query_with_alias = setAlias(default_with_cast, tmp_column_name);
auto syntax_result = SyntaxAnalyzer(context).analyze(query_with_alias, all_columns.getAll());
const auto actions = ExpressionAnalyzer(query_with_alias, syntax_result, context).getActions(true);
auto sample_block = actions->getSampleBlock();
ExpressionAnalyzer(query_with_alias, syntax_result, context).getActions(true);
}
catch (Exception & ex)
{

View File

@ -131,6 +131,8 @@ private:
bool prepared = false;
private:
/// Validate that default expression and type are compatible, i.e. default
/// expression result can be casted to column_type
void validateDefaultExpressionForColumn(
const ASTPtr default_expression,
const String & column_name,
@ -145,8 +147,8 @@ public:
/// More accurate check have to be performed with storage->checkAlterIsPossible.
void validate(const StorageInMemoryMetadata & metadata, const Context & context) const;
/// Prepare alter commands. Set ignore flag to some of them
/// and additional commands for dependent columns.
/// Prepare alter commands. Set ignore flag to some of them and set some
/// parts to commands from storage's metadata (for example, absent default)
void prepare(const StorageInMemoryMetadata & metadata, const Context & context);
/// Apply all alter command in sequential order to storage metadata.