Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35229

NOCOPY has become reserved word bringing wide incompatibility

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 11.7(EOL)
    • 11.7.1
    • Parser
    • None

    Description

      MDEV-34316 has made NOCOPY a reserved word causing syntax errors both in ORACLE mode and in the traditional one in a variety of situations where it was previously allowed, including, but not limited to,

      create table nocopy (a int);
      create table t (nocopy int);
      create trigger nocopy after insert on t for each row begin end;
      prepare nocopy from "select 1";
      execute nocopy;
      create function nocopy() returns int return 0;
      create procedure pr (nocopy int) select nocopy;
      

      etc.

      According to bar, it shouldn't be necessary, and it should be still allowed wherever possible.

      Also, looking at this change:

      %token  <kwd>  GOTO_MARIADB_SYM              // Oracle-R
      %token  <kwd>  NOCOPY_SYM
      %token  <kwd>  OTHERS_MARIADB_SYM            // SQL-2011-N, PLSQL-R
      

      it is missing a comment.

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov added a comment - serg , please review a patch: https://github.com/MariaDB/server/commit/1f3a22b9d6656f14eb91513b86645baca4a01b3b Thanks.

            I'd suggest a following instead:

            --- a/sql/sql_yacc.yy
            +++ b/sql/sql_yacc.yy
            @@ -357,7 +357,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacks>
             %ifdef MARIADB
             %expect 62
             %else
            -%expect 62
            +%expect 63
             %endif
             
             /*
            @@ -1473,8 +1473,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystac>
                     opt_recursive opt_format_xid opt_for_portion_of_time_clause
                     ignorability
             
            -%type <alter_table_algo_val> alter_algorithm_option_is_kwd
            -
             %type <object_ddl_options>
                     create_or_replace
                     opt_if_not_exists
            @@ -8039,15 +8037,10 @@ opt_index_lock_algorithm:
                     | alter_algorithm_option alter_lock_option
                     ;
             
            -alter_algorithm_option_is_kwd:
            -           DEFAULT    { $$ = Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; }
            -        |  NOCOPY_SYM { $$ = Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY; }
            -        ;
            -
             alter_algorithm_option:
            -          ALGORITHM_SYM opt_equal alter_algorithm_option_is_kwd
            +          ALGORITHM_SYM opt_equal DEFAULT
                       {
            -            Lex->alter_info.set_requested_algorithm($3);
            +            Lex->alter_info.set_requested_algorithm(Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT);
                       }
                     | ALGORITHM_SYM opt_equal ident
                       {
            @@ -16388,6 +16381,7 @@ keyword_func_sp_var_and_label:
                     | NOMINVALUE_SYM
                     | NOMAXVALUE_SYM
                     | NO_WAIT_SYM
            +        | NOCOPY_SYM
                     | NOWAIT_SYM
                     | NODEGROUP_SYM
                     | NONE_SYM
            

            that is, reverting part of the PR and making NOCOPY not a keyword. It adds new shift/reduce conflict, thought. All your tests pass.

            serg Sergei Golubchik added a comment - I'd suggest a following instead: --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -357,7 +357,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacks> %ifdef MARIADB %expect 62 %else -%expect 62 +%expect 63 %endif /* @@ -1473,8 +1473,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystac> opt_recursive opt_format_xid opt_for_portion_of_time_clause ignorability -%type <alter_table_algo_val> alter_algorithm_option_is_kwd - %type <object_ddl_options> create_or_replace opt_if_not_exists @@ -8039,15 +8037,10 @@ opt_index_lock_algorithm: | alter_algorithm_option alter_lock_option ; -alter_algorithm_option_is_kwd: - DEFAULT { $$ = Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; } - | NOCOPY_SYM { $$ = Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY; } - ; - alter_algorithm_option: - ALGORITHM_SYM opt_equal alter_algorithm_option_is_kwd + ALGORITHM_SYM opt_equal DEFAULT { - Lex->alter_info.set_requested_algorithm($3); + Lex->alter_info.set_requested_algorithm(Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT); } | ALGORITHM_SYM opt_equal ident { @@ -16388,6 +16381,7 @@ keyword_func_sp_var_and_label: | NOMINVALUE_SYM | NOMAXVALUE_SYM | NO_WAIT_SYM + | NOCOPY_SYM | NOWAIT_SYM | NODEGROUP_SYM | NONE_SYM that is, reverting part of the PR and making NOCOPY not a keyword. It adds new shift/reduce conflict, thought. All your tests pass.
            bar Alexander Barkov added a comment - - edited

            Hi Sergei,

            I like your version.

            Please find a path here:

            https://github.com/MariaDB/server/commit/037e040bf0777b3ada4406d06099469c230ed1a1

            Note, I additionally had to disable_ps_protocol in some places in tests. See comments in tests.

            Thanks.

            bar Alexander Barkov added a comment - - edited Hi Sergei, I like your version. Please find a path here: https://github.com/MariaDB/server/commit/037e040bf0777b3ada4406d06099469c230ed1a1 Note, I additionally had to disable_ps_protocol in some places in tests. See comments in tests. Thanks.

            ok to push

            serg Sergei Golubchik added a comment - ok to push

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.