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

explain SQL return an error while the SQL without explain can be executed correctly

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Duplicate
    • 10.0.22
    • 10.0.23, 10.1.10
    • Server
    • None

    Description

      Mariadb version: 10.0.22
      Desc: When I execute the following SQL:

      EXPLAIN
      INSERT INTO `table_test`(
      `id`,
      `status`
      )
      SELECT
      id,
      status
      FROM
      table_test
      WHERE
      id NOT IN (SELECT id FROM table_testwhere id < 10)

      the server return a error which states 'Column count doesn't match value count at row 1'.
      but I can execute that SQL correctly without 'EXPLAIN'.

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment - - edited

            Thanks! It was fixed by Oleksandr Byelkin (commit 6eb86763619be92) (MDEV-7215)

            MariaDB [test]> create table t1 (i int,j int) engine=innodb;
             
            MariaDB [test]>  insert into t1 values (1,1),(2,2),(5,5),(10,10),(7,7);
            Query OK, 5 rows affected (0.00 sec)
            Records: 5  Duplicates: 0  Warnings: 0
             
            MariaDB [test]> EXPLAIN
                -> INSERT INTO `t1`(`i`, `j`)
                -> SELECT i, j FROM t1
                -> WHERE i NOT IN (SELECT i FROM t1 where i< 10);
            +------+--------------+-------+------+---------------+------+---------+------+------+------------------------------+
            | id   | select_type  | table | type | possible_keys | key  | key_len | ref  | rows | Extra                        |
            +------+--------------+-------+------+---------------+------+---------+------+------+------------------------------+
            |    1 | PRIMARY      | t1    | ALL  | NULL          | NULL | NULL    | NULL |    5 | Using where; Using temporary |
            |    2 | MATERIALIZED | t1    | ALL  | NULL          | NULL | NULL    | NULL |    5 | Using where                  |
            +------+--------------+-------+------+---------------+------+---------+------+------+------------------------------+
            2 rows in set (0.00 sec)
             
            MariaDB [test]> select version();
            +-----------------+
            | version()       |
            +-----------------+
            | 10.0.23-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)
            

            alice Alice Sherepa added a comment - - edited Thanks! It was fixed by Oleksandr Byelkin (commit 6eb86763619be92) ( MDEV-7215 ) MariaDB [test]> create table t1 (i int,j int) engine=innodb;   MariaDB [test]> insert into t1 values (1,1),(2,2),(5,5),(10,10),(7,7); Query OK, 5 rows affected (0.00 sec) Records: 5 Duplicates: 0 Warnings: 0   MariaDB [test]> EXPLAIN -> INSERT INTO `t1`(`i`, `j`) -> SELECT i, j FROM t1 -> WHERE i NOT IN (SELECT i FROM t1 where i< 10); +------+--------------+-------+------+---------------+------+---------+------+------+------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +------+--------------+-------+------+---------------+------+---------+------+------+------------------------------+ | 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 5 | Using where; Using temporary | | 2 | MATERIALIZED | t1 | ALL | NULL | NULL | NULL | NULL | 5 | Using where | +------+--------------+-------+------+---------------+------+---------+------+------+------------------------------+ 2 rows in set (0.00 sec)   MariaDB [test]> select version(); +-----------------+ | version() | +-----------------+ | 10.0.23-MariaDB | +-----------------+ 1 row in set (0.00 sec)

            People

              Unassigned Unassigned
              hzw hzw
              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.