← Back to team overview

maria-developers team mailing list archive

Re: 9f2e2d8: [MDEV-7978] Update grammar for new syntax

 

Hi, Vicentiu!

On Jan 19, Vicentiu Ciorbaru wrote:
> revision-id: 9f2e2d89917709f9223fe2d4b75dc86d0297b4c4 (mariadb-10.1.8-113-g9f2e2d8)
> parent(s): 83e197aa6bd3a7eb81482795732bfbdb3b415deb
> author: Vicențiu Ciorbaru
> committer: Vicențiu Ciorbaru
> timestamp: 2016-01-17 17:07:21 +0200
> message:
> 
> [MDEV-7978] Update grammar for new syntax
> 
> Extend the syntax accepted by the grammar to account for the new create user
> and alter user syntax.

a couple of comments:

> diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
> index 3eb6a99..c1f4249 100644
> --- a/sql/sql_yacc.yy
> +++ b/sql/sql_yacc.yy
> @@ -7279,6 +7280,11 @@ alter:
>              lex->sql_command= SQLCOM_ALTER_SERVER;
>              lex->server_options.reset($3);
>            } OPTIONS_SYM '(' server_options_list ')' { }
> +        | ALTER opt_if_exists USER clear_privileges user_list
> +          require_clause resource_options
> +          {

please, add a comment that "ALTER USER foo;" is allowed for MySQL compatibility

> +            Lex->sql_command= SQLCOM_ALTER_USER;
> +          }
>          ;
>  
>  ev_alter_on_schedule_completion:
> @@ -15734,6 +15724,37 @@ grant_option:
>            }
>          ;
>  
> +resource_option_list:
> +	  resource_option_list resource_option {}
> +	| resource_option {}
> +        ;
> +
> +resource_options:

better rename it to opt_resource_options (and opt_grant_options below)
for consistency. In sql_yacc.yy optional clauses often start with opt_
and one can immediately see that they're optional in, for example

        | ALTER opt_if_exists USER clear_privileges user_list
          opt_require_clause opt_resource_options

> +	  /* empty */ {}
> +	| WITH resource_option_list
> +        ;
> +
> +
> +grant_options:
> +          /* empty */ {}
> +        | WITH grant_option_list {}
> +        ;

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx