diff options
author | unknown <timour@askmonty.org> | 2011-12-08 12:05:52 +0200 |
---|---|---|
committer | unknown <timour@askmonty.org> | 2011-12-08 12:05:52 +0200 |
commit | 314c377422dd13c86591a4de32162467eb540c33 (patch) | |
tree | 3096f6e07e04a1d334dbe44aa653d6e2fd238efb /mysql-test | |
parent | 1f3e540385fd7705047242e58800fcceb5ef3da5 (diff) | |
download | mariadb-git-314c377422dd13c86591a4de32162467eb540c33.tar.gz |
Fixed bug lp:888456
Analysis:
The class member QUICK_GROUP_MIN_MAX_SELECT::seen_first_key
was not reset between subquery re-executions. Thus each
subsequent execution continued from the group that was
reached by the previous subquery execution. As a result
loose scan reached end of file much earlier, and returned
empty result where it shouldn't.
Solution:
Reset seen_first_key before each re-execution of the
loose scan.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/group_min_max.result | 17 | ||||
-rw-r--r-- | mysql-test/t/group_min_max.test | 14 |
2 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 6fef66b9d93..5b6ae943529 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2780,4 +2780,21 @@ ORDER BY min_a; min_a NULL DROP TABLE t1; +# +# LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL +# +CREATE TABLE t1 ( a int NOT NULL) ; +INSERT INTO t1 VALUES (28),(29),(9); +CREATE TABLE t2 ( a int, KEY (a)) ; +INSERT INTO t2 VALUES (1),(1),(1),(4),(4),(5),(5),(8),(8),(9); +explain select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 +2 DEPENDENT SUBQUERY t2 range a a 5 NULL 6 Using where; Using index for group-by +select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1; +(select t2.a from t2 where t2.a >= t1.a group by t2.a) +NULL +NULL +9 +drop table t1, t2; End of 5.1 tests diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 8ab7e1c9cb4..bd2cbd8a9f0 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -1099,5 +1099,19 @@ ORDER BY min_a; DROP TABLE t1; +--echo # +--echo # LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL +--echo # + +CREATE TABLE t1 ( a int NOT NULL) ; +INSERT INTO t1 VALUES (28),(29),(9); + +CREATE TABLE t2 ( a int, KEY (a)) ; +INSERT INTO t2 VALUES (1),(1),(1),(4),(4),(5),(5),(8),(8),(9); + +explain select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1; +select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1; + +drop table t1, t2; --echo End of 5.1 tests |