diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/distinct.result | 11 | ||||
-rw-r--r-- | mysql-test/t/distinct.test | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index fab0bc18a09..72c040cb25f 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -563,6 +563,17 @@ id IFNULL(dsc, '-') 2 line number two 3 line number three drop table t1; +CREATE TABLE t1 (a int primary key, b int); +INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2); +explain SELECT DISTINCT a, b FROM t1 ORDER BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort +SELECT DISTINCT a, b FROM t1 ORDER BY b; +a b +1 1 +3 2 +2 3 +DROP TABLE t1; CREATE TABLE t1 ( ID int(11) NOT NULL auto_increment, x varchar(20) default NULL, diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 61250a7105e..e517380ba9b 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -385,6 +385,17 @@ insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line select distinct id, IFNULL(dsc, '-') from t1; drop table t1; +# +# Bug 21456: SELECT DISTINCT(x) produces incorrect results when using order by +# +CREATE TABLE t1 (a int primary key, b int); + +INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2); + +explain SELECT DISTINCT a, b FROM t1 ORDER BY b; +SELECT DISTINCT a, b FROM t1 ORDER BY b; +DROP TABLE t1; + # End of 4.1 tests |