diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2013-07-16 09:22:17 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2013-07-16 09:22:17 +0400 |
commit | 9651a6f5745c330111b5281e69a7d52fc8261d0d (patch) | |
tree | 57fdb29f4035a0a1c4edc155f97577f645e29796 /mysql-test/t/subselect_sj.test | |
parent | 716a49a19e9a6fdd86f384917c8fdd6fdd0dd53f (diff) | |
download | mariadb-git-9651a6f5745c330111b5281e69a7d52fc8261d0d.tar.gz |
mdev-4173: Wrong result (extra row) with semijoin=on, joins in outer query, LEFT JOIN in the subquery
Apply the patch from Patryk Pomykalski:
- create_internal_tmp_table_from_heap() will now return information whether
the last row that we tried to write was a duplicate row.
(mysql-5.6 also has this change)
Diffstat (limited to 'mysql-test/t/subselect_sj.test')
-rw-r--r-- | mysql-test/t/subselect_sj.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index bfdc6335f1d..cde8d5d0e19 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2584,5 +2584,43 @@ ORDER BY sm; DROP TABLE t1,t2; +--echo # +--echo # mdev-4173 ignored duplicate value when converting heap to temp table +--echo # could lead to extra rows in semijoin queries or missing row in union queries +--echo # +CREATE TABLE t1 (i1 INT) engine=myisam; +INSERT INTO t1 VALUES +(4),(8),(0),(0),(0),(7),(7),(5),(3),(4),(9),(6),(1),(5),(6),(2),(4),(4); + +CREATE TABLE t2 (i2 INT, j2 INT) engine=myisam; +INSERT INTO t2 VALUES +(7,1),(0,7),(9,4),(3,7),(4,0),(2,2),(5,9),(3,4), +(1,0),(3,9),(5,8),(1,8),(204,18),(224,84),(9,6); + +CREATE TABLE t3 (i3 INT, KEY(i3)) engine=myisam; +INSERT INTO t3 VALUES +(0),(8),(1),(8),(9),(24),(6),(1),(6),(2),(4),(2),(1); + +select @@max_heap_table_size into @tmp_max_heap_table_size; +select @@join_buffer_size into @tmp_join_buffer_size; +set max_heap_table_size=16*1024; + +--disable_query_log +let $n = 8; +while ($n) { + eval set join_buffer_size= 128 + 128*$n; + SELECT COUNT(*) FROM t1 outer_t1, t2 outer_t2, t3 + WHERE outer_t1.i1 IN ( + SELECT j2 FROM t2 LEFT JOIN t3 ON ( i3 = j2 ) + WHERE i2 <> outer_t2.j2 + ); + dec $n; +} +--enable_query_log + +DROP TABLE t1, t2, t3; +set join_buffer_size = @tmp_join_buffer_size; +set max_heap_table_size = @tmp_max_heap_table_size; + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; |