diff --git a/src/DataTypes/DataTypesNumber.cpp b/src/DataTypes/DataTypesNumber.cpp index 82a1f35c297..4da767ae359 100644 --- a/src/DataTypes/DataTypesNumber.cpp +++ b/src/DataTypes/DataTypesNumber.cpp @@ -36,4 +36,4 @@ void registerDataTypeNumbers(DataTypeFactory & factory) factory.registerAlias("DOUBLE", "Float64", DataTypeFactory::CaseInsensitive); } -} \ No newline at end of file +} diff --git a/src/Interpreters/InterpreterCreateQuery.cpp b/src/Interpreters/InterpreterCreateQuery.cpp index d4773d007e5..06a011e4633 100644 --- a/src/Interpreters/InterpreterCreateQuery.cpp +++ b/src/Interpreters/InterpreterCreateQuery.cpp @@ -298,12 +298,13 @@ ColumnsDescription InterpreterCreateQuery::getColumnsDescription(const ASTExpres if (col_decl.is_not && col_decl.is_null) { if (column_type->isNullable()) throw Exception{"Cant use NOT NULL with Nullable", ErrorCodes::ILLEGAL_SYNTAX_FOR_DATA_TYPE}; - } else if (col_decl.is_null && !col_decl.is_not) { + } + else if (col_decl.is_null && !col_decl.is_not) + { if (column_type->isNullable()) throw Exception{"Cant use NULL with Nullable", ErrorCodes::ILLEGAL_SYNTAX_FOR_DATA_TYPE}; - else { + else column_type = makeNullable(column_type); - } } if (context.getSettingsRef().data_type_default_nullable && !column_type->isNullable() && !col_decl.is_not && !col_decl.is_null) diff --git a/src/Parsers/ASTColumnDeclaration.cpp b/src/Parsers/ASTColumnDeclaration.cpp index de5abe28ffb..2d5bcba611c 100644 --- a/src/Parsers/ASTColumnDeclaration.cpp +++ b/src/Parsers/ASTColumnDeclaration.cpp @@ -83,8 +83,6 @@ void ASTColumnDeclaration::formatImpl(const FormatSettings & settings, FormatSta is_null->formatImpl(settings, state, frame); } - - if (default_expression) { settings.ostr << ' ' << (settings.hilite ? hilite_keyword : "") << default_specifier << (settings.hilite ? hilite_none : "") << ' '; diff --git a/src/Parsers/ParserCreateQuery.h b/src/Parsers/ParserCreateQuery.h index c2b36460397..9fae3d60836 100644 --- a/src/Parsers/ParserCreateQuery.h +++ b/src/Parsers/ParserCreateQuery.h @@ -171,18 +171,17 @@ bool IParserColumnDeclaration::parseImpl(Pos & pos, ASTPtr & node, E // Pos pos_before_null = pos; - if (s_not.check(pos, expected)) { - if (s_null.check(pos, expected)) { + if (s_not.check(pos, expected)) + if (s_null.check(pos, expected)) + { is_not = std::make_shared("NOT"); is_null = std::make_shared("NULL"); - } else { + } + else return false; - } - } else { - if (s_null.check(pos, expected)) { + else + if (s_null.check(pos, expected)) is_null = std::make_shared("NULL"); - } - } if (s_comment.ignore(pos, expected)) { @@ -213,12 +212,14 @@ bool IParserColumnDeclaration::parseImpl(Pos & pos, ASTPtr & node, E column_declaration->children.push_back(std::move(type)); } - if (is_null) { + if (is_null) + { column_declaration->is_null = is_null; column_declaration->children.push_back(std::move(is_null)); } - if (is_not) { + if (is_not) + { column_declaration->is_not = is_not; column_declaration->children.push_back(std::move(is_not)); }