mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 05:22:17 +00:00
Proper exception message for wrong number of arguments of CAST
This commit is contained in:
parent
c185db46f9
commit
5a47e64685
@ -33,6 +33,9 @@ static bool tryExtractConstValueFromCondition(const ASTPtr & condition, bool & v
|
|||||||
{
|
{
|
||||||
if (const auto * expr_list = function->arguments->as<ASTExpressionList>())
|
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);
|
const ASTPtr & type_ast = expr_list->children.at(1);
|
||||||
if (const auto * type_literal = type_ast->as<ASTLiteral>())
|
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
Block a user