This commit is contained in:
kssenii 2021-12-20 08:43:07 +03:00
parent 2d4b27a6b5
commit 965e2bfb21
3 changed files with 16 additions and 0 deletions

View File

@ -183,6 +183,18 @@ bool checkPositionalArguments(ASTPtr & argument, const ASTSelectQuery * select_q
{
if (ast_function->arguments)
{
/// Check that all literal arguments are integers in advance to be able to always
/// throw exception at once if argument is out of position bounds.
for (auto & arg : ast_function->arguments->children)
{
if (const auto * ast_literal = typeid_cast<const ASTLiteral *>(arg.get()))
{
auto which = ast_literal->value.getType();
if (which != Field::Types::UInt64)
return false;
}
}
for (auto & arg : ast_function->arguments->children)
positional &= checkPositionalArguments(arg, select_query, expression);
}

View File

@ -152,3 +152,5 @@ SELECT 1 + 1 AS a
GROUP BY a
select substr('aaaaaaaaaaaaaa', 8) as a group by a;
aaaaaaa
select substr('aaaaaaaaaaaaaa', 8) as a group by substr('aaaaaaaaaaaaaa', 8);
aaaaaaa

View File

@ -52,3 +52,5 @@ select a, b, c, d, e, f from (select 44 a, 88 b, 13 c, 14 d, 15 e, 16 f) t grou
explain syntax select plus(1, 1) as a group by a;
select substr('aaaaaaaaaaaaaa', 8) as a group by a;
select substr('aaaaaaaaaaaaaa', 8) as a group by substr('aaaaaaaaaaaaaa', 8);