Loading mysql-test/r/group_min_max.result +27 −0 Original line number Diff line number Diff line Loading @@ -2043,3 +2043,30 @@ c1 c2 30 8 30 9 drop table t1; CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b)); INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4); OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK SELECT a FROM t1 WHERE a='AA' GROUP BY a; a AA SELECT a FROM t1 WHERE a='BB' GROUP BY a; a BB EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 3 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 1 Using where; Using index SELECT DISTINCT a FROM t1 WHERE a='BB'; a BB SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%'; a BB SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a; a BB DROP TABLE t1; mysql-test/r/sp-code.result +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ Pos Instruction 17 set v_col@8 NULL 18 stmt 0 "select row,col into v_row,v_col from ..." 19 stmt 0 "select dig into v_dig from sudoku_wor..." 20 set_case_expr 0 v_dig@4 20 set_case_expr (34) 0 v_dig@4 21 jump_if_not 25(34) (case_expr@0 = 0) 22 set v_dig@4 1 23 stmt 4 "update sudoku_work set dig = 1 where ..." Loading mysql-test/r/sp-destruct.result +7 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,12 @@ drop trigger t1_ai; create trigger t1_ai after insert on t1 for each row call bug14233_3(); insert into t1 values (0); ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) delete from mysql.proc where name like 'bug14233%'; drop trigger t1_ai; drop table t1; drop function bug14233_1; drop function bug14233_2; drop procedure bug14233_3; show procedure status; Db Name Type Definer Modified Created Security_type Comment show function status; Db Name Type Definer Modified Created Security_type Comment mysql-test/r/sp.result +5 −2 Original line number Diff line number Diff line Loading @@ -4089,8 +4089,6 @@ NULL 1 call bug14643_2()| Handler boo 2 2 Handler boo drop procedure bug14643_1| Loading Loading @@ -4432,6 +4430,11 @@ Handler error End done call bug14498_4()| Handler error End done call bug14498_5()| Handler error Loading mysql-test/t/group_min_max.test +21 −0 Original line number Diff line number Diff line Loading @@ -715,3 +715,24 @@ select distinct c1, c2 from t1 order by c2; select c1,min(c2) as c2 from t1 group by c1 order by c2; select c1,c2 from t1 group by c1,c2 order by c2; drop table t1; # # Bug #16203: Analysis for possible min/max optimization erroneously # returns impossible range # CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b)); INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4); OPTIMIZE TABLE t1; SELECT a FROM t1 WHERE a='AA' GROUP BY a; SELECT a FROM t1 WHERE a='BB' GROUP BY a; EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a; EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a; SELECT DISTINCT a FROM t1 WHERE a='BB'; SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%'; SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a; DROP TABLE t1; Loading
mysql-test/r/group_min_max.result +27 −0 Original line number Diff line number Diff line Loading @@ -2043,3 +2043,30 @@ c1 c2 30 8 30 9 drop table t1; CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b)); INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4); OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK SELECT a FROM t1 WHERE a='AA' GROUP BY a; a AA SELECT a FROM t1 WHERE a='BB' GROUP BY a; a BB EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 3 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 1 Using where; Using index SELECT DISTINCT a FROM t1 WHERE a='BB'; a BB SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%'; a BB SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a; a BB DROP TABLE t1;
mysql-test/r/sp-code.result +1 −1 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ Pos Instruction 17 set v_col@8 NULL 18 stmt 0 "select row,col into v_row,v_col from ..." 19 stmt 0 "select dig into v_dig from sudoku_wor..." 20 set_case_expr 0 v_dig@4 20 set_case_expr (34) 0 v_dig@4 21 jump_if_not 25(34) (case_expr@0 = 0) 22 set v_dig@4 1 23 stmt 4 "update sudoku_work set dig = 1 where ..." Loading
mysql-test/r/sp-destruct.result +7 −1 Original line number Diff line number Diff line Loading @@ -72,6 +72,12 @@ drop trigger t1_ai; create trigger t1_ai after insert on t1 for each row call bug14233_3(); insert into t1 values (0); ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) delete from mysql.proc where name like 'bug14233%'; drop trigger t1_ai; drop table t1; drop function bug14233_1; drop function bug14233_2; drop procedure bug14233_3; show procedure status; Db Name Type Definer Modified Created Security_type Comment show function status; Db Name Type Definer Modified Created Security_type Comment
mysql-test/r/sp.result +5 −2 Original line number Diff line number Diff line Loading @@ -4089,8 +4089,6 @@ NULL 1 call bug14643_2()| Handler boo 2 2 Handler boo drop procedure bug14643_1| Loading Loading @@ -4432,6 +4430,11 @@ Handler error End done call bug14498_4()| Handler error End done call bug14498_5()| Handler error Loading
mysql-test/t/group_min_max.test +21 −0 Original line number Diff line number Diff line Loading @@ -715,3 +715,24 @@ select distinct c1, c2 from t1 order by c2; select c1,min(c2) as c2 from t1 group by c1 order by c2; select c1,c2 from t1 group by c1,c2 order by c2; drop table t1; # # Bug #16203: Analysis for possible min/max optimization erroneously # returns impossible range # CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b)); INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4); OPTIMIZE TABLE t1; SELECT a FROM t1 WHERE a='AA' GROUP BY a; SELECT a FROM t1 WHERE a='BB' GROUP BY a; EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a; EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a; SELECT DISTINCT a FROM t1 WHERE a='BB'; SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%'; SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a; DROP TABLE t1;