diff options
author | kaa@kaamos.(none) <> | 2008-03-26 19:37:36 +0300 |
---|---|---|
committer | kaa@kaamos.(none) <> | 2008-03-26 19:37:36 +0300 |
commit | b753e4a02ea1db9b5ff4132a77b2c9e1f441b875 (patch) | |
tree | d5a9ce757b38fb53947b1451d1033cca1fdd33a2 /mysql-test/r/distinct.result | |
parent | 6c0dcad829ad4b6ed3731224b92ae332fe4e5467 (diff) | |
download | mariadb-git-b753e4a02ea1db9b5ff4132a77b2c9e1f441b875.tar.gz |
Fix for bug #34928: Confusion by having Primary Key and Index
The bug is a regression introduced in 5.1 by the patch for bug28404.
Under some circumstances test_if_skip_sort_order() could leave some
data structures in an inconsistent state so that some parts of code
could assume the selected execution strategy for GROUP BY/DISTINCT as
a loose index scan (e.g. JOIN_TAB::is_using_loose_index_scan()), while
the actual strategy chosen was an ordered index scan, which led to
wrong data being returned.
Fixed test_if_skip_sort_order() so that when changing the type for a
join table, select->quick is reset not only for EXPLAIN, but for the
actual join execution as well, to not confuse code that depends on its
value to determine the chosen GROUP BY/DISTINCT strategy.
Diffstat (limited to 'mysql-test/r/distinct.result')
-rw-r--r-- | mysql-test/r/distinct.result | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index b2a9eb04c04..15e4c3f15b3 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -682,3 +682,26 @@ a a b 1 1 3 DROP TABLE t1; End of 5.0 tests +CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT, +PRIMARY KEY(a,b,c,d,e), +KEY(a,b,d,c) +); +INSERT INTO t1(a, b, c) VALUES (1, 1, 1), +(1, 1, 2), +(1, 1, 3), +(1, 2, 1), +(1, 2, 2), +(1, 2, 3); +EXPLAIN SELECT DISTINCT a, b, d, c FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 16 NULL 6 Using index +SELECT DISTINCT a, b, d, c FROM t1; +a b d c +1 1 0 1 +1 1 0 2 +1 1 0 3 +1 2 0 1 +1 2 0 2 +1 2 0 3 +DROP TABLE t1; +End of 5.1 tests |