mirror of https://github.com/ByConity/ByConity
Merge pull request #15029 from ClickHouse/cast-single-argument
Proper exception message for wrong number of arguments of CAST
This commit is contained in:
commit
3f5d7843f6
|
@ -33,6 +33,9 @@ static bool tryExtractConstValueFromCondition(const ASTPtr & condition, bool & v
|
|||
{
|
||||
if (const auto * expr_list = function->arguments->as<ASTExpressionList>())
|
||||
{
|
||||
if (expr_list->children.size() != 2)
|
||||
throw Exception("Function CAST must have exactly two arguments", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
|
||||
const ASTPtr & type_ast = expr_list->children.at(1);
|
||||
if (const auto * type_literal = type_ast->as<ASTLiteral>())
|
||||
{
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
SELECT if(CAST(NULL), '2.55', NULL) AS x; -- { serverError 42 }
|
Loading…
Reference in New Issue