BUG#919878: Assertion `!eliminated_tables...

- In MySQL 5.5, print_join() was re-worked to print "FROM dual" when all
  tables are constant. This change didn't work together with table 
  elimination.
This commit is contained in:
Sergey Petrunya 2012-02-21 01:08:22 +04:00
commit 0099593562
3 changed files with 62 additions and 2 deletions

View file

@ -588,4 +588,23 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index
drop view v1;
DROP TABLE t1,t2,t3;
#
# BUG#919878: Assertion `!eliminated_tables...
#
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1);
CREATE TABLE t2
( b INT, UNIQUE INDEX(b) );
INSERT INTO t2 VALUES (1),(2);
EXPLAIN EXTENDED
SELECT * FROM t2
WHERE b IN (
SELECT SUM(a) FROM t1 LEFT JOIN t2 ON b=a
);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL b 5 NULL 2 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` where <expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select sum(1) from dual where 1 having (<cache>(`test`.`t2`.`b`) = <ref_null_helper>(sum(1))))))
DROP TABLE t1,t2;
SET optimizer_switch=@save_optimizer_switch;