mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Merge pull request #49360 from evillique/alias-restricted-keywords
Allow restricted keywords if alias is quoted
This commit is contained in:
commit
f87c418fc8
@ -1429,10 +1429,12 @@ bool ParserAlias::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
if (!allow_alias_without_as_keyword && !has_as_word)
|
if (!allow_alias_without_as_keyword && !has_as_word)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool is_quoted = pos->type == TokenType::QuotedIdentifier;
|
||||||
|
|
||||||
if (!id_p.parse(pos, node, expected))
|
if (!id_p.parse(pos, node, expected))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!has_as_word)
|
if (!has_as_word && !is_quoted)
|
||||||
{
|
{
|
||||||
/** In this case, the alias can not match the keyword -
|
/** 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,
|
* so that in the query "SELECT x FROM t", the word FROM was not considered an alias,
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
1 2
|
@ -0,0 +1 @@
|
|||||||
|
SELECT 1 `array`, 2 "union";
|
Loading…
Reference in New Issue
Block a user