Hi, Alexander,

Looks great! Just a couple of questions below

On Nov 07, Alexander Barkov wrote:
> revision-id: 28deba0a611 (mariadb-11.0.1-239-g28deba0a611)
> parent(s): e9573c05965
> author: Alexander Barkov
> committer: Alexander Barkov
> timestamp: 2023-09-22 14:38:52 +0400
> message:
> 
> MDEV-32101 CREATE PACKAGE [BODY] for sql_mode=DEFAULT
> 
> This patch adds PACKAGE support with SQL/PSM dialect for sql_mode=DEFAULT:
> 
> - CREATE PACKAGE
> - DROP PACKAGE
> - CREATE PACKAGE BODY
> - DROP PACKAGE BODY
> - Package function and procedure invocation from outside of the package:
>     -- using two step identifiers
>     SELECT pkg.f1();
>     CALL pkg.p1()
> 
>     -- using three step identifiers
>     SELECT db.pkg.f1();
>     CALL db.pkg.p1();
> 
> This is a non-standard MariaDB extension.
> 
> However, later this code can be used to implement
> the SQL Standard and DB2 dialects of CREATE MODULE.
>
> diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
> index af2ec678daa..fca39b63312 100644
> --- a/sql/sql_yacc.yy
> +++ b/sql/sql_yacc.yy
> @@ -1285,7 +1285,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t 
> *yystacksize);
>  %left   TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER COMMENT_SYM
>  
>  %left   PREC_BELOW_SP_OBJECT_TYPE
> -%left   FUNCTION_SYM
> +%left   PACKAGE_MARIADB_SYM FUNCTION_SYM

Why PACKAGE_ORACLE_SYM and PACKAGE_ALLMODES_SYM don't need it?
(same for BODY_ORACLE_SYM and BODY_ALLMODES_SYM)

>  
>  
>  /*
> @@ -3049,6 +3059,8 @@ sp_handler:
>          | PROCEDURE_SYM                      { $$= &sp_handler_procedure; }
>          | PACKAGE_ORACLE_SYM                 { $$= &sp_handler_package_spec; 
> }
>          | PACKAGE_ORACLE_SYM BODY_ORACLE_SYM { $$= &sp_handler_package_body; 
> }
> +        | PACKAGE_MARIADB_SYM                { $$= &sp_handler_package_spec; 
> }
> +        | PACKAGE_MARIADB_SYM BODY_MARIADB_SYM { $$= 
> &sp_handler_package_body; }

Why not to use here PACKAGE_ALLMODES_SYM and BODY_ALLMODES_SYM?
(also, I'd personally call them simply PACKAGE_SYM and BODY_SYM)

>          ;
>  
>  
> @@ -19428,35 +19489,33 @@ create_routine:
>                                                (Item_result) $8, $10))
>                MYSQL_YYABORT;
>            }
> -        | create_or_replace definer_opt PACKAGE_ORACLE_SYM
> +        | create_or_replace definer_opt PACKAGE_ALLMODES_SYM
>            opt_if_not_exists sp_name opt_create_package_chistics_init
>            {
>              sp_package *pkg;
>              if (unlikely(!(pkg= Lex->
> -                           create_package_start(thd,
> -                                                SQLCOM_CREATE_PACKAGE,
> -                                                &sp_handler_package_spec,
> -                                                $5, $1 | $4))))
> +                           create_package_start(thd, 
> &sp_handler_package_spec,
> +                                                $5, $1 | $4,
> +                                                Lex->sp_chistics))))
>                MYSQL_YYABORT;
>              pkg->set_c_chistics(Lex->sp_chistics);

Looks redundant

>              Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());
>            }
>            sp_tail_is
>            opt_package_specification_element_list END
> -          remember_end_opt opt_sp_name
> +          remember_end_opt opt_trailing_sp_name
>            {
>              if (unlikely(Lex->create_package_finalize(thd, $5, $12, $11)))
>                MYSQL_YYABORT;
>            }
> -        | create_or_replace definer_opt PACKAGE_ORACLE_SYM BODY_ORACLE_SYM
> +        | create_or_replace definer_opt PACKAGE_ALLMODES_SYM 
> BODY_ALLMODES_SYM
>            opt_if_not_exists sp_name opt_create_package_chistics_init
>            {
>              sp_package *pkg;
>              if (unlikely(!(pkg= Lex->
> -                           create_package_start(thd,
> -                                                SQLCOM_CREATE_PACKAGE_BODY,
> -                                                &sp_handler_package_body,
> -                                                $6, $1 | $5))))
> +                           create_package_start(thd, 
> &sp_handler_package_body,
> +                                                $6, $1 | $5,
> +                                                Lex->sp_chistics))))
>                MYSQL_YYABORT;
>              pkg->set_c_chistics(Lex->sp_chistics);

same

>              Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start());

Regards,
Sergei
Chief Architect, MariaDB Server
and secur...@mariadb.org
_______________________________________________
developers mailing list -- developers@lists.mariadb.org
To unsubscribe send an email to developers-le...@lists.mariadb.org

Reply via email to