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

The results of 2 executions of a prepared EXPLAIN statement differ

    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

      For the following testcase that is a variant of the testcase from main/explain.test for bug #11829785 one can see different results from the first and the second execution of the prepared EXPLAIN:

      MariaDB [test]> CREATE TABLE t1(a INT);
      Query OK, 0 rows affected (0.018 sec)
       
      MariaDB [test]> 
      MariaDB [test]> INSERT INTO t1 VALUES (0), (0);
      Query OK, 2 rows affected (0.005 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> PREPARE s FROM
          -> 'EXPLAIN
          '> SELECT SUBSTRING(1, (SELECT 1 FROM t1 a1 RIGHT OUTER JOIN t1 ON 0)) AS d
          '> FROM t1 WHERE 0 > ANY (SELECT @a FROM t1)';
      Query OK, 0 rows affected (0.002 sec)
      Statement prepared
       
      MariaDB [test]> EXECUTE s;
      ERROR 1242 (21000): Subquery returns more than 1 row
      MariaDB [test]> EXECUTE s;
      +------+----------------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
      | id   | select_type          | table | type | possible_keys | key  | key_len | ref  | rows | Extra                                           |
      +------+----------------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
      |    1 | PRIMARY              | t1    | ALL  | NULL          | NULL | NULL    | NULL |    2 |                                                 |
      |    3 | UNCACHEABLE SUBQUERY | t1    | ALL  | NULL          | NULL | NULL    | NULL |    2 |                                                 |
      |    2 | SUBQUERY             | t1    | ALL  | NULL          | NULL | NULL    | NULL |    2 |                                                 |
      |    2 | SUBQUERY             | a1    | ALL  | NULL          | NULL | NULL    | NULL |    2 | Using where; Using join buffer (flat, BNL join) |
      +------+----------------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
      4 rows in set (0.002 sec)
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            igor Igor Babaev
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.