Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.7(EOL)
-
None
Description
This issue was exposed by fix for MDEV-25636.
Take this testcase from subselect4.result:
#
|
# LP BUG#680038 bool close_thread_table(THD*, TABLE**): |
# Assertion `table->key_read == 0' failed in EXPLAIN |
#
|
CREATE TABLE t1 (f1 int,f3 int,f4 int) ;
|
INSERT IGNORE INTO t1 VALUES (NULL,1,0);
|
CREATE TABLE t2 (f2 int,f4 int,f5 int) ;
|
INSERT IGNORE INTO t2 VALUES (8,0,0),(5,0,0);
|
CREATE TABLE t3 (f4 int,KEY (f4)) ;
|
INSERT IGNORE INTO t3 VALUES (0),(0);
|
set @@optimizer_switch='semijoin=off'; |
EXPLAIN
|
SELECT * FROM t1 WHERE |
(SELECT f2 FROM t2 |
WHERE f4 <= ALL |
(SELECT max(SQ1_t1.f4) |
FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4 |
GROUP BY SQ1_t1.f4)); |
id select_type table type possible_keys key key_len ref rows Extra |
1 PRIMARY t1 system NULL NULL NULL NULL 1 |
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where |
3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using temporary |
3 SUBQUERY SQ1_t3 index f4 f4 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) |
Here, select with id=2 should have SUBQUERY, not DEPENDENT SUBQUERY.
The details of why/how this happens are described here:
Attachments
Issue Links
- relates to
-
MDEV-25636 Bug report: abortion in sql/sql_parse.cc:6294
- Closed