From 8dfaf3af6954d18c92eb4b0d0b182c68b245b316 Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Thu, 11 Mar 2021 20:23:17 +0300 Subject: [PATCH] Backported CORE-6479: COMMENT ON USER can only apply comment on user defined by the default usermanager plugin --- src/dsql/parse.y | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/dsql/parse.y b/src/dsql/parse.y index e2a4070b73..d05d165f12 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -4850,13 +4850,27 @@ comment { $$ = newNode($3, *$4, *$5, *$7); } | COMMENT ON ddl_type4 ddl_qualified_name IS ddl_desc { $$ = newNode($3, *$4, "", *$6); } - | COMMENT ON USER symbol_user_name IS ddl_desc - { - CreateAlterUserNode* node = - newNode(CreateAlterUserNode::USER_MOD, *$4); - node->comment = $6; - $$ = node; - } + | comment_on_user + { $$ = $1; } + ; + +%type comment_on_user +comment_on_user + : COMMENT ON USER symbol_user_name + { + $$ = newNode(CreateAlterUserNode::USER_MOD, *$4); + } + opt_use_plugin($5) IS ddl_desc + { + CreateAlterUserNode* node = $$ = $5; + node->comment = $8; + } + ; + +%type opt_use_plugin() +opt_use_plugin($node) + : // nothing + | use_plugin($node) ; %type ddl_type0 @@ -6280,7 +6294,12 @@ user_fixed_option($node) | REVOKE ADMIN ROLE { setClause($node->adminRole, "ADMIN ROLE", Nullable(false)); } | ACTIVE { setClause($node->active, "ACTIVE/INACTIVE", Nullable(true)); } | INACTIVE { setClause($node->active, "ACTIVE/INACTIVE", Nullable(false)); } - | USING PLUGIN valid_symbol_name + | use_plugin($node) + ; + +%type use_plugin() +use_plugin($node) + : USING PLUGIN valid_symbol_name { setClause($node->plugin, "USING PLUGIN", $3); } ;