summaryrefslogtreecommitdiff
path: root/mysql-test/r/distinct.result
diff options
context:
space:
mode:
authorgkodinov/kgeorge@magare.gmz <>2007-04-10 16:55:48 +0300
committergkodinov/kgeorge@magare.gmz <>2007-04-10 16:55:48 +0300
commitaefc060fe59c5b484b5e40a8347575a2471facb4 (patch)
tree3fb0fcb21637dda61bb1c6e3deaf3fd3ad898e1e /mysql-test/r/distinct.result
parent204559cd2c3961f1bac8865ff56e4a06aa00ba6f (diff)
downloadmariadb-git-aefc060fe59c5b484b5e40a8347575a2471facb4.tar.gz
Bug #27659:
The optimizer transforms DISTINCT into a GROUP BY when possible. It does that by constructing the same structure (a list of ORDER instances) the parser makes when parsing GROUP BY. While doing that it also eliminates duplicates. But if a duplicate is found it doesn't advance the pointer to ref_pointer array, so the next (and subsequent) ORDER structures point to the wrong element in the SELECT list. Fixed by advancing the pointer in ref_pointer_array even in the case of a duplicate.
Diffstat (limited to 'mysql-test/r/distinct.result')
-rw-r--r--mysql-test/r/distinct.result14
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 3508a83a810..190e8595126 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -668,3 +668,17 @@ NULL
3
4
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES(1,1),(1,2),(1,3);
+SELECT DISTINCT a, b FROM t1;
+a b
+1 1
+1 2
+1 3
+SELECT DISTINCT a, a, b FROM t1;
+a a b
+1 1 1
+1 1 2
+1 1 3
+DROP TABLE t1;
+End of 5.0 tests