Commit 8fd0cf54 authored by unknown's avatar unknown
Browse files

Merge dl145s.mysql.com:/data/bk/team_tree_merge/CLEAN/mysql-5.0

into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt


sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents 900e66f8 41aaa0f0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -773,3 +773,5 @@ Warnings:
Warning	1071	Specified key was too long; max key length is 765 bytes
insert into t1 values('aaa');
drop table t1;
create table t1 (upgrade int);
drop table t1;
+4 −0
Original line number Diff line number Diff line
@@ -172,6 +172,10 @@ a
0
2
DROP TABLE t1;
create table t1 (a int);
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
drop table t1;
CREATE TABLE t1 (a int not null,b int not null);
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
+2 −2
Original line number Diff line number Diff line
@@ -566,14 +566,14 @@ COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
DROP TABLE t1,t2;
select * from (select group_concat('c') from DUAL) t;
group_concat('c')
NULL
c
create table t1 ( a int not null default 0);
select * from (select group_concat(a) from t1) t2;
group_concat(a)
NULL
select group_concat('x') UNION ALL select 1;
group_concat('x')
NULL
x
1
drop table t1;
CREATE TABLE t1 (id int, a varchar(9));
+16 −0
Original line number Diff line number Diff line
@@ -856,6 +856,22 @@ 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);
INSERT INTO t1 VALUES (1,1),(1,2),(2,3);
SELECT (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
(SELECT COUNT(DISTINCT t1.b))
0
2
SELECT (SELECT COUNT(DISTINCT 12)) FROM t1 GROUP BY t1.a;
(SELECT COUNT(DISTINCT 12))
1
1
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),
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.00000	2	2	2	1	1	1	2	2	0.00000	0.00000	2	2	2
DROP TABLE t1;
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
+35 −0
Original line number Diff line number Diff line
@@ -1113,4 +1113,39 @@ conv("18383815659218730760",10,10) + 0
select "18383815659218730760" + 0;
"18383815659218730760" + 0
1.8383815659219e+19
CREATE TABLE t1 (code varchar(10));
INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
SELECT ASCII(code), code FROM t1 WHERE code='A12';
ASCII(code)	code
97	a12
65	A12
SELECT ASCII(code), code FROM t1 WHERE code='A12' AND ASCII(code)=65;
ASCII(code)	code
65	A12
INSERT INTO t1 VALUES ('a12 '), ('A12  ');
SELECT LENGTH(code), code FROM t1 WHERE code='A12';
LENGTH(code)	code
3	a12
3	A12
4	a12 
5	A12  
SELECT LENGTH(code), code FROM t1 WHERE code='A12' AND LENGTH(code)=5;
LENGTH(code)	code
5	A12  
ALTER TABLE t1 ADD INDEX (code);
CREATE TABLE t2 (id varchar(10) PRIMARY KEY);
INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14');
SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id 
WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00');
code	id
A12  	a12
EXPLAIN EXTENDED 
SELECT * FROM t1 INNER JOIN t2 ON code=id 
WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00');
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	code	code	13	const	3	Using where; Using index
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	12	const	1	Using where; Using index
Warnings:
Note	1003	select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (`test`.`t2`.`id` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
DROP TABLE t1,t2;
End of 5.0 tests
Loading