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

EXPLAIN for SELECT INTO OUTFILE does not report an error message

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
    • 10.3
    • Optimizer
    • None

    Description

      If to add the statement

      SELECT *
      INTO OUTFILE '/tmp/t1.txt'
      FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
      FROM t1;
      

      to the test case for the bug "Bug#5382 'explain select into outfile' crashes the server" from outfile.test
      then execution of ./mtr main.outfile fails as follows:

      main.outfile                             [ fail ]
              Test ended at 2022-11-16 21:57:57
       
      CURRENT_TEST: main.outfile
      mysqltest: At line 70: query 'SELECT *
      INTO OUTFILE '/tmp/t1.txt'
      FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
      FROM t1' failed: 1290: The MariaDB server is running with the --secure-file-priv option so it cannot execute this statement
       
      The result from queries just before the failure was:
      < snip >
      select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
      load_file(concat(@tmpdir,"/outfile-test.not-exist"))
      NULL
      drop table t1;
      select load_file(concat(@tmpdir,"/outfile-test.4"));
      load_file(concat(@tmpdir,"/outfile-test.4"))
      1
       
      CREATE TABLE t1 (a INT);
      EXPLAIN
      SELECT *
      INTO OUTFILE '/tmp/t1.txt'
        FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
        FROM t1;
      id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
      1       SIMPLE  t1      system  NULL    NULL    NULL    NULL    0       Const row not found
      SELECT *
      INTO OUTFILE '/tmp/t1.txt'
      FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
      FROM t1;
      

      One can see that EXPLAIN just does not report an error that it should report as it the error is encountered at the prepare phase in JOIN::prepare().

      This is a consequence of a serious defect of the code that processes EXPLAIN for those variants of SELECT that employ classes whose prepare virtual method differs from the method of select_result::prepare().

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            igor Igor Babaev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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