Merge pull request #49360 from evillique/alias-restricted-keywords

Allow restricted keywords if alias is quoted
This commit is contained in:
Nikolay Degterinsky 2023-05-02 15:02:05 +02:00 committed by GitHub
commit f87c418fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -1429,10 +1429,12 @@ bool ParserAlias::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
if (!allow_alias_without_as_keyword && !has_as_word)
return false;
bool is_quoted = pos->type == TokenType::QuotedIdentifier;
if (!id_p.parse(pos, node, expected))
return false;
if (!has_as_word)
if (!has_as_word && !is_quoted)
{
/** In this case, the alias can not match the keyword -
* so that in the query "SELECT x FROM t", the word FROM was not considered an alias,

View File

@ -0,0 +1 @@
SELECT 1 `array`, 2 "union";