diff options
author | unknown <kaa@kaamos.(none)> | 2008-03-12 10:59:15 +0300 |
---|---|---|
committer | unknown <kaa@kaamos.(none)> | 2008-03-12 10:59:15 +0300 |
commit | 09f8a4af63b5366505dfe56cb53e0ac26042eea1 (patch) | |
tree | 8e11254a0548ae9300008dac84cbfef339906922 /mysql-test | |
parent | 4d09306dd19820a742b003417d83f76f5d3633f3 (diff) | |
parent | 0abcb8ca5e3662d230446907469dc4facbb755ad (diff) | |
download | mariadb-git-09f8a4af63b5366505dfe56cb53e0ac26042eea1.tar.gz |
Merge kaamos.(none):/data/src/mysql-5.0
into kaamos.(none):/data/src/opt/mysql-5.0-opt
client/mysql.cc:
Auto merged
sql/filesort.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/r/view.result:
Manual merge.
mysql-test/t/view.test:
Manual merge.
scripts/mysql_config.sh:
Manual merge.
Diffstat (limited to 'mysql-test')
50 files changed, 901 insertions, 271 deletions
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index 3356d23053f..fefeeb405c5 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -1325,6 +1325,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/binlog_innodb.result b/mysql-test/r/binlog_innodb.result index 93414a13ba1..18b4b7c1c93 100644 --- a/mysql-test/r/binlog_innodb.result +++ b/mysql-test/r/binlog_innodb.result @@ -21,3 +21,19 @@ show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 drop table t1; +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; +CREATE FUNCTION bug23333() +RETURNS int(11) +DETERMINISTIC +BEGIN +INSERT INTO t1 VALUES (NULL); +SELECT COUNT(*) FROM t1 INTO @a; +RETURN @a; +END| +INSERT INTO t2 VALUES (2),(10+bug23333()); +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +# 184136 +DROP FUNCTION bug23333; +DROP TABLE t1, t2; diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result index c141b255716..c9ef41e0582 100644 --- a/mysql-test/r/compare.result +++ b/mysql-test/r/compare.result @@ -53,3 +53,41 @@ a b Warnings: Warning 1292 Truncated incorrect DOUBLE value: '' drop table if exists t1; +CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill); +INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2); +SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1; +CONCAT(b,c) CONCAT(b,c) = '0101' +0102 0 +0101 1 +0202 0 +EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where +Warnings: +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat(_binary'01',`test`.`t1`.`c`) = _latin1'0101')) +SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; +b c +01 01 +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES (1),(2); +SELECT a, +(SELECT COUNT(*) FROM t1 +WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x +FROM t2 ORDER BY a; +a x +1 1 +2 0 +EXPLAIN EXTENDED +SELECT a, +(SELECT COUNT(*) FROM t1 +WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x +FROM t2 ORDER BY a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using filesort +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +Warnings: +Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 +Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat(_latin1'0',`test`.`t2`.`a`,_latin1'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a` +DROP TABLE t1,t2; +End of 5.0 tests diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 3d7486b6ba2..53c2058f3ec 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1532,4 +1532,18 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 7 drop table t1,t2; +CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1)); +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE); +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 c1 1 c1 NULL 0 NULL NULL YES HASH +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 c1 1 c1 A NULL NULL NULL YES BTREE +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/ctype_cp932_binlog.result b/mysql-test/r/ctype_cp932_binlog.result index 3385cd20ec4..0b4ca93a0dd 100644 --- a/mysql-test/r/ctype_cp932_binlog.result +++ b/mysql-test/r/ctype_cp932_binlog.result @@ -40,6 +40,6 @@ IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 776 Query 1 995 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 995 Query 1 1084 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1084 Query 1 1163 use `test`; DROP TABLE t4 +master-bin.000001 776 Query 1 987 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 987 Query 1 1076 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1076 Query 1 1155 use `test`; DROP TABLE t4 diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 19b5f03de6b..77d11831842 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -931,4 +931,19 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1; GROUP_CONCAT(DISTINCT b, a ORDER BY b) 11,22,32 DROP TABLE t1, t2, t3; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (),(); +SELECT s1.d1 FROM +( +SELECT +t1.a as d1, +GROUP_CONCAT(DISTINCT t1.a) AS d2 +FROM +t1 AS t1, +t1 AS t2 +GROUP BY 1 +) AS s1; +d1 +NULL +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 4f6b6d3a0d8..cccdd391497 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -207,6 +207,25 @@ test SELECT NAME_CONST('test', 'test'); test test +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT NAME_CONST('flag',1) * MAX(a) FROM t1; +NAME_CONST('flag',1) * MAX(a) +3 +SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1; +NAME_CONST('flag',1.5) * MAX(a) +4.5 +SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1; +NAME_CONST('flag',-1) * MAX(a) +-3 +SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1; +NAME_CONST('flag',-1.5) * MAX(a) +-4.5 +SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1; +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1; +ERROR HY000: Incorrect arguments to NAME_CONST +DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (5), (2); SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index f25f9ed9e0a..d397947d7ca 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -666,6 +666,8 @@ timestampadd(SQL_TSI_SECOND, 1, date) select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1; timestampadd(SQL_TSI_FRAC_SECOND, 1, date) 2003-01-02 00:00:00.000001 +Warnings: +Warning 1287 'FRAC_SECOND' is deprecated; use 'MICROSECOND' instead select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a; a 3 @@ -699,6 +701,8 @@ a select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a; a 7689538999999 +Warnings: +Warning 1287 'FRAC_SECOND' is deprecated; use 'MICROSECOND' instead select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1, timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2, timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3, @@ -1069,6 +1073,7 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12: id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: +Warning 1287 'FRAC_SECOND' is deprecated; use 'MICROSECOND' instead Note 1003 select timestampdiff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2` select last_day('2005-00-00'); last_day('2005-00-00') @@ -1285,4 +1290,22 @@ DATE_ADD(20071108, INTERVAL 1 DAY) select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND; LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND 2007-12-30 23:59:59 +SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18'); +TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18') +2008-02-18 00:00:00.000001 +Warnings: +Warning 1287 'FRAC_SECOND' is deprecated; use 'MICROSECOND' instead +SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18'); +TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18') +86400000000 +Warnings: +Warning 1287 'FRAC_SECOND' is deprecated; use 'MICROSECOND' instead +SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND)' at line 1 +SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND)' at line 1 +SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND' at line 1 +SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND' at line 1 End of 5.0 tests diff --git a/mysql-test/r/grant3.result b/mysql-test/r/grant3.result index cc7f46855b2..f38848111ad 100644 --- a/mysql-test/r/grant3.result +++ b/mysql-test/r/grant3.result @@ -138,3 +138,20 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by user host db select_priv DROP USER CUser2@localhost; DROP USER CUser2@LOCALHOST; +CREATE DATABASE mysqltest_1; +CREATE TABLE mysqltest_1.t1 (a INT); +CREATE USER 'mysqltest1'@'%'; +GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%'; +REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%'; +GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%'; +FLUSH PRIVILEGES; +SHOW GRANTS; +Grants for mysqltest1@% +GRANT USAGE ON *.* TO 'mysqltest1'@'%' +GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%' +GRANT UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%' +SELECT * FROM mysqltest_1.t1; +a +DROP USER 'mysqltest1'@'%'; +DROP DATABASE mysqltest_1; +End of 5.0 tests diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 906c431b834..adfcc00174f 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -256,6 +256,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 854712fdb1d..774e0bd167b 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1901,6 +1901,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 2ab463e7f85..b487cfd9a4b 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1240,4 +1240,10 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `aa` (`a`(1)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; +set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment; +set global innodb_autoextend_increment=8; +set global innodb_autoextend_increment=@my_innodb_autoextend_increment; +set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency; +set global innodb_commit_concurrency=0; +set global innodb_commit_concurrency=@my_innodb_commit_concurrency; End of 5.0 tests diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 33f64d600bb..24c1cecfb4f 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1104,6 +1104,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/mysqldump-no-binlog.result b/mysql-test/r/mysqldump-no-binlog.result new file mode 100644 index 00000000000..78bc19b7cba --- /dev/null +++ b/mysql-test/r/mysqldump-no-binlog.result @@ -0,0 +1 @@ +mysqldump: Error: Binlogging on server not active diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 8a440284c53..58c587fe588 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -429,3 +429,21 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 5 DROP TABLE t1,t2,t3,t4; +CREATE TABLE t1 ( +a int(11) default NULL, +b int(11) default NULL, +KEY a (a,b) +); +INSERT INTO t1 VALUES (0,10),(0,11),(0,12); +CREATE TABLE t2 ( +a int(11) default NULL, +b int(11) default NULL, +KEY a (a) +); +INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12); +SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b; +a b a b +3 11 0 11 +3 12 0 12 +drop table t1, t2; +End of 5.0 tests diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index eedc2fa476b..9f6a1b3932c 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -1064,3 +1064,15 @@ a b 10 00:00:10 0 00:00:00 DROP TABLE t1; +# +# Bug#31590: Wrong error message on sort buffer being too small. +# +create table t1(a int, b tinytext); +insert into t1 values (1,2),(3,2); +set session sort_buffer_size= 30000; +Warnings: +Warning 1292 Truncated incorrect sort_buffer_size value: '30000' +set session max_sort_length= 2180; +select * from t1 order by b; +ERROR HY001: Out of sort memory; increase server sort buffer size +drop table t1; diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index e0084b53320..9b1da4ffc48 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1153,3 +1153,16 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= ' id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where drop table t1; +CREATE TABLE t1 ( +a varchar(32), index (a) +) DEFAULT CHARSET=latin1 COLLATE=latin1_bin; +INSERT INTO t1 VALUES +('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A'); +SELECT a FROM t1 WHERE a='b' OR a='B'; +a +B +B +EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index +DROP TABLE t1; diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 702e66fea62..98c79d4bc00 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -434,3 +434,12 @@ SELECT @x; @x 99 DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1); +SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a; +ROW(a, 1) IN (SELECT SUM(b), 1) +1 +SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a; +ROW(a, 1) IN (SELECT SUM(b), 3) +0 +DROP TABLE t1; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 3ca84bcf34b..c2cd2129a32 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4328,4 +4328,31 @@ SELECT * FROM t1 WHERE c1 > NULL + 1; c1 DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY); +INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0'); +SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar'); +a +foo0 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (a INT, c INT, KEY(a)); +INSERT INTO t1 VALUES (1, 1), (2, 2); +INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), +(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), +(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), +(4, 1), (4, 2), (4, 3), (4, 4), (4, 5); +FLUSH STATUS; +SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3; +b +1 +2 +SHOW STATUS LIKE 'Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 2 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 6 +DROP TABLE t1, t2; End of 5.0 tests diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index f0f148814eb..562102f0ea7 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6629,6 +6629,23 @@ end// call proc_33618(20); drop table t_33618; drop procedure proc_33618; +# +# Bug#30787: Stored function ignores user defined alias. +# +use test; +drop function if exists func30787; +create table t1(f1 int); +insert into t1 values(1),(2); +create function func30787(p1 int) returns int +begin +return p1; +end | +select (select func30787(f1)) as ttt from t1; +ttt +1 +2 +drop function func30787; +drop table t1; # ------------------------------------------------------------------ # -- End of 5.0 tests # ------------------------------------------------------------------ diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 34869862a63..0a714635f70 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -934,6 +934,8 @@ NULL NULL DROP TABLE t1; CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6)); INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello '); +Warnings: +Note 1265 Data truncated for column 'col1' at row 3 INSERT INTO t1 (col1) VALUES ('hellobob'); ERROR 22001: Data too long for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('hellobob'); diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 527c45671f4..2de2589fc92 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4147,103 +4147,37 @@ DROP TABLE t1,t2; create table t1(a int,b int,key(a),key(b)); insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5), (6,7),(7,4),(5,3); -select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 -)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -sum(a) a -select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -ERROR HY000: Thread stack overrun detected -explain select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 -)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 9 Using where; Using index -2 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -3 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -4 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -5 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -6 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -7 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -8 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -9 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -10 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -11 SUBQUERY t1 range a a 5 NULL 9 Using where; Using temporary; Using filesort -12 SUBQUERY t1 range a a 5 NULL 1 Using where; Using temporary; Using filesort -13 SUBQUERY t1 index NULL a 5 NULL 9 Using index -explain select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -ERROR HY000: Thread stack overrun detected +5 +4 +3 +2 +1 +26 +25 +24 +23 +22 +21 +20 +19 +18 +17 +16 +15 +14 +13 +12 +11 +10 +9 +8 +7 +6 +5 +4 +3 +2 +1 drop table t1; CREATE TABLE t1 (a1 INT, a2 INT); CREATE TABLE t2 (b1 INT, b2 INT); diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 833adbeb851..689aa724935 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -100,23 +100,15 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1(a INT) -DATA DIRECTORY='TEST_DIR/master-data/mysql' -INDEX DIRECTORY='TEST_DIR/master-data/mysql'; -RENAME TABLE t1 TO user; -ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17) -DROP TABLE t1; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `i` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `i` int(11) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1; +DATA DIRECTORY='TEST_DIR/tmp' +INDEX DIRECTORY='TEST_DIR/tmp'; +ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17) +CREATE TABLE t2(a INT) +DATA DIRECTORY='TEST_DIR/tmp' +INDEX DIRECTORY='TEST_DIR/tmp'; +RENAME TABLE t2 TO t1; +ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17) +DROP TABLE t2; show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( @@ -138,27 +130,38 @@ select * from t1; a 42 drop table t1; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +drop table t1; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' +drop table t1; +deallocate prepare stmt; +CREATE TABLE t1(a INT) +DATA DIRECTORY='TEST_DIR/var/master-data/test'; +Got one of the listed errors +CREATE TABLE t1(a INT) +DATA DIRECTORY='TEST_DIR/var/master-data/'; +Got one of the listed errors +CREATE TABLE t1(a INT) +INDEX DIRECTORY='TEST_DIR/var/master-data'; +Got one of the listed errors +CREATE TABLE t1(a INT) +INDEX DIRECTORY='TEST_DIR/var/master-data_var'; +Got one of the listed errors End of 4.1 tests -CREATE DATABASE db1; -CREATE DATABASE db2; -USE db2; -INSERT INTO db2.t1 VALUES (1); -SELECT * FROM db2.t1; -b -1 -RESET QUERY CACHE; -USE db1; SET SESSION keep_files_on_create = TRUE; CREATE TABLE t1 (a INT) ENGINE MYISAM; -ERROR HY000: Can't create/write to file './db1/t1.MYD' (Errcode: 17) -CREATE TABLE t3 (a INT) Engine=MyISAM; -INSERT INTO t3 VALUES (1),(2),(3); -TRUNCATE TABLE t3; -SELECT * from t3; -a -SET SESSION keep_files_on_create = DEFAULT; -DROP TABLE db2.t1, db1.t3; -DROP DATABASE db1; -DROP DATABASE db2; -USE test; +ERROR HY000: Can't create/write to file './test/t1.MYD' (Errcode: 17) +SET SESSION keep_files_on_create = FALSE; +CREATE TABLE t1 (a INT) ENGINE MYISAM; +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/tablelock.result b/mysql-test/r/tablelock.result index 2ffd8f928a9..6923ad40916 100644 --- a/mysql-test/r/tablelock.result +++ b/mysql-test/r/tablelock.result @@ -46,3 +46,12 @@ CREATE TABLE t2 (a int); lock tables t1 write,t1 as b write, t2 write, t2 as c read; drop table t2,t1; unlock tables; +create temporary table t1(f1 int); +lock tables t1 write; +insert into t1 values (1); +show columns from t1; +Field Type Null Key Default Extra +f1 int(11) YES NULL +insert into t1 values(2); +drop table t1; +unlock tables; diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result index debf4ff8fb8..aaa46ab415e 100644 --- a/mysql-test/r/type_binary.result +++ b/mysql-test/r/type_binary.result @@ -125,6 +125,7 @@ create table t1 (c char(2), vc varchar(2)); insert into t1 values(0x4120, 0x4120); insert into t1 values(0x412020, 0x412020); Warnings: +Note 1265 Data truncated for column 'c' at row 1 Note 1265 Data truncated for column 'vc' at row 1 drop table t1; set @old_sql_mode= @@sql_mode, sql_mode= 'traditional'; diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 03de20baef2..9829d4951c9 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -85,3 +85,11 @@ t1 CREATE TABLE `t1` ( `f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +CREATE TABLE t1(c set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64')); +INSERT INTO t1 VALUES(7); +INSERT INTO t1 VALUES(9223372036854775808); +SELECT * FROM t1; +c +1,2,3 +64 +DROP TABLE t1; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 633278a9781..520bf9426b8 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3618,6 +3618,30 @@ ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default val set @@sql_mode=@old_mode; drop view v1; drop table t1; +create table t1 (a int, key(a)); +create table t2 (c int); +create view v1 as select a b from t1; +create view v2 as select 1 a from t2, v1 where c in +(select 1 from t1 where b = a); +insert into t1 values (1), (1); +insert into t2 values (1), (1); +prepare stmt from "select * from v2 where a = 1"; +execute stmt; +a +1 +1 +1 +1 +drop view v1, v2; +drop table t1, t2; +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q; +INSERT INTO t1 VALUES (1), (1); +SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a; +MAX(a) COUNT(DISTINCT a) +1 1 +DROP VIEW v1; +DROP TABLE t1; # ----------------------------------------------------------------- # -- Bug#34337: Server crash when Altering a view using a table name. # ----------------------------------------------------------------- diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 9ce1f9c825d..e74f92205aa 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -298,4 +298,42 @@ DROP TABLE t3; DROP PROCEDURE sp1; DROP PROCEDURE sp2; DROP PROCEDURE sp3; +create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext); +create table t2 (c_tinyblob tinyblob); +set @c = repeat(' ', 256); +set @q = repeat('q', 256); +set sql_mode = ''; +insert into t1 values(@c, @c, @c); +Warnings: +Note 1265 Data truncated for column 'c_char' at row 1 +Note 1265 Data truncated for column 'c_varchar' at row 1 +Note 1265 Data truncated for column 'c_tinytext' at row 1 +insert into t2 values(@c); +Warnings: +Warning 1265 Data truncated for column 'c_tinyblob' at row 1 +insert into t1 values(@q, @q, @q); +Warnings: +Warning 1265 Data truncated for column 'c_char' at row 1 +Warning 1265 Data truncated for column 'c_varchar' at row 1 +Warning 1265 Data truncated for column 'c_tinytext' at row 1 +insert into t2 values(@q); +Warnings: +Warning 1265 Data truncated for column 'c_tinyblob' at row 1 +set sql_mode = 'traditional'; +insert into t1 values(@c, @c, @c); +Warnings: +Note 1265 Data truncated for column 'c_char' at row 1 +Note 1265 Data truncated for column 'c_varchar' at row 1 +Note 1265 Data truncated for column 'c_tinytext' at row 1 +insert into t2 values(@c); +ERROR 22001: Data too long for column 'c_tinyblob' at row 1 +insert into t1 values(@q, NULL, NULL); +ERROR 22001: Data too long for column 'c_char' at row 1 +insert into t1 values(NULL, @q, NULL); +ERROR 22001: Data too long for column 'c_varchar' at row 1 +insert into t1 values(NULL, NULL, @q); +ERROR 22001: Data too long for column 'c_tinytext' at row 1 +insert into t2 values(@q); +ERROR 22001: Data too long for column 'c_tinyblob' at row 1 +drop table t1, t2; End of 5.0 tests diff --git a/mysql-test/t/binlog_innodb.test b/mysql-test/t/binlog_innodb.test index 2da7b2b0895..47b09719ef5 100644 --- a/mysql-test/t/binlog_innodb.test +++ b/mysql-test/t/binlog_innodb.test @@ -37,3 +37,28 @@ show status like "binlog_cache_disk_use"; drop table t1; +# +# Bug #30604: different flagging of time_zone_used in normal and ps-protocol +# + +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB; + +DELIMITER |; +# the function does not deal with time objects +CREATE FUNCTION bug23333() +RETURNS int(11) +DETERMINISTIC +BEGIN + INSERT INTO t1 VALUES (NULL); + SELECT COUNT(*) FROM t1 INTO @a; + RETURN @a; +END| + +DELIMITER ;| + +INSERT INTO t2 VALUES (2),(10+bug23333()); +--replace_column 1 # +SHOW MASTER STATUS; +DROP FUNCTION bug23333; +DROP TABLE t1, t2; diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test index 337035a8095..8863ed825c2 100644 --- a/mysql-test/t/compare.test +++ b/mysql-test/t/compare.test @@ -46,3 +46,34 @@ insert into t1 values (0x01,0x01); select * from t1 where a=b; select * from t1 where a=b and b=0x01; drop table if exists t1; + +# +# Bug #31887: DML Select statement not returning same results when executed +# in version 5 +# + +CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill); +INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2); + +SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1; + +EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; +SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; + +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES (1),(2); + +SELECT a, + (SELECT COUNT(*) FROM t1 + WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x +FROM t2 ORDER BY a; + +EXPLAIN EXTENDED +SELECT a, + (SELECT COUNT(*) FROM t1 + WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x +FROM t2 ORDER BY a; + +DROP TABLE t1,t2; + +--echo End of 5.0 tests diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 64081c0248a..97a7ea71b29 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1148,4 +1148,28 @@ create table t2 select sql_big_result f1,count(f2) from t1 group by f1; show status like 'handler_read%'; drop table t1,t2; +# +# Bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs on table creates +# + +# Show that the old syntax for index type is supported +CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1)); +DROP TABLE t1; + +# Show that the new syntax for index type is supported +CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE); +DROP TABLE t1; + +# Show that in case of multiple index type definitions, the last one takes +# precedence + +CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY; +SHOW INDEX FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY; +SHOW INDEX FROM t1; +DROP TABLE t1; + + --echo End of 5.0 tests diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 84c286e516b..87632fbdbb8 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -640,4 +640,21 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1; DROP TABLE t1, t2, t3; +# +# Bug #34747: crash in debug assertion check after derived table +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (),(); +SELECT s1.d1 FROM +( + SELECT + t1.a as d1, + GROUP_CONCAT(DISTINCT t1.a) AS d2 + FROM + t1 AS t1, + t1 AS t2 + GROUP BY 1 +) AS s1; +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index ccb59df5677..17c147f7193 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -205,6 +205,24 @@ SELECT NAME_CONST('test', -1.0); SELECT NAME_CONST('test', 'test'); # +# Bug #34749: Server crash when using NAME_CONST() with an aggregate function +# + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +# NAME_CONST() + aggregate. +SELECT NAME_CONST('flag',1) * MAX(a) FROM t1; +SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1; +# Now, wrap the INT_ITEM in Item_func_neg and watch the pretty explosions +SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1; +SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1; +--error ER_WRONG_ARGUMENTS +SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1; +--error ER_WRONG_ARGUMENTS +SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1; +DROP TABLE t1; + +# # Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter # resolved against a column name of a derived table hangs the client # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index b0f47e0ad56..ef22adb4251 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -336,7 +336,7 @@ select date_add(date,INTERVAL "1" QUARTER) from t1; select timestampadd(MINUTE, 1, date) from t1; select timestampadd(WEEK, 1, date) from t1; select timestampadd(SQL_TSI_SECOND, 1, date) from t1; -# Prepared statements doesn't support FRAC_SECOND yet +# mysqltest.c discards an expected 'deprecated' warning on prepare stage --disable_ps_protocol select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1; --enable_ps_protocol @@ -351,7 +351,10 @@ select timestampdiff(SQL_TSI_HOUR, '2001-02-01', '2001-05-01') as a; select timestampdiff(SQL_TSI_DAY, '2001-02-01', '2001-05-01') as a; select timestampdiff(SQL_TSI_MINUTE, '2001-02-01 12:59:59', '2001-05-01 12:58:59') as a; select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a; +# mysqltest.c discards an expected 'deprecated' warning on prepare stage +--disable_ps_protocol select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a; +--enable_ps_protocol select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1, timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2, @@ -804,4 +807,26 @@ select DATE_ADD(20071108, INTERVAL 1 DAY); select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND; +# +# Bug#33834: FRAC_SECOND: Applicability not clear in documentation +# +# Show that he use of FRAC_SECOND, for anything other than +# TIMESTAMPADD / TIMESTAMPDIFF, is a server error. + +# mysqltest.c discards an expected 'deprecated' warning on prepare stage +--disable_ps_protocol +SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18'); +SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18'); +--enable_ps_protocol + +--error ER_PARSE_ERROR +SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND); +--error ER_PARSE_ERROR +SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND); + +--error ER_PARSE_ERROR +SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND; +--error ER_PARSE_ERROR +SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND; + --echo End of 5.0 tests diff --git a/mysql-test/t/grant3.test b/mysql-test/t/grant3.test index fac577ef0ff..8eceb851c29 100644 --- a/mysql-test/t/grant3.test +++ b/mysql-test/t/grant3.test @@ -134,3 +134,29 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by DROP USER CUser2@localhost; DROP USER CUser2@LOCALHOST; + + +# +# Bug#31194: Privilege ordering does not order properly for wildcard values +# + +CREATE DATABASE mysqltest_1; +CREATE TABLE mysqltest_1.t1 (a INT); +CREATE USER 'mysqltest1'@'%'; +GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%'; +REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%'; +GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%'; +FLUSH PRIVILEGES; + +connect (conn1,localhost,mysqltest1,,); +connection conn1; +SHOW GRANTS; +SELECT * FROM mysqltest_1.t1; +disconnect conn1; + +connection default; +DROP USER 'mysqltest1'@'%'; +DROP DATABASE mysqltest_1; + + +--echo End of 5.0 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 020295684b0..59ee7c274bb 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -982,4 +982,18 @@ desc t1; show create table t1; drop table t1; + +# +# Bug #34223: Assertion failed: (optp->var_type & 127) == 8, +# file .\my_getopt.c, line 830 +# + +set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment; +set global innodb_autoextend_increment=8; +set global innodb_autoextend_increment=@my_innodb_autoextend_increment; + +set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency; +set global innodb_commit_concurrency=0; +set global innodb_commit_concurrency=@my_innodb_commit_concurrency; + --echo End of 5.0 tests diff --git a/mysql-test/t/mysqldump-no-binlog-master.opt b/mysql-test/t/mysqldump-no-binlog-master.opt new file mode 100644 index 00000000000..789275fa25e --- /dev/null +++ b/mysql-test/t/mysqldump-no-binlog-master.opt @@ -0,0 +1 @@ +--skip-log-bin diff --git a/mysql-test/t/mysqldump-no-binlog.test b/mysql-test/t/mysqldump-no-binlog.test new file mode 100644 index 00000000000..434b2931792 --- /dev/null +++ b/mysql-test/t/mysqldump-no-binlog.test @@ -0,0 +1,6 @@ +# Embedded server doesn't support external clients +--source include/not_embedded.inc + +--replace_regex /MASTER_LOG_POS=[0-9]+/XX/ +--error 2 +--exec $MYSQL_DUMP --compact --master-data=2 test 2>&1 diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index e15aec01d2a..1400c643203 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -240,3 +240,26 @@ SHOW STATUS LIKE "handler_read%"; DROP TABLE t1,t2,t3,t4; # End of 4.1 tests + +# +# BUG#34945 "ref_or_null queries that are null_rejecting and have a null value crash mysql" +# +CREATE TABLE t1 ( + a int(11) default NULL, + b int(11) default NULL, + KEY a (a,b) +); +INSERT INTO t1 VALUES (0,10),(0,11),(0,12); + +CREATE TABLE t2 ( + a int(11) default NULL, + b int(11) default NULL, + KEY a (a) +); +INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12); + +SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b; + +drop table t1, t2; +-- echo End of 5.0 tests + diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 29a290c7fbf..9a55c27df99 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -726,3 +726,15 @@ SELECT a, b FROM t1 ORDER BY b DESC; SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC; DROP TABLE t1; + +--echo # +--echo # Bug#31590: Wrong error message on sort buffer being too small. +--echo # +create table t1(a int, b tinytext); +insert into t1 values (1,2),(3,2); +set session sort_buffer_size= 30000; +set session max_sort_length= 2180; +--error 1038 +select * from t1 order by b; +drop table t1; + diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 87ba3510326..1352b366508 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -955,4 +955,21 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= ' drop table t1; +# +# Bug #33833: different or-ed predicates were erroneously merged into one that +# resulted in ref access instead of range access and a wrong result set +# + +CREATE TABLE t1 ( + a varchar(32), index (a) +) DEFAULT CHARSET=latin1 COLLATE=latin1_bin; + +INSERT INTO t1 VALUES + ('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A'); + +SELECT a FROM t1 WHERE a='b' OR a='B'; +EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; + +DROP TABLE t1; + # End of 5.0 tests diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 20d044306a6..1601f7afd0e 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -224,3 +224,16 @@ SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7)); SELECT @x; DROP TABLE t1; + +# +# Bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*): +# Assertion `0' failed +# + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1); + +SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a; +SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a; + +DROP TABLE t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index c48f2771aa8..1ee87957643 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3672,4 +3672,33 @@ DROP TABLE t1; --echo +########################################################################### + +# +# Bug #33764: Wrong result with IN(), CONCAT() and implicit type conversion +# + +CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY); +INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0'); +SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar'); +DROP TABLE t1; + +# +# Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan" +# + +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (a INT, c INT, KEY(a)); + +INSERT INTO t1 VALUES (1, 1), (2, 2); +INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), + (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), + (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), + (4, 1), (4, 2), (4, 3), (4, 4), (4, 5); + +FLUSH STATUS; +SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3; +SHOW STATUS LIKE 'Handler_read%'; +DROP TABLE t1, t2; + --echo End of 5.0 tests diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index a2d2f959663..48ef51e09aa 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -7774,6 +7774,25 @@ call proc_33618(20); drop table t_33618; drop procedure proc_33618; +--echo # +--echo # Bug#30787: Stored function ignores user defined alias. +--echo # +use test; +--disable_warnings +drop function if exists func30787; +--enable_warnings +create table t1(f1 int); +insert into t1 values(1),(2); +delimiter |; +create function func30787(p1 int) returns int +begin + return p1; +end | +delimiter ;| +select (select func30787(f1)) as ttt from t1; +drop function func30787; +drop table t1; + --echo # ------------------------------------------------------------------ --echo # -- End of 5.0 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 326d80f84c1..c5edd5414e3 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3006,92 +3006,44 @@ DROP TABLE t1,t2; create table t1(a int,b int,key(a),key(b)); insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5), (6,7),(7,4),(5,3); -# test for the stack overflow bug -select sum(a),a from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 - )group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1) -group by a; ---replace_regex /overrun.*$/overrun detected/ ---error 1436 -select sum(a),a from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -# test for the memory consumption & subquery slowness bug -explain select sum(a),a from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 - )group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1) -group by a; ---replace_regex /overrun.*$/overrun detected/ ---error 1436 -explain select sum(a),a from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( - select sum(a) from t1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1 - )group by b limit 1)group by b limit 1)group by b limit 1) -group by a; + +let $nesting= 26; +let $should_work_nesting= 5; +let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ; +let $end= )group by a ; +let $start_app= where a> ( select sum(a) from t1 ; +let $end_pre= )group by b limit 1 ; + +--disable_result_log +--disable_query_log +# At least 4 level nesting should work without errors +while ($should_work_nesting) +{ +--echo $should_work_nesting + eval $start $end; + eval explain $start $end; + let $start= $start + $start_app; + let $end= $end_pre + $end; + dec $should_work_nesting; +} +# Other may fail with the 'stack overrun error' +while ($nesting) +{ +--echo $nesting +--error 0,1436 + eval $start $end; +--error 0,1436 + eval explain $start $end; + let $start= $start + $start_app; + let $end= $end_pre + $end; + dec $nesting; +} +--enable_result_log +--enable_query_log drop table t1; # diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 7eaeaa00c0a..10d8f355c98 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -127,29 +127,22 @@ drop table t1; # # BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE # +--write_file $MYSQLTEST_VARDIR/tmp/t1.MYI +EOF --replace_result $MYSQLTEST_VARDIR TEST_DIR +--error 1 eval CREATE TABLE t1(a INT) -DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql' -INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'; +DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' +INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp'; +--replace_result $MYSQLTEST_VARDIR TEST_DIR +eval CREATE TABLE t2(a INT) +DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' +INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp'; --replace_result $MYSQLTEST_VARDIR TEST_DIR --error 1 -RENAME TABLE t1 TO user; -DROP TABLE t1; - -# -# Test specifying DATA DIRECTORY that is the same as what would normally -# have been chosen. (Bug #8707) -# -disable_query_log; -eval create table t1 (i int) data directory = "$MYSQLTEST_VARDIR/master-data/test/"; -enable_query_log; -show create table t1; -drop table t1; -disable_query_log; -eval create table t1 (i int) index directory = "$MYSQLTEST_VARDIR/master-data/test/"; -enable_query_log; -show create table t1; -drop table t1; +RENAME TABLE t2 TO t1; +DROP TABLE t2; +--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI # # Bug#8706 - temporary table with data directory option fails @@ -188,44 +181,61 @@ connection default; select * from t1; drop table t1; ---echo End of 4.1 tests - # -# Bug #29325: create table overwrites .MYD file of other table (datadir) +# CREATE TABLE with DATA DIRECTORY option # - -CREATE DATABASE db1; -CREATE DATABASE db2; - -USE db2; +# Protect ourselves from data left in tmp/ by a previos possibly failed +# test +--system rm -f $MYSQLTEST_VARDIR/tmp/t1.* --disable_query_log -eval CREATE TABLE t1 (b INT) ENGINE MYISAM -DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/db1/'; +eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; --enable_query_log +execute stmt; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show create table t1; +drop table t1; +execute stmt; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +show create table t1; +drop table t1; +deallocate prepare stmt; -INSERT INTO db2.t1 VALUES (1); -SELECT * FROM db2.t1; -RESET QUERY CACHE; +# +# Bug#32167 another privilege bypass with DATA/INDEX DIRECORY +# +--replace_result $MYSQL_TEST_DIR TEST_DIR +--error 1,1210 +eval CREATE TABLE t1(a INT) +DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/test'; +--replace_result $MYSQL_TEST_DIR TEST_DIR +--error 1,1210 +eval CREATE TABLE t1(a INT) +DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/'; +--replace_result $MYSQL_TEST_DIR TEST_DIR +--error 1,1210 +eval CREATE TABLE t1(a INT) +INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data'; +--replace_result $MYSQL_TEST_DIR TEST_DIR +--error 1,1210 +eval CREATE TABLE t1(a INT) +INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data_var'; -USE db1; +--echo End of 4.1 tests -#no warning from create table +# +# Bug #29325: create table overwrites .MYD file of other table (datadir) +# SET SESSION keep_files_on_create = TRUE; +--write_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD +EOF --disable_abort_on_error +--error 1 CREATE TABLE t1 (a INT) ENGINE MYISAM; +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD; --enable_abort_on_error - -CREATE TABLE t3 (a INT) Engine=MyISAM; -INSERT INTO t3 VALUES (1),(2),(3); -TRUNCATE TABLE t3; -SELECT * from t3; - -SET SESSION keep_files_on_create = DEFAULT; - -DROP TABLE db2.t1, db1.t3; -DROP DATABASE db1; -DROP DATABASE db2; -USE test; - +SET SESSION keep_files_on_create = FALSE; +CREATE TABLE t1 (a INT) ENGINE MYISAM; +DROP TABLE t1; --echo End of 5.0 tests diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test index 95533903b45..5ac93f09ac1 100644 --- a/mysql-test/t/tablelock.test +++ b/mysql-test/t/tablelock.test @@ -49,3 +49,16 @@ drop table t2,t1; unlock tables; # End of 4.1 tests + +# +# Bug#23588 SHOW COLUMNS on a temporary table causes locking issues +# +create temporary table t1(f1 int); +lock tables t1 write; +insert into t1 values (1); +show columns from t1; +insert into t1 values(2); +drop table t1; +unlock tables; + +# End of 5.0 tests diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index b1c816f3371..c7f8c59de28 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -56,3 +56,23 @@ set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17', '50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1')); show create table t1; drop table t1; + +# +# Bug#15409: Columns with SET datatype with 64-element sets +# may not be updated with integers +# + +let $i=64; +let $s='$i'; +dec $i; +while ($i) { + let $s='$i',$s; + dec $i; +} +--eval CREATE TABLE t1(c set($s)) +INSERT INTO t1 VALUES(7); +INSERT INTO t1 VALUES(9223372036854775808); +SELECT * FROM t1; +DROP TABLE t1; + +--# echo End of 5.0 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 5a87128f69e..23e64b0546f 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3471,6 +3471,40 @@ set @@sql_mode=@old_mode; drop view v1; drop table t1; +# +# Bug #33389: Selecting from a view into a table from within SP or trigger +# crashes server +# + +create table t1 (a int, key(a)); +create table t2 (c int); + +create view v1 as select a b from t1; +create view v2 as select 1 a from t2, v1 where c in + (select 1 from t1 where b = a); + +insert into t1 values (1), (1); +insert into t2 values (1), (1); + +prepare stmt from "select * from v2 where a = 1"; +execute stmt; + +drop view v1, v2; +drop table t1, t2; + +# +# Bug #33049: Assert while running test-as3ap test(mysql-bench suite) +# + +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q; + +INSERT INTO t1 VALUES (1), (1); +SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a; + +DROP VIEW v1; +DROP TABLE t1; + ########################################################################### --echo # ----------------------------------------------------------------- diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 5e9d25aa09b..c42dd22024c 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -212,4 +212,37 @@ DROP PROCEDURE sp1; DROP PROCEDURE sp2; DROP PROCEDURE sp3; + +# +# Bug#30059: End-space truncation warnings are inconsistent or incorrect +# + +create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext); +create table t2 (c_tinyblob tinyblob); # not affected by bug, for regression testing +set @c = repeat(' ', 256); +set @q = repeat('q', 256); + +set sql_mode = ''; + +insert into t1 values(@c, @c, @c); +insert into t2 values(@c); +insert into t1 values(@q, @q, @q); +insert into t2 values(@q); + +set sql_mode = 'traditional'; + +insert into t1 values(@c, @c, @c); +--error 1406 +insert into t2 values(@c); +--error 1406 +insert into t1 values(@q, NULL, NULL); +--error 1406 +insert into t1 values(NULL, @q, NULL); +--error 1406 +insert into t1 values(NULL, NULL, @q); +--error 1406 +insert into t2 values(@q); + +drop table t1, t2; + --echo End of 5.0 tests |