Merge pull request #3337 from VadimPE/CLICKHOUSE-3021

[CLICKHOUSE-3021] fix bug with unsupported value in CREATE TABLE
This commit is contained in:
alexey-milovidov 2018-10-10 16:23:17 +03:00 committed by GitHub
commit 4e6fd3e3fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,7 @@ namespace ErrorCodes
extern const int ILLEGAL_COLUMN;
extern const int DATABASE_ALREADY_EXISTS;
extern const int QUERY_IS_PROHIBITED;
extern const int THERE_IS_NO_DEFAULT_VALUE;
}
@ -224,6 +225,10 @@ static ColumnsAndDefaults parseColumns(const ASTExpressionList & column_list_ast
const auto actions = ExpressionAnalyzer{default_expr_list, context, {}, columns}.getActions(true);
const auto block = actions->getSampleBlock();
for (auto action : actions->getActions())
if (action.type == ExpressionAction::Type::JOIN || action.type == ExpressionAction::Type::ARRAY_JOIN)
throw Exception("Cannot CREATE table. Unsupported default value that requires ARRAY JOIN or JOIN action", ErrorCodes::THERE_IS_NO_DEFAULT_VALUE);
for (auto & column : defaulted_columns)
{
const auto name_and_type_ptr = column.first;