diff options
author | unknown <serg@sergbook.mysql.com> | 2007-05-18 18:22:38 +0200 |
---|---|---|
committer | unknown <serg@sergbook.mysql.com> | 2007-05-18 18:22:38 +0200 |
commit | 8933c18cca395edc6bbdb0f29674ceab45ff53b1 (patch) | |
tree | e58a3f523f5e03fb592555596ca6babae37b02b4 /mysql-test | |
parent | f7434c4f93294d75b584d2160dd279e523d0a5b8 (diff) | |
parent | 507ad360d785e5f0afc42f27df27b09bb7a129b8 (diff) | |
download | mariadb-git-8933c18cca395edc6bbdb0f29674ceab45ff53b1.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0
mysql-test/r/ps.result:
Auto merged
mysql-test/t/ps.test:
Auto merged
sql/item.cc:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/bigint.result | 10 | ||||
-rw-r--r-- | mysql-test/r/func_gconcat.result | 26 | ||||
-rw-r--r-- | mysql-test/r/func_group.result | 47 | ||||
-rw-r--r-- | mysql-test/r/innodb_mysql.result | 21 | ||||
-rw-r--r-- | mysql-test/r/ps.result | 22 | ||||
-rw-r--r-- | mysql-test/r/subselect.result | 30 | ||||
-rw-r--r-- | mysql-test/r/type_datetime.result | 30 | ||||
-rw-r--r-- | mysql-test/t/bigint.test | 6 | ||||
-rw-r--r-- | mysql-test/t/func_gconcat.test | 14 | ||||
-rw-r--r-- | mysql-test/t/func_group.test | 34 | ||||
-rw-r--r-- | mysql-test/t/innodb_mysql.test | 25 | ||||
-rw-r--r-- | mysql-test/t/ps.test | 18 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 24 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 21 |
14 files changed, 328 insertions, 0 deletions
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 541a15561e2..f18d1c9b583 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -352,3 +352,13 @@ select c1 mod 50 as result from t1; result 6 drop table t1; +select cast(19999999999999999999 as signed); +cast(19999999999999999999 as signed) +9223372036854775807 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' +select cast(-19999999999999999999 as signed); +cast(-19999999999999999999 as signed) +-9223372036854775808 +Warnings: +Error 1292 Truncated incorrect DECIMAL value: '' diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 71419b5b2c3..20df776ec1b 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -737,4 +737,30 @@ SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1; GROUP_CONCAT(DISTINCT UCASE(b)) ONE.1,TWO.2,ONE.3 DROP TABLE t1; +CREATE TABLE t1( a VARCHAR( 10 ), b INT ); +INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1), +( repeat( 'b', 10 ), 2); +SET group_concat_max_len = 20; +SELECT GROUP_CONCAT( a ) FROM t1; +GROUP_CONCAT( a ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 1 line(s) were cut by GROUP_CONCAT() +SELECT GROUP_CONCAT( DISTINCT a ) FROM t1; +GROUP_CONCAT( DISTINCT a ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 1 line(s) were cut by GROUP_CONCAT() +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +GROUP_CONCAT( a ORDER BY b ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 1 line(s) were cut by GROUP_CONCAT() +SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1; +GROUP_CONCAT( DISTINCT a ORDER BY b ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 1 line(s) were cut by GROUP_CONCAT() +SET group_concat_max_len = DEFAULT; +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index f245d272ede..e5720cc1ee0 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1330,4 +1330,51 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50; a average 1 32768.5000 DROP TABLE t1; +CREATE TABLE t1 ( a INT, b INT, KEY(a) ); +INSERT INTO t1 VALUES (NULL, 1), (NULL, 2); +EXPLAIN SELECT MIN(a), MIN(b) FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +SELECT MIN(a), MIN(b) FROM t1; +MIN(a) MIN(b) +NULL 1 +CREATE TABLE t2( a INT, b INT, c INT, KEY(a, b) ); +INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 ); +EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref a a 5 const 2 Using where +SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; +MIN(b) MIN(c) +3 2 +CREATE TABLE t3 (a INT, b INT, c int, KEY(a, b)); +INSERT INTO t3 VALUES (1, NULL, 1), (2, NULL, 2), (2, NULL, 2), (3, NULL, 3); +EXPLAIN SELECT MIN(a), MIN(b) FROM t3 where a = 2; +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 +SELECT MIN(a), MIN(b) FROM t3 where a = 2; +MIN(a) MIN(b) +2 NULL +CREATE TABLE t4 (a INT, b INT, c int, KEY(a, b)); +INSERT INTO t4 VALUES (1, 1, 1), (2, NULL, 2), (2, NULL, 2), (3, 1, 3); +EXPLAIN SELECT MIN(a), MIN(b) FROM t4 where a = 2; +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 +SELECT MIN(a), MIN(b) FROM t4 where a = 2; +MIN(a) MIN(b) +2 NULL +SELECT MIN(b), min(c) FROM t4 where a = 2; +MIN(b) min(c) +NULL 2 +CREATE TABLE t5( a INT, b INT, KEY( a, b) ); +INSERT INTO t5 VALUES( 1, 1 ), ( 1, 2 ); +EXPLAIN SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1; +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 +SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1; +MIN(a) MIN(b) +1 1 +SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1 and b > 1; +MIN(a) MIN(b) +1 2 +DROP TABLE t1, t2, t3, t4, t5; End of 5.0 tests diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 48e01d8dd6f..45cb116f08b 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -144,6 +144,27 @@ SELECT * FROM t1; c1 cnt 1a 2 DROP TABLE t1; +CREATE TABLE t1 ( +a1 decimal(10,0) DEFAULT NULL, +a2 blob, +a3 time DEFAULT NULL, +a4 blob, +a5 char(175) DEFAULT NULL, +a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', +a7 tinyblob, +INDEX idx (a6,a7(239),a5) +) ENGINE=InnoDB; +EXPLAIN SELECT a4 FROM t1 WHERE +a6=NULL AND +a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE +t.a6=t.a6 AND t1.a6=NULL AND +t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; End of 4.1 tests create table t1m (a int) engine=myisam; create table t1i (a int) engine=innodb; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 96abff8d7f6..8a10a52ee65 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1114,6 +1114,28 @@ execute stmt; show create table t1; drop table t1; deallocate prepare stmt; +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (2), (3), (1); +PREPARE st1 FROM +'(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a'; +EXECUTE st1; +a +1 +2 +3 +11 +12 +13 +EXECUTE st1; +a +1 +2 +3 +11 +12 +13 +DEALLOCATE PREPARE st1; +DROP TABLE t1; End of 4.1 tests. create table t1 (a varchar(20)); insert into t1 values ('foo'); diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 2e82d948edb..92a4a6f3f5a 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4041,4 +4041,34 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ref a a 5 const 1 Using where; Using index 2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort DROP TABLE t1; +CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); +INSERT INTO t1 VALUES +(3,'FL'), (2,'GA'), (4,'FL'), (1,'GA'), (5,'NY'), (7,'FL'), (6,'NY'); +CREATE TABLE t2 (id int NOT NULL, INDEX idx(id)); +INSERT INTO t2 VALUES (7), (5), (1), (3); +SELECT id, st FROM t1 +WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id); +id st +3 FL +1 GA +7 FL +SELECT id, st FROM t1 +WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id) +GROUP BY id; +id st +1 GA +3 FL +7 FL +SELECT id, st FROM t1 +WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id); +id st +2 GA +4 FL +SELECT id, st FROM t1 +WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id) +GROUP BY id; +id st +2 GA +4 FL +DROP TABLE t1,t2; End of 5.0 tests. diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index b45ddd597c4..48cc54fb3ef 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -346,3 +346,33 @@ call test27759(); a b a_then_b b_then_a c_then_a 2007-04-10 2007-04-11 2007-04-10 2007-04-10 2004-04-09 00:00:00 drop procedure test27759; +create table t1 (f1 date); +insert into t1 values (curdate()); +select left(f1,10) = curdate() from t1; +left(f1,10) = curdate() +1 +drop table t1; +create table t1(f1 date); +insert into t1 values('01-01-01'),('02-02-02'),('01-01-01'),('02-02-02'); +set @bug28261=''; +select if(@bug28261 = f1, '', @bug28261:= f1) from t1; +if(@bug28261 = f1, '', @bug28261:= f1) +2001-01-01 +2002-02-02 +2001-01-01 +2002-02-02 +Warnings: +Warning 1292 Incorrect date value: '' for column 'f1' at row 1 +select if(@bug28261 = f1, '', @bug28261:= f1) from t1; +if(@bug28261 = f1, '', @bug28261:= f1) +2001-01-01 +2002-02-02 +2001-01-01 +2002-02-02 +select if(@bug28261 = f1, '', @bug28261:= f1) from t1; +if(@bug28261 = f1, '', @bug28261:= f1) +2001-01-01 +2002-02-02 +2001-01-01 +2002-02-02 +drop table t1; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 6c1229db83f..9a5fb11229d 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -288,3 +288,9 @@ insert into t1 values (10000002383263201056); select c1 mod 50 as result from t1; drop table t1; +# +# Bug #8663 cant use bgint unsigned as input to cast +# + +select cast(19999999999999999999 as signed); +select cast(-19999999999999999999 as signed); diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 0dd82864520..7771f216f69 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -507,4 +507,18 @@ SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1; SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1; DROP TABLE t1; +# +# Bug #28273: GROUP_CONCAT and ORDER BY: No warning when result gets truncated. +# +CREATE TABLE t1( a VARCHAR( 10 ), b INT ); +INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1), + ( repeat( 'b', 10 ), 2); +SET group_concat_max_len = 20; +SELECT GROUP_CONCAT( a ) FROM t1; +SELECT GROUP_CONCAT( DISTINCT a ) FROM t1; +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1; +SET group_concat_max_len = DEFAULT; +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 654bb8bb75d..2293ac71454 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -827,4 +827,38 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50; DROP TABLE t1; +# +# Bug #27573: MIN() on an indexed column which is always NULL sets _other_ +# results to NULL +# +CREATE TABLE t1 ( a INT, b INT, KEY(a) ); +INSERT INTO t1 VALUES (NULL, 1), (NULL, 2); +EXPLAIN SELECT MIN(a), MIN(b) FROM t1; +SELECT MIN(a), MIN(b) FROM t1; + +CREATE TABLE t2( a INT, b INT, c INT, KEY(a, b) ); +INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 ); +EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; +SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1; + +CREATE TABLE t3 (a INT, b INT, c int, KEY(a, b)); +INSERT INTO t3 VALUES (1, NULL, 1), (2, NULL, 2), (2, NULL, 2), (3, NULL, 3); +EXPLAIN SELECT MIN(a), MIN(b) FROM t3 where a = 2; +SELECT MIN(a), MIN(b) FROM t3 where a = 2; + +CREATE TABLE t4 (a INT, b INT, c int, KEY(a, b)); +INSERT INTO t4 VALUES (1, 1, 1), (2, NULL, 2), (2, NULL, 2), (3, 1, 3); +EXPLAIN SELECT MIN(a), MIN(b) FROM t4 where a = 2; +SELECT MIN(a), MIN(b) FROM t4 where a = 2; +SELECT MIN(b), min(c) FROM t4 where a = 2; + +CREATE TABLE t5( a INT, b INT, KEY( a, b) ); +INSERT INTO t5 VALUES( 1, 1 ), ( 1, 2 ); +EXPLAIN SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1; +SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1; +SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1 and b > 1; + +DROP TABLE t1, t2, t3, t4, t5; + +### --echo End of 5.0 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 90f9047291c..d9e50add8bf 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -169,6 +169,31 @@ INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; SELECT * FROM t1; DROP TABLE t1; +# +# Bug #28272: EXPLAIN for SELECT from an empty InnoDB table +# + +CREATE TABLE t1 ( + a1 decimal(10,0) DEFAULT NULL, + a2 blob, + a3 time DEFAULT NULL, + a4 blob, + a5 char(175) DEFAULT NULL, + a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + a7 tinyblob, + INDEX idx (a6,a7(239),a5) +) ENGINE=InnoDB; + +EXPLAIN SELECT a4 FROM t1 WHERE +a6=NULL AND +a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; + +EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE +t.a6=t.a6 AND t1.a6=NULL AND +t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS'; + +DROP TABLE t1; + --echo End of 4.1 tests # # Bug #12882 min/max inconsistent on empty table diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 6c93ae25045..5b7adc40755 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1194,6 +1194,24 @@ show create table t1; --enable_warnings drop table t1; deallocate prepare stmt; +# + +# +# Bug #27937: crash on the second execution for prepared statement +# from UNION with ORDER BY an expression containing RAND() +# + +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (2), (3), (1); + +PREPARE st1 FROM + '(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a'; + +EXECUTE st1; +EXECUTE st1; + +DEALLOCATE PREPARE st1; +DROP TABLE t1; --echo End of 4.1 tests. diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 64de2ada93c..5840e434b64 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -2882,4 +2882,28 @@ INSERT INTO t1 VALUES (1,1),(2,1); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); DROP TABLE t1; +# +# Bug #28377: grouping query with a correlated subquery in WHERE condition +# + +CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); +INSERT INTO t1 VALUES + (3,'FL'), (2,'GA'), (4,'FL'), (1,'GA'), (5,'NY'), (7,'FL'), (6,'NY'); +CREATE TABLE t2 (id int NOT NULL, INDEX idx(id)); +INSERT INTO t2 VALUES (7), (5), (1), (3); + +SELECT id, st FROM t1 + WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id); +SELECT id, st FROM t1 + WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id) + GROUP BY id; + +SELECT id, st FROM t1 + WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id); +SELECT id, st FROM t1 + WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id) + GROUP BY id; + +DROP TABLE t1,t2; + --echo End of 5.0 tests. diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index c111f2f02cf..cf512aa3649 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -225,3 +225,24 @@ END;| DELIMITER ;| call test27759(); drop procedure test27759; + +# +# Bug#28208: Wrong result of a non-const STRING function with a const +# DATETIME function. +# +create table t1 (f1 date); +insert into t1 values (curdate()); +select left(f1,10) = curdate() from t1; +drop table t1; + +# +# Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function +# is involved. +# +create table t1(f1 date); +insert into t1 values('01-01-01'),('02-02-02'),('01-01-01'),('02-02-02'); +set @bug28261=''; +select if(@bug28261 = f1, '', @bug28261:= f1) from t1; +select if(@bug28261 = f1, '', @bug28261:= f1) from t1; +select if(@bug28261 = f1, '', @bug28261:= f1) from t1; +drop table t1; |