From 6ca3c14acf1d61b764a4f8de602ae969b6b51d9b Mon Sep 17 00:00:00 2001 From: Arthur Passos Date: Mon, 11 Nov 2024 16:51:13 -0300 Subject: [PATCH 1/2] minor exception message change --- src/Parsers/Access/ParserCreateUserQuery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parsers/Access/ParserCreateUserQuery.cpp b/src/Parsers/Access/ParserCreateUserQuery.cpp index 657302574c2..36bf54af1f2 100644 --- a/src/Parsers/Access/ParserCreateUserQuery.cpp +++ b/src/Parsers/Access/ParserCreateUserQuery.cpp @@ -276,7 +276,7 @@ namespace { std::shared_ptr ast_authentication_data; - if (!parseAuthenticationData(aux_pos, expected, ast_authentication_data, false, true, should_parse_no_password)) + if (!parseAuthenticationData(aux_pos, expected, ast_authentication_data, false, true, false)) { break; } From 139e2d4b1ea7ed84f82fb5d513d3b2820408c4d6 Mon Sep 17 00:00:00 2001 From: Arthur Passos Date: Tue, 12 Nov 2024 14:06:31 -0300 Subject: [PATCH 2/2] not so naive --- src/Parsers/Access/ParserCreateUserQuery.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Parsers/Access/ParserCreateUserQuery.cpp b/src/Parsers/Access/ParserCreateUserQuery.cpp index 36bf54af1f2..5417fc5d795 100644 --- a/src/Parsers/Access/ParserCreateUserQuery.cpp +++ b/src/Parsers/Access/ParserCreateUserQuery.cpp @@ -268,6 +268,13 @@ namespace authentication_methods.push_back(ast_authentication_data); } + // if the first authentication method parsed is of type no_password, then we should not try to parse any further + // as it cannot co-exist with other authentication types + if (authentication_methods.back()->type && authentication_methods.back()->type.value() == AuthenticationType::NO_PASSWORD) + { + return true; + } + // Need to save current position, process comma and only update real position in case there is an authentication method after // the comma. Otherwise, position should not be changed as it needs to be processed by other parsers and possibly throw error // on trailing comma. @@ -285,7 +292,7 @@ namespace authentication_methods.push_back(ast_authentication_data); } - return !authentication_methods.empty(); + return true; }); }