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

Disallow syntactically INSERT .. SELECT .. {ORDER BY ..| LIMIT ..} .. UNION ..

    XMLWordPrintable

Details

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

    Description

      These queries:

      INSERT INTO t3 SELECT 1 ORDER BY 1 UNION SELECT 2;
      INSERT INTO t3 SELECT 1 LIMIT 1 UNION SELECT 2;
      CREATE TABLE t1 AS SELECT 1 ORDER BY 1 UNION SELECT 2;
      CREATE TABLE t1 AS SELECT 1 LIMIT 1 UNION SELECT 2;
      

      are currently disallowed by this code in add_select_to_union_list():

        if (lex->current_select->order_list.first && !lex->current_select->braces)
        {
          my_error(ER_WRONG_USAGE, MYF(0), "UNION", "ORDER BY");
          return TRUE;
        }
       
        if (lex->current_select->explicit_limit && !lex->current_select->braces)
        {
          my_error(ER_WRONG_USAGE, MYF(0), "UNION", "LIMIT");
          return TRUE;
        }
      

      We'll change the grammar to return syntax errors instead.

      Attachments

        Issue Links

          Activity

            People

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