From: Date: June 16 2005 6:45pm Subject: bk commit into 4.1 tree (igor:1.2297) BUG#8614 List-Archive: http://lists.mysql.com/internals/26082 X-Bug: 8614 Message-Id: <20050616164550.4D9601526C5@rurik.mysql.com> 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.2297 05/06/16 09:45:41 igor@stripped +3 -0 group_by.result, group_by.test: Added a test case for bug #8614. sql_select.cc: Fixed bug #8614. SELECT DISTINCT ... GROUP BY 'const' must be equivalent to SELECT ... GROUP BY 'const'. mysql-test/r/group_by.result 1.47 05/06/16 09:45:10 igor@stripped +10 -0 Added a test case for bug #8614. mysql-test/t/group_by.test 1.37 05/06/16 09:44:42 igor@stripped +14 -1 Added a test case for bug #8614. sql/sql_select.cc 1.412 05/06/16 09:43:51 igor@stripped +8 -3 Fixed bug #8614. SELECT DISTINCT ... GROUP BY 'const' must be equivalent to SELECT ... GROUP BY 'const'. # 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.411/sql/sql_select.cc Thu Jun 16 04:39:46 2005 +++ 1.412/sql/sql_select.cc Thu Jun 16 09:43:51 2005 @@ -676,9 +676,14 @@ DBUG_RETURN(1); } simple_group= 0; - group_list= remove_const(this, group_list, conds, - rollup.state == ROLLUP::STATE_NONE, - &simple_group); + { + ORDER *old_group_list; + group_list= remove_const(this, (old_group_list= group_list), conds, + rollup.state == ROLLUP::STATE_NONE, + &simple_group); + if (old_group_list && !group_list) + select_distinct= 0; + } if (!group_list && group) { order=0; // The output has only one row --- 1.46/mysql-test/r/group_by.result Tue Jun 7 02:57:06 2005 +++ 1.47/mysql-test/r/group_by.result Thu Jun 16 09:45:10 2005 @@ -722,3 +722,13 @@ GROUP BY hostname; hostname no cache-dtc-af05.proxy.aol.com 1 +DROP TABLE t1; +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,2), (1,3); +SELECT a, b FROM t1 GROUP BY 'const'; +a b +1 2 +SELECT DISTINCT a, b FROM t1 GROUP BY 'const'; +a b +1 2 +DROP TABLE t1; --- 1.36/mysql-test/t/group_by.test Tue Jun 7 02:57:40 2005 +++ 1.37/mysql-test/t/group_by.test Thu Jun 16 09:44:42 2005 @@ -1,3 +1,4 @@ + # Initialise --disable_warnings drop table if exists t1,t2,t3; @@ -524,7 +525,7 @@ drop table t1; # -# Test for bug #11088: GROUP BY a BLOB colimn with COUNT(DISTINCT column1) +# Test for bug #11088: GROUP BY a BLOB column with COUNT(DISTINCT column1) # CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext); @@ -539,3 +540,15 @@ WHERE hostname LIKE '%aol%' GROUP BY hostname; +DROP TABLE t1; + +# +# Test for bug #8614: GROUP BY 'const with DISTINCT +# + +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (1,2), (1,3); +SELECT a, b FROM t1 GROUP BY 'const'; +SELECT DISTINCT a, b FROM t1 GROUP BY 'const'; + +DROP TABLE t1;