mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix ephemeral comment
This commit is contained in:
parent
2f8d15bcaa
commit
bf3a3ad607
@ -237,6 +237,7 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
|
||||
null_modifier.emplace(true);
|
||||
}
|
||||
|
||||
bool is_comment = false;
|
||||
/// Collate is also allowed after NULL/NOT NULL
|
||||
if (!collation_expression && s_collate.ignore(pos, expected)
|
||||
&& !collation_parser.parse(pos, collation_expression, expected))
|
||||
@ -254,7 +255,9 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
|
||||
else if (s_ephemeral.ignore(pos, expected))
|
||||
{
|
||||
default_specifier = s_ephemeral.getName();
|
||||
if (!expr_parser.parse(pos, default_expression, expected) && type)
|
||||
if (s_comment.ignore(pos, expected))
|
||||
is_comment = true;
|
||||
if ((is_comment || !expr_parser.parse(pos, default_expression, expected)) && type)
|
||||
{
|
||||
ephemeral_default = true;
|
||||
|
||||
@ -289,19 +292,22 @@ bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, E
|
||||
if (require_type && !type && !default_expression)
|
||||
return false; /// reject column name without type
|
||||
|
||||
if ((type || default_expression) && allow_null_modifiers && !null_modifier.has_value())
|
||||
if (!is_comment)
|
||||
{
|
||||
if (s_not.ignore(pos, expected))
|
||||
if ((type || default_expression) && allow_null_modifiers && !null_modifier.has_value())
|
||||
{
|
||||
if (!s_null.ignore(pos, expected))
|
||||
return false;
|
||||
null_modifier.emplace(false);
|
||||
if (s_not.ignore(pos, expected))
|
||||
{
|
||||
if (!s_null.ignore(pos, expected))
|
||||
return false;
|
||||
null_modifier.emplace(false);
|
||||
}
|
||||
else if (s_null.ignore(pos, expected))
|
||||
null_modifier.emplace(true);
|
||||
}
|
||||
else if (s_null.ignore(pos, expected))
|
||||
null_modifier.emplace(true);
|
||||
}
|
||||
|
||||
if (s_comment.ignore(pos, expected))
|
||||
if (is_comment || s_comment.ignore(pos, expected))
|
||||
{
|
||||
/// should be followed by a string literal
|
||||
if (!string_literal_parser.parse(pos, comment_expression, expected))
|
||||
|
Loading…
Reference in New Issue
Block a user