This commit is contained in:
Arthur Passos 2024-11-21 00:09:46 +01:00 committed by GitHub
commit 43722a0ba6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 0 deletions

View File

@ -549,6 +549,8 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
auto names = typeid_cast<std::shared_ptr<ASTUserNamesWithHost>>(names_ast);
auto names_ref = names->names;
auto pos_after_parsing_names = pos;
std::optional<String> new_name;
std::optional<AllowedClientHosts> hosts;
std::optional<AllowedClientHosts> add_hosts;
@ -674,6 +676,13 @@ bool ParserCreateUserQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
else if (alter)
names->concatParts();
bool alter_query_with_no_changes = alter && pos_after_parsing_names == pos;
if (alter_query_with_no_changes)
{
return false;
}
auto query = std::make_shared<ASTCreateUserQuery>();
node = query;

View File

@ -0,0 +1,5 @@
-- Tags: no-parallel
create user u_03254_alter_user;
alter user u_03254_alter_user; -- { clientError SYNTAX_ERROR }
drop user u_03254_alter_user;