ISSUES-14231 allow dollar and numver in identifier

This commit is contained in:
zhang2014 2020-08-31 14:14:02 +08:00
parent 592b6dcdce
commit 761512413e
3 changed files with 12 additions and 2 deletions

View File

@ -146,13 +146,20 @@ Token Lexer::nextTokenImpl()
}
}
/// word character cannot go just after number (SELECT 123FROM)
/// Try to parse it to a identifier(1identifier_name), return ErrorWrongNumber if not
if (pos < end && isWordCharASCII(*pos))
{
++pos;
while (pos < end && isWordCharASCII(*pos))
++pos;
return Token(TokenType::ErrorWrongNumber, token_begin, pos);
for (const char * iterator = token_begin; iterator < pos; ++iterator)
{
if (!isWordCharASCII(*iterator) && *iterator != '$')
return Token(TokenType::ErrorWrongNumber, token_begin, pos);
}
return Token(TokenType::BareWord, token_begin, pos);
}
return Token(TokenType::Number, token_begin, pos);

View File

@ -1 +1,2 @@
SELECT 1 AS $alias$name$ FORMAT TSVWithNames;
SELECT 1 AS 1alias1name1 FORMAT TSVWithNames;