diff options
Diffstat (limited to 'mysql-test/t')
40 files changed, 1287 insertions, 72 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 98ae90ce13c..57e2b7e1a5b 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1088,4 +1088,16 @@ ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL; --disable_info DROP TABLE t1; + +--echo # +--echo # Bug #31145: ALTER TABLE DROP COLUMN, ADD COLUMN crashes (linux) +--echo # or freezes (win) the server +--echo # + +CREATE TABLE t1 (a TEXT, id INT, b INT); +ALTER TABLE t1 DROP COLUMN a, ADD COLUMN c TEXT FIRST; + +DROP TABLE t1; + + --echo End of 5.1 tests diff --git a/mysql-test/t/bug46080.test b/mysql-test/t/bug46080.test index 8b4cee4d8b0..ed4a16fdf51 100644 --- a/mysql-test/t/bug46080.test +++ b/mysql-test/t/bug46080.test @@ -3,8 +3,8 @@ --echo # sort_buffer_size cannot allocate --echo # -call mtr.add_suppression("Out of memory at line .*, 'my_alloc.c'"); -call mtr.add_suppression("needed .* byte .*k., memory in use: .* bytes .*k"); +call mtr.add_suppression("Out of memory at line .*, '.*my_alloc.c'"); +call mtr.add_suppression("needed .* byte (.*k)., memory in use: .* bytes (.*k)"); CREATE TABLE t1(a CHAR(255)); INSERT INTO t1 VALUES ('a'); diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test index e63bdabdb95..d0996689aeb 100644 --- a/mysql-test/t/count_distinct.test +++ b/mysql-test/t/count_distinct.test @@ -35,6 +35,25 @@ insert into t1 values ('NYC Lib','New York'); select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname; select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1; select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1; + +select t2.isbn,city,@bar:=t1.libname,count(distinct t1.libname) as a + from t3 left join t1 on t3.libname=t1.libname left join t2 + on t3.isbn=t2.isbn group by city having count(distinct + t1.libname) > 1; +# +# Wrong result, see bug#49872 +# +SELECT @bar; + +select t2.isbn,city,concat(@bar:=t1.libname),count(distinct t1.libname) as a + from t3 left join t1 on t3.libname=t1.libname left join t2 + on t3.isbn=t2.isbn group by city having count(distinct + t1.libname) > 1; +# +# Wrong result, see bug#49872 +# +SELECT @bar; + drop table t1, t2, t3; # diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 57f4c82df87..f3cd48af543 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -721,16 +721,15 @@ drop table t1; # Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent # results of CREATE TABLE ... SELECT when temporary table exists"). # In this situation we either have to create non-temporary table and -# insert data in it or insert data in temporary table without creation -# of permanent table. Since currently temporary tables always shadow -# permanent tables we adopt second approach. +# insert data in it or insert data in temporary table without creation of +# permanent table. After patch for Bug#47418, we create the base table and +# instert data into it, even though a temporary table exists with the same +# name. create temporary table t1 (j int); create table if not exists t1 select 1; select * from t1; drop temporary table t1; ---error ER_NO_SUCH_TABLE select * from t1; ---error ER_BAD_TABLE_ERROR drop table t1; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index be1ca63d9e9..6f1a3cafecd 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -15,6 +15,16 @@ SET character_set_connection=ucs2; SET CHARACTER SET koi8r; # +# BUG#49028, error in LIKE with ucs2 +# +create table t1 (a varchar(2) character set ucs2 collate ucs2_bin, key(a)); +insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t'); +insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ'); +select hex(a) from t1 where a like 'A_' order by a; +select hex(a) from t1 ignore key(a) where a like 'A_' order by a; +drop table t1; + +# # Check that 0x20 is only trimmed when it is # a part of real SPACE character, not just a part # of a multibyte sequence. diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index e222bc6b836..2d90969202c 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1449,6 +1449,16 @@ select hex(_utf8 B'001111111111'); --error ER_INVALID_CHARACTER_STRING select (_utf8 X'616263FF'); +--echo # +--echo # Bug#44131 Binary-mode "order by" returns records in incorrect order for UTF-8 strings +--echo # +CREATE TABLE t1 (id int not null primary key, name varchar(10)) character set utf8; +INSERT INTO t1 VALUES +(2,'一二三01'),(3,'一二三09'),(4,'一二三02'),(5,'一二三08'), +(6,'一二三11'),(7,'一二三91'),(8,'一二三21'),(9,'一二三81'); +SELECT * FROM t1 ORDER BY BINARY(name); +DROP TABLE t1; + # # Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results # diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index a5dff38c078..2f51fafd6a6 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -357,4 +357,21 @@ END | --error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG DELETE IGNORE FROM t1; -DROP TABLE t1;
\ No newline at end of file +DROP TABLE t1; + + +--echo # +--echo # Bug #49552 : sql_buffer_result cause crash + not found records +--echo # in multitable delete/subquery +--echo # + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SET SESSION SQL_BUFFER_RESULT=1; +DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1; + +SET SESSION SQL_BUFFER_RESULT=DEFAULT; +SELECT * FROM t1; +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 06d3dbb4e57..07462e91696 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,4 +11,3 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -rpl_killed_ddl : Bug#45520: rpl_killed_ddl fails sporadically in pb2 diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 11690e61476..4df910d366b 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -497,6 +497,27 @@ EXECUTE s; DEALLOCATE PREPARE s; DROP TABLE t1; + +--echo # +--echo # Bug #49250 : spatial btree index corruption and crash +--echo # Part two : fulltext syntax check +--echo # + +--error ER_PARSE_ERROR +CREATE TABLE t1(col1 TEXT, + FULLTEXT INDEX USING BTREE (col1)); +CREATE TABLE t2(col1 TEXT); +--error ER_PARSE_ERROR +CREATE FULLTEXT INDEX USING BTREE ON t2(col); +--error ER_PARSE_ERROR +ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1); + +DROP TABLE t2; + + +--echo End of 5.0 tests + + --echo # --echo # Bug #47930: MATCH IN BOOLEAN MODE returns too many results --echo # inside subquery @@ -536,4 +557,14 @@ SELECT count(*) FROM t1 WHERE DROP TABLE t1,t2,t3; +--echo # +--echo # Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with +--echo # fulltext search and row op +--echo # + +CREATE TABLE t1(a CHAR(1),FULLTEXT(a)); +SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1); +DROP TABLE t1; + + --echo End of 5.1 tests diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test index 074aefbf943..814cd4a5954 100644 --- a/mysql-test/t/fulltext_order_by.test +++ b/mysql-test/t/fulltext_order_by.test @@ -80,7 +80,7 @@ CREATE TABLE t3 ( FULLTEXT KEY betreff (betreff) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=996 ; ---error 1054 +--error ER_CANT_USE_OPTION_HERE select a.text, b.id, b.betreff from t2 a inner join t3 b on a.id = b.forum inner join @@ -100,7 +100,7 @@ group by order by match(b.betreff) against ('+abc' in boolean mode) desc; ---error 1054 +--error ER_CANT_USE_OPTION_HERE select a.text, b.id, b.betreff from t2 a inner join t3 b on a.id = b.forum inner join @@ -117,6 +117,7 @@ where order by match(b.betreff) against ('+abc' in boolean mode) desc; +--error ER_CANT_USE_OPTION_HERE select a.text, b.id, b.betreff from t2 a inner join t3 b on a.id = b.forum inner join diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index 1c7e5823fb2..e24b4354b61 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -4,6 +4,7 @@ --disable_warnings DROP TABLE IF EXISTS t1; +DROP PROCEDURE IF EXISTS p1; --enable_warnings CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL ); @@ -111,4 +112,16 @@ EXPLAIN SELECT CONCAT('gui_', t2.a), t1.d FROM t2 DROP TABLE t1, t2; +--echo # +--echo # Bug #50096: CONCAT_WS inside procedure returning wrong data +--echo # + +CREATE PROCEDURE p1(a varchar(255), b int, c int) + SET @query = CONCAT_WS(",", a, b, c); + +CALL p1("abcde", "0", "1234"); +SELECT @query; + +DROP PROCEDURE p1; + --echo # End of 5.1 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 66b9eabd385..8942b0a2faf 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1318,3 +1318,37 @@ insert into t1 values (-1),(null); explain select 1 as a from t1,(select decode(f1,f1) as b from t1) a; explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a; drop table t1; + +--echo # +--echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0 +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a VARCHAR(20), b INT); +CREATE TABLE t2 (a VARCHAR(20), b INT); + +INSERT INTO t1 VALUES ('ABC', 1); +INSERT INTO t2 VALUES ('ABC', 1); + +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) + FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; + +SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) + FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; + +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') + FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; + +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; + +INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); +INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); + +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) + FROM t2 WHERE t2.b = 1 GROUP BY t2.b; + +DROP TABLE t1, t2; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 2d10c3bf1e1..bc0695aaa93 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -670,6 +670,21 @@ SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); DROP TABLE t1; +--echo # +--echo # Bug #49250 : spatial btree index corruption and crash +--echo # Part one : spatial syntax check +--echo # + +--error ER_PARSE_ERROR +CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL, + SPATIAL INDEX USING BTREE (col1)); +CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL); +--error ER_PARSE_ERROR +CREATE SPATIAL INDEX USING BTREE ON t2(col); +--error ER_PARSE_ERROR +ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1); + +DROP TABLE t2; --echo End of 5.0 tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 1298bb89754..11d87d93ac0 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1386,6 +1386,33 @@ SET TIMESTAMP=@@TIMESTAMP + 10000000; SELECT 'NOT_OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0; SET TIMESTAMP=DEFAULT; + +--echo # +--echo # Bug #50276: Security flaw in INFORMATION_SCHEMA.TABLES +--echo # +CREATE DATABASE db1; +USE db1; +CREATE TABLE t1 (id INT); +CREATE USER nonpriv; +USE test; + +connect (nonpriv_con, localhost, nonpriv,,); +connection nonpriv_con; +--echo # connected as nonpriv +--echo # Should return 0 +SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +USE INFORMATION_SCHEMA; +--echo # Should return 0 +SELECT COUNT(*) FROM TABLES WHERE TABLE_NAME='t1'; + +connection default; +--echo # connected as root +disconnect nonpriv_con; +DROP USER nonpriv; +DROP TABLE db1.t1; +DROP DATABASE db1; + + --echo End of 5.1 tests. # Wait till all disconnects are completed diff --git a/mysql-test/t/innodb-autoinc-44030.test b/mysql-test/t/innodb-autoinc-44030.test new file mode 100644 index 00000000000..2524ceb4009 --- /dev/null +++ b/mysql-test/t/innodb-autoinc-44030.test @@ -0,0 +1,40 @@ +-- source include/have_innodb.inc +# embedded server ignores 'delayed', so skip this +-- source include/not_embedded.inc + +let $file_format_check=`select @@innodb_file_format_check`; + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from +# the index (PRIMARY) +# This test requires a restart of the server +SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; +CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (null); +INSERT INTO t1 VALUES (null); +ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; +SELECT * FROM t1; +# Restart the server +-- source include/restart_mysqld.inc +# The MySQL and InnoDB data dictionaries should now be out of sync. +# The select should print message to the error log +SELECT * FROM t1; +# MySQL have made a change (http://lists.mysql.com/commits/75268) that no +# longer results in the two data dictionaries being out of sync. If they +# revert their changes then this check for ER_AUTOINC_READ_FAILED will need +# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621. +-- error ER_AUTOINC_READ_FAILED,1467 +INSERT INTO t1 VALUES(null); +ALTER TABLE t1 AUTO_INCREMENT = 3; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES(null); +SELECT * FROM t1; +DROP TABLE t1; + +--disable_query_log +EVAL SET GLOBAL innodb_file_format_check=$file_format_check; +--enable_query_log diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test index 16b456e5bfb..37ca1e5a2ab 100644 --- a/mysql-test/t/innodb-autoinc.test +++ b/mysql-test/t/innodb-autoinc.test @@ -480,32 +480,6 @@ INSERT INTO t2 SELECT c1 FROM t1; INSERT INTO t2 SELECT NULL FROM t1; DROP TABLE t1; DROP TABLE t2; -# -# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from -# the index (PRIMARY) -# This test requires a restart of the server -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (null); -INSERT INTO t1 VALUES (null); -ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; -SELECT * FROM t1; -# Restart the server --- source include/restart_mysqld.inc -# The MySQL and InnoDB data dictionaries should now be out of sync. -# The select should print message to the error log -SELECT * FROM t1; -# MySQL have made a change (http://lists.mysql.com/commits/75268) that no -# longer results in the two data dictionaries being out of sync. If they -# revert their changes then this check for ER_AUTOINC_READ_FAILED will need -# to be enabled. --- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 VALUES(null); -ALTER TABLE t1 AUTO_INCREMENT = 3; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES(null); -SELECT * FROM t1; -DROP TABLE t1; # If the user has specified negative values for an AUTOINC column then # InnoDB should ignore those values when setting the table's max value. @@ -616,30 +590,30 @@ DROP TABLE t1; # 47125: auto_increment start value is ignored if an index is created # and engine=innodb # -CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; -CREATE INDEX i1 on T1(c2); -SHOW CREATE TABLE T1; -INSERT INTO T1 (c2) values (0); -SELECT * FROM T1; -DROP TABLE T1; +CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; +CREATE INDEX i1 on t1(c2); +SHOW CREATE TABLE t1; +INSERT INTO t1 (c2) values (0); +SELECT * FROM t1; +DROP TABLE t1; ## # 49032: Use the correct function to read the AUTOINC column value # -CREATE TABLE T1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; -INSERT INTO T1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); # Restart the server -- source include/restart_mysqld.inc -INSERT INTO T1(C2) VALUES ('innodb'); -SHOW CREATE TABLE T1; -DROP TABLE T1; -CREATE TABLE T1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; -INSERT INTO T1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB; +INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb'); # Restart the server -- source include/restart_mysqld.inc -INSERT INTO T1(C2) VALUES ('innodb'); -SHOW CREATE TABLE T1; -DROP TABLE T1; +INSERT INTO t1(C2) VALUES ('innodb'); +SHOW CREATE TABLE t1; +DROP TABLE t1; ## # 47720: REPLACE INTO Autoincrement column with negative values diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 35aec71ebb8..aeaa69657c6 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -867,3 +867,32 @@ SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL; DROP TABLE t1,t2; +--echo # +--echo # Bug#47650: using group by with rollup without indexes returns incorrect +--echo # results with where +--echo # +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 ( a INT, b INT ); +INSERT INTO t2 VALUES (1, 1),(1, 2),(1, 3),(2, 4),(2, 5); + +EXPLAIN +SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) +FROM t1 LEFT JOIN t2 USING( a ) +GROUP BY t1.a WITH ROLLUP; + +SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) +FROM t1 LEFT JOIN t2 USING( a ) +GROUP BY t1.a WITH ROLLUP; + +EXPLAIN +SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) +FROM t1 JOIN t2 USING( a ) +GROUP BY t1.a WITH ROLLUP; + +SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b ) +FROM t1 JOIN t2 USING( a ) +GROUP BY t1.a WITH ROLLUP; + +DROP TABLE t1, t2; diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 47b5aa0292b..4df1a0f3478 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -626,9 +626,11 @@ let $wait_condition= --source include/wait_condition.inc let $tlwb= `show status like 'Table_locks_waited'`; unlock tables; +connection waiter; +--reap +connection default; drop table t1; disconnect waiter; -connection default; --disable_query_log eval SET @tlwa= SUBSTRING_INDEX('$tlwa', ' ', -1); eval SET @tlwb= SUBSTRING_INDEX('$tlwb', ' ', -1); diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 41445cea8ce..e1982a623da 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1190,6 +1190,20 @@ SELECT a FROM t1; CHECK TABLE t1; DROP TABLE t1; + +--echo # +--echo # Bug #49465: valgrind warnings and incorrect live checksum... +--echo # +CREATE TABLE t1( +a VARCHAR(1), b VARCHAR(1), c VARCHAR(1), +f VARCHAR(1), g VARCHAR(1), h VARCHAR(1), +i VARCHAR(1), j VARCHAR(1), k VARCHAR(1)) CHECKSUM=1; +INSERT INTO t1 VALUES('', '', '', '', '', '', '', '', ''); +CHECKSUM TABLE t1 QUICK; +CHECKSUM TABLE t1 EXTENDED; +DROP TABLE t1; + + --echo End of 5.0 tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 6728877fb40..9df25d8e084 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -408,5 +408,10 @@ insert into t1 values ('\0b\0'); --exec $MYSQL --xml test -e "select a from t1" drop table t1; +--echo +--echo Bug #47147: mysql client option --skip-column-names does not apply to vertical output +--echo +--exec $MYSQL --skip-column-names --vertical test -e "select 1 as a" ---echo End of 5.0 tests +--echo +--echo End of tests diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 5ee1f2cccba..87457c36382 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -90,3 +90,22 @@ DROP USER mysqltest1@'%'; set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; --exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 eval set GLOBAL sql_mode=default; + + +--echo # +--echo # Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table +--echo # but does not set values. +--echo # + +# Create a stored procedure and set the fields in question to null. +# When running mysql_upgrade, a warning should be written. + +CREATE PROCEDURE testproc() BEGIN END; +UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc'; +UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc'; +UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc'; +--exec $MYSQL_UPGRADE --skip-verbose --force 2> $MYSQLTEST_VARDIR/tmp/41569.txt +CALL testproc(); +DROP PROCEDURE testproc; +--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt +--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 78661b1bbc4..687ad62b17c 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -71,7 +71,7 @@ select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=330 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=332 $MYSQLD_DATADIR/master-bin.000002 # These are tests for remote binlog. @@ -108,7 +108,7 @@ select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=330 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=332 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 mysqlbinlog does not accept input from stdin --disable_query_log diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index c0c75f08209..8ca70258bc0 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -15,10 +15,8 @@ insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA"; -grant select on test.* to ssl_user3@localhost require cipher -"DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@askmonty.org"; -grant select on test.* to ssl_user4@localhost require cipher -"DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@askmonty.org" ISSUER "/C=FI/ST=Tuusula/O=Monty Program Ab/emailAddress=abstract.developer@askmonty.org"; +grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB"; +grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB"; grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; flush privileges; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index c41cdff62a8..de380e09e8a 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -888,6 +888,15 @@ SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; --echo # Must return 1 row SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; +# part 2 of the problem : DESC test cases +--echo # Must use ref-or-null on the a_c index +--replace_column 1 x 2 x 3 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC; +--echo # Must return 1 row +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC; + + DROP TABLE t1; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index ce058067264..af8cb1c168c 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -53,8 +53,8 @@ CREATE TABLE t1 ( b varchar(10), PRIMARY KEY (a) ) -PARTITION BY RANGE (to_days(a)) ( - PARTITION p1 VALUES LESS THAN (733407), +PARTITION BY RANGE (UNIX_TIMESTAMP(a)) ( + PARTITION p1 VALUES LESS THAN (1199134800), PARTITION pmax VALUES LESS THAN MAXVALUE ); @@ -64,7 +64,7 @@ INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax'); SELECT * FROM t1; ALTER TABLE t1 REORGANIZE PARTITION pmax INTO ( - PARTITION p3 VALUES LESS THAN (733969), + PARTITION p3 VALUES LESS THAN (1247688000), PARTITION pmax VALUES LESS THAN MAXVALUE); SELECT * FROM t1; SHOW CREATE TABLE t1; diff --git a/mysql-test/t/partition_bug18198.test b/mysql-test/t/partition_bug18198.test index 7f071c6ec9e..720d483e8ed 100644 --- a/mysql-test/t/partition_bug18198.test +++ b/mysql-test/t/partition_bug18198.test @@ -158,7 +158,7 @@ create table t1 (col1 datetime) partition by range(timestampdiff(day,5,col1)) (partition p0 values less than (10), partition p1 values less than (30)); --- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +-- error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR create table t1 (col1 date) partition by range(unix_timestamp(col1)) (partition p0 values less than (10), partition p1 values less than (30)); diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 49632f95dfb..1f011f36257 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -466,7 +466,7 @@ partitions 2 # # Partition by range, constant partition function not allowed # ---error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -681,7 +681,7 @@ partition by list (a); # # Partition by list, constant partition function not allowed # ---error ER_CONST_EXPR_IN_PARTITION_FUNC_ERROR +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -840,4 +840,364 @@ partition by range (a + (select count(*) from t1)) create table t1 (a char(10)) partition by hash (extractvalue(a,'a')); +--echo # +--echo # Bug #42849: innodb crash with varying time_zone on partitioned +--echo # timestamp primary key +--echo # +# A correctly partitioned table to test that trying to repartition it using +# timezone-dependent expression will throw an error. +CREATE TABLE old (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (UNIX_TIMESTAMP(a)) ( +PARTITION p VALUES LESS THAN (1219089600), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +# Check that allowed arithmetic/math functions involving TIMESTAMP values result +# in ER_PARTITION_FUNC_NOT_ALLOWED_ERROR when used as a partitioning function + +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (a) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +ALTER TABLE old +PARTITION BY RANGE (a) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (a+0) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (a+0) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (a % 2) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (a % 2) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (ABS(a)) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (ABS(a)) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (CEILING(a)) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (CEILING(a)) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (FLOOR(a)) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (FLOOR(a)) ( +PARTITION p VALUES LESS THAN (20080819), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +# Check that allowed date/time functions involving TIMESTAMP values result +# in ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR when used as a partitioning function + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (TO_DAYS(a)) ( +PARTITION p VALUES LESS THAN (733638), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (TO_DAYS(a)) ( +PARTITION p VALUES LESS THAN (733638), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (DAYOFYEAR(a)) ( +PARTITION p VALUES LESS THAN (231), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (DAYOFYEAR(a)) ( +PARTITION p VALUES LESS THAN (231), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (DAYOFMONTH(a)) ( +PARTITION p VALUES LESS THAN (19), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (DAYOFMONTH(a)) ( +PARTITION p VALUES LESS THAN (19), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (DAYOFWEEK(a)) ( +PARTITION p VALUES LESS THAN (3), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (DAYOFWEEK(a)) ( +PARTITION p VALUES LESS THAN (3), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (MONTH(a)) ( +PARTITION p VALUES LESS THAN (8), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (MONTH(a)) ( +PARTITION p VALUES LESS THAN (8), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (HOUR(a)) ( +PARTITION p VALUES LESS THAN (17), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (HOUR(a)) ( +PARTITION p VALUES LESS THAN (17), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (MINUTE(a)) ( +PARTITION p VALUES LESS THAN (55), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (MINUTE(a)) ( +PARTITION p VALUES LESS THAN (55), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (QUARTER(a)) ( +PARTITION p VALUES LESS THAN (3), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (QUARTER(a)) ( +PARTITION p VALUES LESS THAN (3), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (SECOND(a)) ( +PARTITION p VALUES LESS THAN (7), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (SECOND(a)) ( +PARTITION p VALUES LESS THAN (7), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (YEARWEEK(a)) ( +PARTITION p VALUES LESS THAN (200833), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (YEARWEEK(a)) ( +PARTITION p VALUES LESS THAN (200833), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (YEAR(a)) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (YEAR(a)) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (WEEKDAY(a)) ( +PARTITION p VALUES LESS THAN (3), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (WEEKDAY(a)) ( +PARTITION p VALUES LESS THAN (3), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (TIME_TO_SEC(a)) ( +PARTITION p VALUES LESS THAN (64507), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (TIME_TO_SEC(a)) ( +PARTITION p VALUES LESS THAN (64507), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (EXTRACT(DAY FROM a)) ( +PARTITION p VALUES LESS THAN (18), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (EXTRACT(DAY FROM a)) ( +PARTITION p VALUES LESS THAN (18), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL, b TIMESTAMP NOT NULL, PRIMARY KEY(a,b)) +PARTITION BY RANGE (DATEDIFF(a, a)) ( +PARTITION p VALUES LESS THAN (18), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (DATEDIFF(a, a)) ( +PARTITION p VALUES LESS THAN (18), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (YEAR(a + 0)) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (YEAR(a + 0)) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) ( +PARTITION p VALUES LESS THAN (733638), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) ( +PARTITION p VALUES LESS THAN (733638), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY) +PARTITION BY RANGE (YEAR(a + '2008-01-01')) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (YEAR(a + '2008-01-01')) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +ALTER TABLE old ADD COLUMN b DATE; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP, b DATE) +PARTITION BY RANGE (YEAR(a + b)) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (YEAR(a + b)) ( +PARTITION p VALUES LESS THAN (2008), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP, b DATE) +PARTITION BY RANGE (TO_DAYS(a + b)) ( +PARTITION p VALUES LESS THAN (733638), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (TO_DAYS(a + b)) ( +PARTITION p VALUES LESS THAN (733638), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP, b date) +PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) ( +PARTITION p VALUES LESS THAN (1219089600), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) ( +PARTITION p VALUES LESS THAN (1219089600), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE new (a TIMESTAMP, b TIMESTAMP) +PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) ( +PARTITION p VALUES LESS THAN (1219089600), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +ALTER TABLE old MODIFY b TIMESTAMP; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE old +PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) ( +PARTITION p VALUES LESS THAN (1219089600), +PARTITION pmax VALUES LESS THAN MAXVALUE); + +DROP TABLE old; + +--echo End of 5.1 tests diff --git a/mysql-test/t/partition_innodb-master.opt b/mysql-test/t/partition_innodb-master.opt new file mode 100644 index 00000000000..462f8fbe828 --- /dev/null +++ b/mysql-test/t/partition_innodb-master.opt @@ -0,0 +1 @@ +--innodb_lock_wait_timeout=1 diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 6a70f20c7f3..91ecfa15d60 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -5,6 +5,8 @@ drop table if exists t1; --enable_warnings +let $MYSQLD_DATADIR= `SELECT @@datadir`; + # # Bug#47029: Crash when reorganize partition with subpartition # @@ -296,6 +298,47 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); CREATE INDEX i1 ON t1 (a); DROP TABLE t1; -let $MYSQLD_DATADIR= `SELECT @@datadir`; + # Before the fix it should show extra file like #sql-2405_2.par --list_files $MYSQLD_DATADIR/test/ * + +--echo # +--echo # Bug#47343: InnoDB fails to clean-up after lock wait timeout on +--echo # REORGANIZE PARTITION +--echo # +CREATE TABLE t1 ( + a INT, + b DATE NOT NULL, + PRIMARY KEY (a, b) +) ENGINE=InnoDB +PARTITION BY RANGE (a) ( + PARTITION pMAX VALUES LESS THAN MAXVALUE +) ; + +INSERT INTO t1 VALUES (1, '2001-01-01'), (2, '2002-02-02'), (3, '2003-03-03'); + +START TRANSACTION; +SELECT * FROM t1 FOR UPDATE; + +connect (con1, localhost, root,,); +--echo # Connection con1 +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO +(PARTITION p3 VALUES LESS THAN (3), + PARTITION pMAX VALUES LESS THAN MAXVALUE); +SHOW WARNINGS; +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO +(PARTITION p3 VALUES LESS THAN (3), + PARTITION pMAX VALUES LESS THAN MAXVALUE); +SHOW WARNINGS; + +#Contents of the 'test' database directory: +--list_files $MYSQLD_DATADIR/test + +disconnect con1; +connection default; +--echo # Connection default +SELECT * FROM t1; +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 11e65be45fc..315b8393d93 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -8,6 +8,166 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings +--echo # +--echo # Bug#49742: Partition Pruning not working correctly for RANGE +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY) +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (1), +PARTITION p1 VALUES LESS THAN (2), +PARTITION p2 VALUES LESS THAN (3), +PARTITION p3 VALUES LESS THAN (4), +PARTITION p4 VALUES LESS THAN (5), +PARTITION p5 VALUES LESS THAN (6), +PARTITION max VALUES LESS THAN MAXVALUE); + +INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8); + +SELECT * FROM t1 WHERE a < 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1; +SELECT * FROM t1 WHERE a < 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2; +SELECT * FROM t1 WHERE a < 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3; +SELECT * FROM t1 WHERE a < 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4; +SELECT * FROM t1 WHERE a < 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5; +SELECT * FROM t1 WHERE a < 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6; +SELECT * FROM t1 WHERE a < 7; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; +SELECT * FROM t1 WHERE a <= 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +SELECT * FROM t1 WHERE a <= 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2; +SELECT * FROM t1 WHERE a <= 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3; +SELECT * FROM t1 WHERE a <= 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4; +SELECT * FROM t1 WHERE a <= 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5; +SELECT * FROM t1 WHERE a <= 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; +SELECT * FROM t1 WHERE a <= 7; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7; +SELECT * FROM t1 WHERE a = 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1; +SELECT * FROM t1 WHERE a = 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2; +SELECT * FROM t1 WHERE a = 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3; +SELECT * FROM t1 WHERE a = 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4; +SELECT * FROM t1 WHERE a = 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5; +SELECT * FROM t1 WHERE a = 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6; +SELECT * FROM t1 WHERE a = 7; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 7; +SELECT * FROM t1 WHERE a >= 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1; +SELECT * FROM t1 WHERE a >= 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2; +SELECT * FROM t1 WHERE a >= 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3; +SELECT * FROM t1 WHERE a >= 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4; +SELECT * FROM t1 WHERE a >= 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5; +SELECT * FROM t1 WHERE a >= 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6; +SELECT * FROM t1 WHERE a >= 7; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7; +SELECT * FROM t1 WHERE a > 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1; +SELECT * FROM t1 WHERE a > 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2; +SELECT * FROM t1 WHERE a > 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3; +SELECT * FROM t1 WHERE a > 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4; +SELECT * FROM t1 WHERE a > 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5; +SELECT * FROM t1 WHERE a > 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6; +SELECT * FROM t1 WHERE a > 7; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7; +DROP TABLE t1; + +CREATE TABLE t1 (a INT PRIMARY KEY) +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (1), +PARTITION p1 VALUES LESS THAN (2), +PARTITION p2 VALUES LESS THAN (3), +PARTITION p3 VALUES LESS THAN (4), +PARTITION p4 VALUES LESS THAN (5), +PARTITION max VALUES LESS THAN MAXVALUE); + +INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7); + +SELECT * FROM t1 WHERE a < 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1; +SELECT * FROM t1 WHERE a < 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2; +SELECT * FROM t1 WHERE a < 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3; +SELECT * FROM t1 WHERE a < 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4; +SELECT * FROM t1 WHERE a < 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5; +SELECT * FROM t1 WHERE a < 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6; +SELECT * FROM t1 WHERE a <= 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; +SELECT * FROM t1 WHERE a <= 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2; +SELECT * FROM t1 WHERE a <= 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3; +SELECT * FROM t1 WHERE a <= 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4; +SELECT * FROM t1 WHERE a <= 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5; +SELECT * FROM t1 WHERE a <= 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; +SELECT * FROM t1 WHERE a = 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1; +SELECT * FROM t1 WHERE a = 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2; +SELECT * FROM t1 WHERE a = 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3; +SELECT * FROM t1 WHERE a = 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4; +SELECT * FROM t1 WHERE a = 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5; +SELECT * FROM t1 WHERE a = 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6; +SELECT * FROM t1 WHERE a >= 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1; +SELECT * FROM t1 WHERE a >= 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2; +SELECT * FROM t1 WHERE a >= 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3; +SELECT * FROM t1 WHERE a >= 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4; +SELECT * FROM t1 WHERE a >= 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5; +SELECT * FROM t1 WHERE a >= 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6; +SELECT * FROM t1 WHERE a > 1; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1; +SELECT * FROM t1 WHERE a > 2; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2; +SELECT * FROM t1 WHERE a > 3; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3; +SELECT * FROM t1 WHERE a > 4; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4; +SELECT * FROM t1 WHERE a > 5; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5; +SELECT * FROM t1 WHERE a > 6; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6; +DROP TABLE t1; + # # Bug#20577: Partitions: use of to_days() function leads to selection failures # diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index db5994d434b..d5f7eda5032 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1991,6 +1991,45 @@ select @arg; execute stmt using @arg; deallocate prepare stmt; +--echo # +--echo # Bug#48508: Crash on prepared statement re-execution. +--echo # +create table t1(b int); +insert into t1 values (0); +create view v1 AS select 1 as a from t1 where b; +prepare stmt from "select * from v1 where a"; +execute stmt; +execute stmt; +deallocate prepare stmt; +drop table t1; +drop view v1; + +create table t1(a bigint); +create table t2(b tinyint); +insert into t2 values (null); +prepare stmt from "select 1 from t1 join t2 on a xor b where b > 1 and a =1"; +execute stmt; +execute stmt; +deallocate prepare stmt; +drop table t1,t2; +--echo # + + +--echo # +--echo # Bug #49570: Assertion failed: !(order->used & map) +--echo # on re-execution of prepared statement +--echo # +CREATE TABLE t1(a INT PRIMARY KEY); +INSERT INTO t1 VALUES(0), (1); +PREPARE stmt FROM + "SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a"; +EXECUTE stmt; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + + --echo End of 5.0 tests. # @@ -3009,5 +3048,21 @@ execute stmt; drop table t1; deallocate prepare stmt; +--echo # +--echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0 +--echo # + +prepare encode from "select encode(?, ?) into @ciphertext"; +prepare decode from "select decode(?, ?) into @plaintext"; +set @str="abc", @key="cba"; +execute encode using @str, @key; +execute decode using @ciphertext, @key; +select @plaintext; +set @str="bcd", @key="dcb"; +execute encode using @str, @key; +execute decode using @ciphertext, @key; +select @plaintext; +deallocate prepare encode; +deallocate prepare decode; --echo End of 5.1 tests. diff --git a/mysql-test/t/ps_ddl.test b/mysql-test/t/ps_ddl.test index fee235cd36c..1543c757908 100644 --- a/mysql-test/t/ps_ddl.test +++ b/mysql-test/t/ps_ddl.test @@ -1445,18 +1445,19 @@ call p_verify_reprepare_count(0); drop table t2; # Temporary table with name of table to be created exists create temporary table t2 (a int); ---error ER_TABLE_EXISTS_ERROR +# Temporary table and base table are not in the same name space. execute stmt; call p_verify_reprepare_count(1); --error ER_TABLE_EXISTS_ERROR execute stmt; -call p_verify_reprepare_count(0); +call p_verify_reprepare_count(1); drop temporary table t2; +--error ER_TABLE_EXISTS_ERROR execute stmt; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); drop table t2; execute stmt; -call p_verify_reprepare_count(0); +call p_verify_reprepare_count(1); drop table t2; # View with name of table to be created exists # Attention: diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index e81c298166d..f61db538fb4 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3786,6 +3786,96 @@ SELECT 1 FROM t2 JOIN t1 ON 1=1 DROP TABLE t1,t2; +--echo # +--echo # Bug #49199: Optimizer handles incorrectly: +--echo # field='const1' AND field='const2' in some cases +--echo +CREATE TABLE t1(a DATETIME NOT NULL); +INSERT INTO t1 VALUES('2001-01-01'); +SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; +DROP TABLE t1; + +CREATE TABLE t1(a DATE NOT NULL); +INSERT INTO t1 VALUES('2001-01-01'); +SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; +DROP TABLE t1; + +CREATE TABLE t1(a TIMESTAMP NOT NULL); +INSERT INTO t1 VALUES('2001-01-01'); +SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'; +DROP TABLE t1; + +CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL); +INSERT INTO t1 VALUES('2001-01-01', '2001-01-01'); +SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; +DROP TABLE t1; + +CREATE TABLE t1(a DATETIME NOT NULL, b VARCHAR(20) NOT NULL); +INSERT INTO t1 VALUES('2001-01-01', '2001-01-01'); +SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00'; + +SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01'; +DROP TABLE t1; + +CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL); +INSERT INTO t1 VALUES('2001-01-01', '2001-01-01'); +SELECT x.a, y.a, z.a FROM t1 x + JOIN t1 y ON x.a=y.a + JOIN t1 z ON y.a=z.a + WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00'; +EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x + JOIN t1 y ON x.a=y.a + JOIN t1 z ON y.a=z.a + WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00'; +DROP TABLE t1; + + +--echo # +--echo # Bug #49897: crash in ptr_compare when char(0) NOT NULL +--echo # column is used for ORDER BY +--echo # +SET @old_sort_buffer_size= @@session.sort_buffer_size; +SET @@sort_buffer_size= 40000; + +CREATE TABLE t1(a CHAR(0) NOT NULL); +--disable_warnings +INSERT INTO t1 VALUES (0), (0), (0); +--enable_warnings +INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; +INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; +INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12; +EXPLAIN SELECT a FROM t1 ORDER BY a; +--disable_result_log +SELECT a FROM t1 ORDER BY a; +--enable_result_log +DROP TABLE t1; + +CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int); +--disable_warnings +INSERT INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1); +--enable_warnings +INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; +INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; +INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12; +EXPLAIN SELECT a FROM t1 ORDER BY a LIMIT 5; +SELECT a FROM t1 ORDER BY a LIMIT 5; +EXPLAIN SELECT * FROM t1 ORDER BY a, b LIMIT 5; +SELECT * FROM t1 ORDER BY a, b LIMIT 5; +EXPLAIN SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; +SELECT * FROM t1 ORDER BY a, b, c LIMIT 5; +EXPLAIN SELECT * FROM t1 ORDER BY c, a LIMIT 5; +SELECT * FROM t1 ORDER BY c, a LIMIT 5; + +SET @@sort_buffer_size= @old_sort_buffer_size; +DROP TABLE t1; + + --echo End of 5.0 tests # diff --git a/mysql-test/t/sp-ucs2.test b/mysql-test/t/sp-ucs2.test index 7dd88b04871..7d6b62dfea0 100644 --- a/mysql-test/t/sp-ucs2.test +++ b/mysql-test/t/sp-ucs2.test @@ -26,3 +26,32 @@ drop table t3| delimiter ;| + +# +# Bug#48766 SHOW CREATE FUNCTION returns extra data in return clause +# +SET NAMES utf8; +--disable_warnings +DROP FUNCTION IF EXISTS bug48766; +--enable_warnings +# +# Test that Latin letters are not prepended with extra '\0'. +# +CREATE FUNCTION bug48766 () + RETURNS ENUM( 'w' ) CHARACTER SET ucs2 + RETURN 0; +SHOW CREATE FUNCTION bug48766; +SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_NAME='bug48766'; +DROP FUNCTION bug48766; +# +# Test non-Latin characters +# +CREATE FUNCTION bug48766 () + RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2 + RETURN 0; +SHOW CREATE FUNCTION bug48766; +SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_NAME='bug48766'; + +DROP FUNCTION bug48766; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 73ba62612b8..5cf050146dd 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -8242,6 +8242,25 @@ while ($tab_count) DROP PROCEDURE p1; DROP TABLE t1; +# +# Bug#47649 crash during CALL procedure +# +CREATE TABLE t1 ( f1 integer, primary key (f1)); +CREATE TABLE t2 LIKE t1; +CREATE TEMPORARY TABLE t3 LIKE t1; +delimiter |; +CREATE PROCEDURE p1 () BEGIN SELECT f1 FROM t3 AS A WHERE A.f1 IN ( SELECT f1 FROM t3 ) ; +END| +delimiter ;| +--error ER_CANT_REOPEN_TABLE +CALL p1; +CREATE VIEW t3 AS SELECT f1 FROM t2 A WHERE A.f1 IN ( SELECT f1 FROM t2 ); +DROP TABLE t3; +CALL p1; +CALL p1; +DROP PROCEDURE p1; +DROP TABLE t1, t2; +DROP VIEW t3; --echo # --echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0' diff --git a/mysql-test/t/sp_sync.test b/mysql-test/t/sp_sync.test new file mode 100644 index 00000000000..f9dae17b039 --- /dev/null +++ b/mysql-test/t/sp_sync.test @@ -0,0 +1,58 @@ +# This test should work in embedded server after mysqltest is fixed +-- source include/not_embedded.inc + +--echo Tests of syncronization of stored procedure execution. + +--source include/have_debug_sync.inc + +--echo # +--echo # Bug#48157: crash in Item_field::used_tables +--echo # + +CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b; +CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b; + +DELIMITER |; + +CREATE PROCEDURE p1() +BEGIN + UPDATE t1 JOIN t2 USING( a, b ) SET t1.b = 1, t2.b = 1; +END| + +DELIMITER ;| + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; +LOCK TABLES t1 WRITE, t2 WRITE; + +connection con2; +LET $ID= `select connection_id()`; +SET DEBUG_SYNC = 'multi_update_reopen_tables SIGNAL parked WAIT_FOR go'; +--send CALL p1() + +connection con1; +let $wait_condition= SELECT 1 FROM information_schema.processlist WHERE ID = $ID AND +state = "Locked"; +--source include/wait_condition.inc +DROP TABLE t1, t2; +SET DEBUG_SYNC = 'now WAIT_FOR parked'; +CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b; +CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b; +SET DEBUG_SYNC = 'now SIGNAL go'; + +connection con2; +--reap + +disconnect con1; +disconnect con2; +connection default; + +--echo # Without the DEBUG_SYNC supplied in the same patch as this test in the +--echo # code, this test statement will hang. +DROP TABLE t1, t2; +DROP PROCEDURE p1; + +SET DEBUG_SYNC = 'RESET'; + diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 2391554dccd..faaa42f8461 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3374,6 +3374,32 @@ WHERE a = 230; DROP TABLE t1, st1, st2; +--echo # +--echo # Bug #48709: Assertion failed in sql_select.cc:11782: +--echo # int join_read_key(JOIN_TAB*) +--echo # + +CREATE TABLE t1 (pk int PRIMARY KEY, int_key int); +INSERT INTO t1 VALUES (10,1), (14,1); + +CREATE TABLE t2 (pk int PRIMARY KEY, int_key int); +INSERT INTO t2 VALUES (3,3), (5,NULL), (7,3); + +--echo # should have eq_ref for t1 +--replace_column 1 x 2 x 5 x 6 x 7 x 8 x 9 x 10 x +EXPLAIN +SELECT * FROM t2 outr +WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) +ORDER BY outr.pk; + +--echo # should not crash on debug binaries +SELECT * FROM t2 outr +WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2) +ORDER BY outr.pk; + +DROP TABLE t1,t2; + + --echo End of 5.0 tests. # @@ -3569,4 +3595,19 @@ SELECT 1 FROM t1 GROUP BY (SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1); DROP TABLE t1; +--echo # +--echo # Bug #49512 : subquery with aggregate function crash +--echo # subselect_single_select_engine::exec() + +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(); + +--echo # should not crash +SELECT 1 FROM t1 WHERE a <> SOME +( + SELECT MAX((SELECT a FROM t1 LIMIT 1)) AS d + FROM t1,t1 a +); +DROP TABLE t1; + --echo End of 5.1 tests. diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index ec169838d59..c8d5ea0f8e5 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1102,3 +1102,58 @@ DROP TABLE t1; --echo End of 5.0 tests + + +--echo # +--echo # Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY +--echo # <any non-const-function> +--echo # + +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +--echo # Should not crash +EXPLAIN EXTENDED +SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12; + +--echo # Should not crash +SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12; + + +--echo # Should not crash +--error ER_CANT_USE_OPTION_HERE +EXPLAIN EXTENDED +SELECT * FROM t1 UNION SELECT * FROM t1 + ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); + +--echo # Should not crash +--error ER_CANT_USE_OPTION_HERE +SELECT * FROM t1 UNION SELECT * FROM t1 + ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); + +--echo # Should not crash +(SELECT * FROM t1) UNION (SELECT * FROM t1) + ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); + + +--echo # Should not crash +EXPLAIN EXTENDED +SELECT * FROM t1 UNION SELECT * FROM t1 + ORDER BY (SELECT a FROM t2 WHERE b = 12); + +--echo # Should not crash +--disable_result_log +SELECT * FROM t1 UNION SELECT * FROM t1 + ORDER BY (SELECT a FROM t2 WHERE b = 12); +--enable_result_log + +--echo # Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 + ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); + +DROP TABLE t1,t2; + + +--echo End of 5.1 tests diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index c0740458a88..b6b58e7bd46 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -295,6 +295,26 @@ SELECT @a, @b; SELECT a, b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b; DROP TABLE t1; +# +# Bug#47371: reference by same column name +# +CREATE TABLE t1 (f1 int(11) default NULL, f2 int(11) default NULL); +CREATE TABLE t2 (f1 int(11) default NULL, f2 int(11) default NULL, foo int(11)); +CREATE TABLE t3 (f1 int(11) default NULL, f2 int(11) default NULL); + +INSERT INTO t1 VALUES(10, 10); +INSERT INTO t1 VALUES(10, 10); +INSERT INTO t2 VALUES(10, 10, 10); +INSERT INTO t2 VALUES(10, 10, 10); +INSERT INTO t3 VALUES(10, 10); +INSERT INTO t3 VALUES(10, 10); + +SELECT MIN(t2.f1), +@bar:= (SELECT MIN(t3.f2) FROM t3 WHERE t3.f2 > foo) +FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t2.f1; + +DROP TABLE t1, t2, t3; + --echo End of 5.0 tests # diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 593ea3de7c1..42bf7e5174d 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -772,6 +772,12 @@ set @@hostname= "anothername"; --replace_column 2 # show variables like 'hostname'; +--echo # +--echo # BUG#37408 - Compressed MyISAM files should not require/use mmap() +--echo # +--echo # Test 'myisam_mmap_size' option is not dynamic +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@myisam_mmap_size= 500M; --echo End of 5.0 tests # |