Fixed regression in parsing of CAST [#CLICKHOUSE-3180].

This commit is contained in:
Alexey Milovidov 2017-07-27 22:25:52 +03:00
parent 3dbde50daa
commit 2c815356c1
3 changed files with 8 additions and 0 deletions

View File

@ -300,6 +300,8 @@ bool ParserCastExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expect
return false;
const auto & id = typeid_cast<const ASTIdentifier &>(*identifier).name;
/// TODO This is ridiculous. Please get rid of this.
if (id.length() != strlen(name) || 0 != strcasecmp(id.c_str(), name))
{
/// Parse as a CASE expression.
@ -340,6 +342,8 @@ bool ParserCastExpression::parseImpl(Pos & pos, ASTPtr & node, Expected & expect
}
else
{
pos = contents_begin;
/// CAST(expression, 'type')
/// Reparse argument list from scratch
ParserExpressionWithOptionalAlias expression{false};

View File

@ -0,0 +1,2 @@
1
1

View File

@ -0,0 +1,2 @@
SELECT CAST(1 AS Int8);
SELECT CAST(1, 'Int8');