Skip to content

Commit e1e04c3

Browse files
committed
Correct a merge error.
1 parent fc0a6dd commit e1e04c3

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

mysql-test/t/subselect_innodb.test

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,3 +501,57 @@ SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
501501
set join_cache_level = default;
502502
drop view v1;
503503
drop table t1,t2;
504+
505+
--echo #
506+
--echo # MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
507+
--echo #
508+
create table t1(a int) engine=innodb;
509+
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
510+
511+
create table t2(
512+
id int primary key,
513+
key1 int,
514+
col1 int,
515+
key(key1)
516+
) engine=innodb;
517+
518+
insert into t2
519+
select
520+
A.a + B.a*10 + C.a*100 + D.a* 1000,
521+
A.a + 10*B.a,
522+
123456
523+
from t1 A, t1 B, t1 C, t1 D;
524+
525+
--echo # Table tsubq:
526+
--echo # - must use 'ref' (not 'index'), and must not use 'Using filesort'
527+
--echo # - shows a bad estimate for 'rows' (but I'm not sure if one can do better w/o histograms)
528+
explain select
529+
(SELECT
530+
concat(id, '-', key1, '-', col1)
531+
FROM t2
532+
WHERE t2.key1 = t1.a
533+
ORDER BY t2.id ASC LIMIT 1)
534+
from
535+
t1;
536+
537+
--echo #
538+
--echo # MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
539+
--echo #
540+
541+
alter table t2 add key2 int;
542+
update t2 set key2=key1;
543+
alter table t2 add key(key2);
544+
analyze table t2;
545+
flush tables;
546+
--echo # Table tsubq must use 'ref' + Using filesort (not 'index' w/o filesort)
547+
--replace_column 9 #
548+
explain select
549+
(SELECT
550+
concat(id, '-', key1, '-', col1)
551+
FROM t2
552+
WHERE t2.key1 = t1.a
553+
ORDER BY t2.key2 ASC LIMIT 1)
554+
from
555+
t1;
556+
557+
drop table t1,t2;

0 commit comments

Comments
 (0)