MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:igor Date:August 19 2005 8:57am
Subject:bk commit into 4.1 tree (igor:1.2382) BUG#12625
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of igor. When igor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2382 05/08/19 01:57:22 igor@stripped +3 -0
  distinct.test, distinct.result:
    Added test cases for bug #12625.
  sql_select.cc:
    Fixed bug #12625.
    Fixed invalid removal of constant items from the DISTINCT
    list in the function create_distinct_group.

  mysql-test/t/distinct.test
    1.17 05/08/19 01:55:24 igor@stripped +17 -0
    Added test cases for bug #12625.

  mysql-test/r/distinct.result
    1.32 05/08/19 01:54:51 igor@stripped +40 -0
    Added test cases for bug #12625.

  sql/sql_select.cc
    1.431 05/08/19 01:53:02 igor@stripped +1 -3
    Fixed bug #12625.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	igor
# Host:	rurik.mysql.com
# Root:	/home/igor/dev/mysql-4.1-0

--- 1.430/sql/sql_select.cc	Mon Aug 15 21:26:07 2005
+++ 1.431/sql/sql_select.cc	Fri Aug 19 01:53:02 2005
@@ -8517,9 +8517,7 @@
   li.rewind();
   while ((item=li++))
   {
-    if (item->const_item() || item->with_sum_func)
-      continue;
-    if (!item->marker)
+    if (!item->const_item() && !item->with_sum_func && !item->marker)
     {
       ORDER *ord=(ORDER*) thd->calloc(sizeof(ORDER));
       if (!ord)

--- 1.31/mysql-test/r/distinct.result	Fri Feb 11 15:00:26 2005
+++ 1.32/mysql-test/r/distinct.result	Fri Aug 19 01:54:51 2005
@@ -464,3 +464,43 @@
 html	prod
 1	0.00
 drop table t1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+SELECT DISTINCT a, 1 FROM t1;
+a	1
+1	1
+2	1
+3	1
+4	1
+5	1
+SELECT DISTINCT 1, a FROM t1;
+1	a
+1	1
+1	2
+1	3
+1	4
+1	5
+CREATE TABLE t2 (a int, b int);
+INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
+SELECT DISTINCT a, b, 2 FROM t2;
+a	b	2
+1	1	2
+2	2	2
+2	3	2
+2	4	2
+3	5	2
+SELECT DISTINCT 2, a, b FROM t2;
+2	a	b
+2	1	1
+2	2	2
+2	2	3
+2	2	4
+2	3	5
+SELECT DISTINCT a, 2, b FROM t2;
+a	2	b
+1	2	1
+2	2	2
+2	2	3
+2	2	4
+3	2	5
+DROP TABLE t1,t2;

--- 1.16/mysql-test/t/distinct.test	Wed Jul 27 17:21:41 2005
+++ 1.17/mysql-test/t/distinct.test	Fri Aug 19 01:55:24 2005
@@ -333,4 +333,21 @@
 SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
 drop table t1;
 
+#
+# Test cases for #12625: DISTINCT for a list with constants
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+SELECT DISTINCT a, 1 FROM t1;
+SELECT DISTINCT 1, a FROM t1;
+
+CREATE TABLE t2 (a int, b int); 
+INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
+SELECT DISTINCT a, b, 2 FROM t2;
+SELECT DISTINCT 2, a, b FROM t2;
+SELECT DISTINCT a, 2, b FROM t2;
+
+DROP TABLE t1,t2;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (igor:1.2382) BUG#12625igor19 Aug