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

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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Fix Version/s: 10.2.1
    • Component/s: Parser
    • Labels:
      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

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: