[MDEV-21077] explain SQL return an error while the SQL without explain can be executed correctly Created: 2019-11-19  Updated: 2019-11-19  Resolved: 2019-11-19

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.0.22
Fix Version/s: 10.0.23, 10.1.10

Type: Bug Priority: Blocker
Reporter: hzw Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-7215 EXPLAIN REPLACE produces an error: Co... Closed

 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'.



 Comments   
Comment by Alice Sherepa [ 2019-11-19 ]

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)

Generated at Thu Feb 08 09:04:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.