Merge bug #16792 4.1->5.0

parent 91e93eb7
...@@ -845,12 +845,23 @@ EXPLAIN SELECT MAX(b) FROM t1; ...@@ -845,12 +845,23 @@ EXPLAIN SELECT MAX(b) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 1 SIMPLE t1 ALL NULL NULL NULL NULL 2
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
INSERT INTO t1 VALUES
(1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
(1,CONCAT(REPEAT('_', 250), "aa")), (1,CONCAT(REPEAT('_', 250), "ff"));
SELECT MAX(b) FROM t1;
MAX(b)
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________zz
EXPLAIN SELECT MAX(b) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(1,2),(2,3); INSERT INTO t1 VALUES (1,1),(1,2),(2,3);
SELECT (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a; SELECT (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
(SELECT COUNT(DISTINCT t1.b)) (SELECT COUNT(DISTINCT t1.b))
1 0
1 2
SELECT (SELECT COUNT(DISTINCT 12)) FROM t1 GROUP BY t1.a; SELECT (SELECT COUNT(DISTINCT 12)) FROM t1 GROUP BY t1.a;
(SELECT COUNT(DISTINCT 12)) (SELECT COUNT(DISTINCT 12))
1 1
...@@ -859,18 +870,7 @@ SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2), COUNT(*), COUNT(12), ...@@ -859,18 +870,7 @@ SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2), COUNT(*), COUNT(12),
COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2), COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2),
GROUP_CONCAT(2),GROUP_CONCAT(DISTINCT 2); GROUP_CONCAT(2),GROUP_CONCAT(DISTINCT 2);
AVG(2) BIT_AND(2) BIT_OR(2) BIT_XOR(2) COUNT(*) COUNT(12) COUNT(DISTINCT 12) MIN(2) MAX(2) STD(2) VARIANCE(2) SUM(2) GROUP_CONCAT(2) GROUP_CONCAT(DISTINCT 2) AVG(2) BIT_AND(2) BIT_OR(2) BIT_XOR(2) COUNT(*) COUNT(12) COUNT(DISTINCT 12) MIN(2) MAX(2) STD(2) VARIANCE(2) SUM(2) GROUP_CONCAT(2) GROUP_CONCAT(DISTINCT 2)
2.0000 2 2 2 1 1 1 2 2 0.0000 0.0000 2 2 2 2.00000 2 2 2 1 1 1 2 2 0.00000 0.00000 2 2 2
DROP TABLE t1;
CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
INSERT INTO t1 VALUES
(1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
(1,CONCAT(REPEAT('_', 250), "aa")), (1,CONCAT(REPEAT('_', 250), "ff"));
SELECT MAX(b) FROM t1;
MAX(b)
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________zz
EXPLAIN SELECT MAX(b) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
DROP TABLE t1; DROP TABLE t1;
create table t2 (ff double); create table t2 (ff double);
insert into t2 values (2.2); insert into t2 values (2.2);
......
...@@ -118,7 +118,7 @@ min(7) ...@@ -118,7 +118,7 @@ min(7)
NULL NULL
select min(7) from DUAL; select min(7) from DUAL;
min(7) min(7)
NULL 7
explain select min(7) from t2m join t1m; explain select min(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
...@@ -133,7 +133,7 @@ max(7) ...@@ -133,7 +133,7 @@ max(7)
NULL NULL
select max(7) from DUAL; select max(7) from DUAL;
max(7) max(7)
NULL 7
explain select max(7) from t2m join t1m; explain select max(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
...@@ -172,7 +172,7 @@ min(7) ...@@ -172,7 +172,7 @@ min(7)
NULL NULL
select min(7) from DUAL; select min(7) from DUAL;
min(7) min(7)
NULL 7
explain select min(7) from t2i join t1i; explain select min(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t2i ALL NULL NULL NULL NULL 1
...@@ -188,7 +188,7 @@ max(7) ...@@ -188,7 +188,7 @@ max(7)
NULL NULL
select max(7) from DUAL; select max(7) from DUAL;
max(7) max(7)
NULL 7
explain select max(7) from t2i join t1i; explain select max(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t2i ALL NULL NULL NULL NULL 1
......
...@@ -1365,7 +1365,7 @@ drop table t1, t2; ...@@ -1365,7 +1365,7 @@ drop table t1, t2;
(select avg(1)) union (select avg(1)) union (select avg(1)) union (select avg(1)) union (select avg(1)) union (select avg(1)) union
(select avg(1)) union (select avg(1)) union (select avg(1)); (select avg(1)) union (select avg(1)) union (select avg(1));
avg(1) avg(1)
NULL 1.0000
select _utf8'12' union select _latin1'12345'; select _utf8'12' union select _latin1'12345';
12 12
12 12
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment