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

sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2.1
    • Parser
    • None
    • 10.2.1-1

    Description

      The "table_expression" rule currently looks like this:

       table_expression:
                opt_from_clause
                 opt_where_clause
                 opt_group_clause
                 opt_having_clause
                 opt_window_clause
                opt_order_clause
                opt_limit_clause
                opt_procedure_clause
                opt_select_lock_type
               ;
      

      We'll do the following refactoring:

      1. Remove the extra parts (opt_order_clause, opt_limit_clause, opt_procedure_clause, opt_select_lock_type parts), and make the "from_clause" non-optional:

       table_expression:
                from_clause
                 opt_where_clause
                 opt_group_clause
                 opt_having_clause
                 opt_window_clause
               ;
      

      After this change table_expression will match the SQL Standard <table expression> production.

      2. Add the "opt_table_expression" rule

      3. Move the extra parts of the ex-table_expression to the "caller" rules, and remove the opt_procedure_clause from non-relevant places.

      It will change these queries using subselects and derived table:

      SELECT * FROM (SELECT * FROM t1 PROCEDURE ANALYSE());
      SELECT * FROM t1 NATURAL JOIN (SELECT * FROM t2 PROCEDURE ANALYSE());
      SELECT (SELECT 1 FROM t1 PROCEDURE ANALYSE()) FROM t2;
      SELECT ((SELECT 1 FROM t1 PROCEDURE ANALYSE())) FROM t2;
      

      as well as:

      CREATE TABLE t2 SELECT  * FROMt1 PROCEDURE ANALYSE();
      

      to return "syntax error" instead of "Incorrect usage".

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.