MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:October 16 2008 11:20am
Subject:bzr commit into mysql-6.0-bka-preview branch (sergefp:2659) Bug#40136
View as plain text  
#At file:///home/spetrunia/dev/mysql-6.0-bka-preview-merge2/

 2659 Sergey Petrunia	2008-10-16
      BUG#40136: Group by is ignored when join buffer is used for an outer join
      - Fix a typo bug in make_join_orderinfo().
modified:
  mysql-test/r/join_cache.result
  mysql-test/t/join_cache.test
  sql/sql_select.cc

per-file messages:
  mysql-test/r/join_cache.result
    BUG#40136: Group by is ignored when join buffer is used for an outer join
    - Testcase
  mysql-test/t/join_cache.test
    BUG#40136: Group by is ignored when join buffer is used for an outer join
    - Testcase
  sql/sql_select.cc
    BUG#40136: Group by is ignored when join buffer is used for an outer join
    - Fix a typo bug in make_join_orderinfo().
=== modified file 'mysql-test/r/join_cache.result'
--- a/mysql-test/r/join_cache.result	2008-07-22 04:54:18 +0000
+++ b/mysql-test/r/join_cache.result	2008-10-16 11:19:57 +0000
@@ -3206,3 +3206,34 @@ a	b	a	b
 8	30	8	10
 8	30	8	20
 DROP TABLE t1,t2;
+
+BUG#40136: Group by is ignored when join buffer is used for an outer join
+
+create table t1(a int PRIMARY KEY, b int);
+insert into t1 values
+(5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60);
+create table t2 (p int, a int, INDEX i_a(a));
+insert into t2 values
+(103, 7), (109, 3), (102, 3), (108, 1), (106, 3),
+(107, 7), (105, 1), (101, 3), (100, 7), (110, 1);
+set @save_join_cache_level=@@join_cache_level;
+set join_cache_level=6;
+The following must not show "using join cache":
+explain
+select t1.a, count(t2.p) as count
+from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	PRIMARY	4	NULL	4	Using index
+1	SIMPLE	t2	ref	i_a	i_a	5	test.t1.a	2	Using where
+select t1.a, count(t2.p) as count
+from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
+a	count
+1	1
+2	0
+3	2
+5	0
+6	0
+7	2
+8	0
+9	0
+drop table t1, t2;

=== modified file 'mysql-test/t/join_cache.test'
--- a/mysql-test/t/join_cache.test	2008-07-06 20:22:50 +0000
+++ b/mysql-test/t/join_cache.test	2008-10-16 11:19:57 +0000
@@ -769,4 +769,24 @@ EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t
 SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b >= 30;  
 
 DROP TABLE t1,t2;
- 
\ No newline at end of file
+ 
+--echo 
+--echo BUG#40136: Group by is ignored when join buffer is used for an outer join
+--echo 
+create table t1(a int PRIMARY KEY, b int);
+insert into t1 values
+  (5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60);
+create table t2 (p int, a int, INDEX i_a(a));
+insert into t2 values
+  (103, 7), (109, 3), (102, 3), (108, 1), (106, 3),
+  (107, 7), (105, 1), (101, 3), (100, 7), (110, 1);
+set @save_join_cache_level=@@join_cache_level;
+set join_cache_level=6;
+--echo The following must not show "using join cache":
+explain
+select t1.a, count(t2.p) as count
+  from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
+select t1.a, count(t2.p) as count
+  from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
+drop table t1, t2;
+

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2008-10-18 06:23:35 +0000
+++ b/sql/sql_select.cc	2008-10-16 11:19:57 +0000
@@ -8310,7 +8310,7 @@ uint make_join_orderinfo(JOIN *join)
       break;
     }
   }
-  return i;
+  return i-1;
 }
 
 static

Thread
bzr commit into mysql-6.0-bka-preview branch (sergefp:2659) Bug#40136Sergey Petrunia19 Oct