diff options
Diffstat (limited to 'mysql-test/t')
32 files changed, 455 insertions, 50 deletions
diff --git a/mysql-test/t/change_user_notembedded.test b/mysql-test/t/change_user_notembedded.test index bf5d1956cd5..19421c6dd33 100644 --- a/mysql-test/t/change_user_notembedded.test +++ b/mysql-test/t/change_user_notembedded.test @@ -22,3 +22,5 @@ change_user; disconnect test; connection default; +--echo that's all + diff --git a/mysql-test/t/create_or_replace.test b/mysql-test/t/create_or_replace.test index 2bdd23c21f6..9e37950dbef 100644 --- a/mysql-test/t/create_or_replace.test +++ b/mysql-test/t/create_or_replace.test @@ -346,20 +346,26 @@ LOCK TABLE t1 WRITE; --let $con_id = `SELECT CONNECTION_ID()` --send CREATE OR REPLACE TABLE t1 LIKE tmp --connection default +let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist + WHERE state= 'Waiting for table metadata lock'; +--source include/wait_condition.inc --replace_result $con_id con_id --eval KILL QUERY $con_id --connection con1 ---error 0,ER_QUERY_INTERRUPTED +--error ER_QUERY_INTERRUPTED --reap --send CREATE OR REPLACE TABLE t1 (a int) --connection default +let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist + WHERE state= 'Waiting for table metadata lock'; +--source include/wait_condition.inc --replace_result $con_id con_id --eval KILL QUERY $con_id --connection con1 ---error 0,ER_QUERY_INTERRUPTED +--error ER_QUERY_INTERRUPTED --reap --disconnect con1 --connection default diff --git a/mysql-test/t/ctype_binary.test b/mysql-test/t/ctype_binary.test index 8b57854de83..4a2646d1db5 100644 --- a/mysql-test/t/ctype_binary.test +++ b/mysql-test/t/ctype_binary.test @@ -10,3 +10,15 @@ set names binary; --echo # --echo # End of 5.5 tests --echo # + + +--echo # +--echo # Start of 10.0 tests +--echo # + +SET NAMES binary; +--source include/ctype_like_cond_propagation.inc + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index 5da1534029b..336d8ca761d 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -210,6 +210,13 @@ set names latin1; let $ctype_unescape_combinations=selected; --source include/ctype_unescape.inc +SET NAMES latin1; +--source include/ctype_like_cond_propagation.inc + +SET NAMES latin1 COLLATE latin1_bin; +--source include/ctype_like_cond_propagation.inc + + --echo # --echo # MDEV-6752 Trailing incomplete characters are not replaced to question marks on conversion --echo # diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index 79f163d7e5d..95008d83a38 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -571,6 +571,14 @@ SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; --echo # --echo +SET NAMES utf8 COLLATE utf8_unicode_ci; +--source include/ctype_like_cond_propagation.inc +--source include/ctype_like_cond_propagation_utf8_german.inc + +SET NAMES utf8 COLLATE utf8_german2_ci; +--source include/ctype_like_cond_propagation.inc +--source include/ctype_like_cond_propagation_utf8_german.inc + --echo # --echo # MDEV-4929 Myanmar collation --echo # @@ -580,5 +588,24 @@ SET collation_connection=ucs2_myanmar_ci; --source include/ctype_myanmar.inc --echo # +--echo # MDEV-7366 SELECT 'a' = BINARY 'A' returns 1 (utf8 charset, utf8_unicode_ci collation) +--echo # +SET NAMES utf8 COLLATE utf8_unicode_ci; +SELECT 'a' = BINARY 'A'; +SELECT BINARY 'A' = 'a'; + +--echo # +--echo # Wrong result set for WHERE a='oe' COLLATE utf8_german2_ci AND a='oe' +--echo # +SET NAMES utf8 COLLATE utf8_german2_ci; +CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('รถ'),('oe'); +SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci; +SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; +DROP TABLE t1; + +--echo # --echo # End of MariaDB-10.0 tests --echo # diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index d269fb35dfe..33d41e9bc4c 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -897,6 +897,12 @@ DROP TABLE t1; --echo # Start of 10.0 tests --echo # +SET NAMES latin1, collation_connection=ucs2_bin; +--source include/ctype_like_cond_propagation.inc +SET NAMES latin1, collation_connection=ucs2_general_ci; +--source include/ctype_like_cond_propagation.inc +SET NAMES latin1; + --echo # --echo # MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index e02d5a915b7..1e9047cca8e 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1658,6 +1658,13 @@ set max_sort_length=default; --echo # Start of 10.0 tests --echo # +SET NAMES utf8 COLLATE utf8_bin; +--source include/ctype_like_cond_propagation.inc +SET NAMES utf8; +--source include/ctype_like_cond_propagation.inc +--source include/ctype_like_cond_propagation_utf8_german.inc + + --echo # --echo # MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string) --echo # diff --git a/mysql-test/t/frm_bad_row_type-7333.test b/mysql-test/t/frm_bad_row_type-7333.test new file mode 100644 index 00000000000..5100a85cb22 --- /dev/null +++ b/mysql-test/t/frm_bad_row_type-7333.test @@ -0,0 +1,14 @@ +# +# MDEV-7333 "'show table status like 'table_name'" on tokudb table lead to MariaDB crash +# +let $datadir= `select @@datadir`; +call mtr.add_suppression("bad_row_type.frm: invalid value 11 for the field row_format"); +copy_file std_data/bad_row_type.MYD $datadir/test/bad_row_type.MYD; +copy_file std_data/bad_row_type.MYI $datadir/test/bad_row_type.MYI; +copy_file std_data/bad_row_type.frm $datadir/test/bad_row_type.frm; + +select * from bad_row_type; +show create table bad_row_type; +replace_column 12 x 13 x; +show table status like 'bad_row_type'; +drop table bad_row_type; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index a3f488a8d1e..2b189765bbc 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1631,3 +1631,21 @@ CREATE TABLE t1 ( d DATE, t TIME ); INSERT INTO t1 VALUES ('2008-12-05','22:34:09'),('2005-03-27','14:26:02'); SELECT EXTRACT(DAY_MINUTE FROM GREATEST(t,d)), GREATEST(t,d) FROM t1; DROP TABLE t1; + + +--echo # +--echo # MDEV-7221 from_days fails after null value +--echo # +CREATE TABLE t1 ( + id INT(11) NOT NULL PRIMARY KEY, + date1 DATE NULL DEFAULT NULL +); +INSERT INTO t1 VALUES (12, '2011-05-12'); +INSERT INTO t1 VALUES (13, NULL); +INSERT INTO t1 VALUES (14, '2009-10-23'); +INSERT INTO t1 VALUES (15, '2014-10-30'); +INSERT INTO t1 VALUES (16, NULL); +INSERT INTO t1 VALUES (17, NULL); +INSERT INTO t1 VALUES (18, '2010-10-13'); +SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id; +DROP TABLE t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 35bd447e9ea..4b1cb82d0f9 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1664,6 +1664,21 @@ WHERE t1a.c1 = c2 GROUP BY i2; DROP TABLE t1,t2; +--echo # +--echo # MDEV-6855 +--echo # MIN(*) with subqueries with IS NOT NULL in WHERE clause crashed. +--echo # + +CREATE TABLE t1 (i INT, c VARCHAR(3), KEY(c,i)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (7,'foo'),(0,'bar'); + +CREATE TABLE t2 (j INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (0),(8),(1),(8),(9); + +SELECT MAX(i), c FROM t1 +WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c; +drop table t1,t2; + # # End of MariaDB 5.5 tests # diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test index df213cc189f..75ee3d0802a 100644 --- a/mysql-test/t/group_by_innodb.test +++ b/mysql-test/t/group_by_innodb.test @@ -67,3 +67,22 @@ DROP TABLE t1; --echo End of 5.5 tests +--echo # +--echo # MDEV-5719: Wrong result with GROUP BY and LEFT OUTER JOIN +--echo # +CREATE TABLE t1 (oidGroup INT, oid INT PRIMARY KEY)ENGINE=INNODB; +INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4); + +CREATE TABLE t2 (oid INT PRIMARY KEY)ENGINE=INNODB; +INSERT INTO t2 VALUES (3); + +# Returns a value +SELECT a.oidGroup, a.oid, b.oid FROM t1 a LEFT JOIN t2 b ON +a.oid=b.oid WHERE a.oidGroup=1; + +SELECT a.oidGroup, a.oid, b.oid FROM t1 a LEFT JOIN t2 b ON +a.oid=b.oid WHERE a.oidGroup=1 GROUP BY a.oid; + +DROP TABLE t1, t2; + +--echo # End of tests diff --git a/mysql-test/t/insert_update_autoinc-7150.test b/mysql-test/t/insert_update_autoinc-7150.test new file mode 100644 index 00000000000..1229898b4aa --- /dev/null +++ b/mysql-test/t/insert_update_autoinc-7150.test @@ -0,0 +1,8 @@ +# +# MDEV-7150 Wrong auto increment values on INSERT .. ON DUPLICATE KEY UPDATE when the inserted columns include NULL in an auto-increment column +# +create table t1 (a int(10) auto_increment primary key, b int(11)); +insert t1 values (null,1); +insert t1 values (null,2), (1,-1), (null,3) on duplicate key update b=values(b); +select * from t1; +drop table t1; diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 86e56a8301b..d28e7c23a4c 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -301,8 +301,8 @@ select * from t2; update t1 set p=3 where p=1; update t2 set i=2 where i=1; ---replace_result 1804 KEY_BLOCKS_UNUSED 1801 KEY_BLOCKS_UNUSED 1663 KEY_BLOCKS_UNUSED 1782 KEY_BLOCKS_UNUSED -show status like 'key_%'; +select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused'; +select variable_value into @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused'; --replace_column 7 # select * from information_schema.key_caches where segment_number is null; @@ -334,8 +334,8 @@ update t1 set p=3 where p=1; update t2 set i=2 where i=1; ---replace_result 1800 KEY_BLOCKS_UNUSED 1794 KEY_BLOCKS_UNUSED 1656 KEY_BLOCKS_UNUSED 1775 KEY_BLOCKS_UNUSED -show status like 'key_%'; +select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused'; +select variable_value < @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused'; --replace_column 7 # select * from information_schema.key_caches where segment_number is null; @@ -359,8 +359,8 @@ select * from t2; update t1 set p=3 where p=1; update t2 set i=2 where i=1; ---replace_result 1804 KEY_BLOCKS_UNUSED 1801 KEY_BLOCKS_UNUSED 1663 KEY_BLOCKS_UNUSED 1782 KEY_BLOCKS_UNUSED -show status like 'key_%'; +select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused'; +select variable_value = @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused'; --replace_column 7 # select * from information_schema.key_caches where segment_number is null; diff --git a/mysql-test/t/kill-2-master.opt b/mysql-test/t/kill-2-master.opt new file mode 100644 index 00000000000..ab6ca1731f5 --- /dev/null +++ b/mysql-test/t/kill-2-master.opt @@ -0,0 +1 @@ +--skip-name-resolve diff --git a/mysql-test/t/kill-2.test b/mysql-test/t/kill-2.test new file mode 100644 index 00000000000..0c1177722b4 --- /dev/null +++ b/mysql-test/t/kill-2.test @@ -0,0 +1,29 @@ +# +# Test KILL and KILL QUERY statements. +# +# Killing a connection in an embedded server does not work like in a normal +# server, if it is waiting for a new statement. In an embedded server, the +# connection does not read() from a socket, but returns control to the +# application. 'mysqltest' does not handle the kill request. +# + +-- source include/not_embedded.inc +-- source include/not_threadpool.inc + +--echo # +--echo # MDEV-6896 kill user command cause MariaDB crash! +--echo # + +create user foo@'127.0.0.1'; + +--connect (con1,127.0.0.1,foo,,) + +--connection default +select user from information_schema.processlist; +kill user foo@'127.0.0.1'; + +let $wait_condition= + select count(*) = 0 from information_schema.processlist + where user = "foo"; +--source include/wait_condition.inc +drop user foo@'127.0.0.1'; diff --git a/mysql-test/t/kill_processlist-6619.test b/mysql-test/t/kill_processlist-6619.test index 2333f02eac6..95af83be56d 100644 --- a/mysql-test/t/kill_processlist-6619.test +++ b/mysql-test/t/kill_processlist-6619.test @@ -2,16 +2,26 @@ # MDEV-6619 SHOW PROCESSLIST returns empty result set after KILL QUERY # --source include/not_embedded.inc +--source include/have_debug_sync.inc + --enable_connect_log --connect (con1,localhost,root,,) --let $con_id = `SELECT CONNECTION_ID()` --replace_column 1 # 3 # 6 # 7 # SHOW PROCESSLIST; +SET DEBUG_SYNC='before_execute_sql_command SIGNAL ready WAIT_FOR go'; +send SHOW PROCESSLIST; --connection default +# We must wait for the SHOW PROCESSLIST query to have started before sending +# the kill. Otherwise, the KILL may be lost since it is reset at the start of +# query execution. +SET DEBUG_SYNC='now WAIT_FOR ready'; --replace_result $con_id con_id eval KILL QUERY $con_id; +SET DEBUG_SYNC='now SIGNAL go'; --connection con1 --error ER_QUERY_INTERRUPTED -SHOW PROCESSLIST; +reap; +SET DEBUG_SYNC='reset'; --replace_column 1 # 3 # 6 # 7 # SHOW PROCESSLIST; diff --git a/mysql-test/t/kill_query-6728.test b/mysql-test/t/kill_query-6728.test new file mode 100644 index 00000000000..485256a65b6 --- /dev/null +++ b/mysql-test/t/kill_query-6728.test @@ -0,0 +1,14 @@ +# +# MDEV-6728 KILL QUERY executed on an idle connection can interrupt the next query +# +--enable_connect_log +--connect (con1,localhost,root,,) +let $id=`select connection_id()`; + +--connection default +--replace_result $id id +eval kill query $id; + +--connection con1 +select count(*) > 0 from mysql.user; + diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test index f00080d917b..ef79cc2c0f4 100644 --- a/mysql-test/t/lock_sync.test +++ b/mysql-test/t/lock_sync.test @@ -1186,7 +1186,6 @@ DROP TABLE t1; disconnect con1; disconnect con2; - # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test index 8a2bd4cf6c1..6fd26ab2011 100644 --- a/mysql-test/t/log_tables.test +++ b/mysql-test/t/log_tables.test @@ -727,7 +727,8 @@ CREATE TABLE `db_17876.slow_log_data` ( `last_insert_id` int(11) default NULL, `insert_id` int(11) default NULL, `server_id` int(11) default NULL, - `sql_text` mediumtext + `sql_text` mediumtext, + `thread_id` bigint(21) unsigned default NULL ); CREATE TABLE `db_17876.general_log_data` ( diff --git a/mysql-test/t/mdev6830-master.opt b/mysql-test/t/mdev6830-master.opt new file mode 100644 index 00000000000..2a8c27d4731 --- /dev/null +++ b/mysql-test/t/mdev6830-master.opt @@ -0,0 +1 @@ +--debug diff --git a/mysql-test/t/mdev6830.test b/mysql-test/t/mdev6830.test new file mode 100644 index 00000000000..24565d04fed --- /dev/null +++ b/mysql-test/t/mdev6830.test @@ -0,0 +1,63 @@ + +--source include/have_debug.inc + +--disable_warnings +drop table if exists t1,t2,t3; +drop view if exists v2,v3; +--enable_warnings +CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM; + +CREATE TABLE t2 ( + f1 DATE, + f2 VARCHAR(1024), + f3 VARCHAR(10), + f4 DATE, + f5 VARCHAR(10), + f6 VARCHAR(10), + f7 VARCHAR(10), + f8 DATETIME, + f9 INT, + f10 VARCHAR(1024), + f11 VARCHAR(1024), + f12 INT, + f13 VARCHAR(1024) +) ENGINE=MyISAM; + +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; + +CREATE TABLE t3 ( + f1 VARCHAR(1024), + f2 VARCHAR(1024), + f3 DATETIME, + f4 VARCHAR(10), + f5 INT, + f6 VARCHAR(10), + f7 VARCHAR(1024), + f8 VARCHAR(10), + f9 INT, + f10 DATE, + f11 INT, + f12 VARCHAR(1024), + f13 VARCHAR(10), + f14 DATE, + f15 DATETIME +) ENGINE=MyISAM; + +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; + +INSERT INTO t3 VALUES + ('FOO','foo','2000-08-04 00:00:00','one',1,'1','FOO','foo',1,'2004-05-09',1,'one','one','2001-12-07','2001-10-17 08:25:04'), + ('BAR','bar','2001-01-01 04:52:37','two',2,'2','BAR','bar',2,'2008-01-01',2,'two','two','2006-06-19','2002-01-01 08:22:49'); + +CREATE TABLE t4 (f1 VARCHAR(10), f2 INT) ENGINE=MyISAM; + +SELECT * FROM t1; + +--error ER_BAD_FIELD_ERROR +SELECT non_existing FROM v2; + +SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5; + +drop table t1,t2,t3,t4; +drop view v2,v3; + diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 1e2aacd474a..a74e95ab65b 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -581,7 +581,7 @@ CREATE INDEX i1 ON t1 (a); DROP TABLE t1; # Before the fix it should show extra file like #sql-2405_2.par ---list_files $MYSQLD_DATADIR/test/ * +--list_files $MYSQLD_DATADIR/test/ *.par --disable_parsing --echo # @@ -616,7 +616,7 @@ ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO SHOW WARNINGS; #Contents of the 'test' database directory: ---list_files $MYSQLD_DATADIR/test +--list_files $MYSQLD_DATADIR/test/ *.par disconnect con1; connection default; diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index 2eb9a2fa2a0..8044ae9ec5c 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -52,7 +52,7 @@ KEY_BLOCK_SIZE=4 PARTITION BY HASH(id) PARTITIONS 1; --replace_result #p# #P# ---list_files $MYSQLD_DATADIR/test +--list_files $MYSQLD_DATADIR/test t1* SHOW CREATE TABLE t1; SET GLOBAL innodb_file_per_table = OFF; @@ -71,14 +71,14 @@ LOCK TABLE t1 WRITE; ALTER TABLE t1 ADD PARTITION PARTITIONS 1; --replace_result #p# #P# ---list_files $MYSQLD_DATADIR/test +--list_files $MYSQLD_DATADIR/test t1* --echo # This SET is not needed to reproduce the bug, --echo # it is here just to make the test case more realistic SET innodb_strict_mode = OFF; ALTER TABLE t1 ADD PARTITION PARTITIONS 2; --replace_result #p# #P# ---list_files $MYSQLD_DATADIR/test +--list_files $MYSQLD_DATADIR/test t1* # really bug#56172 ALTER TABLE t1 REBUILD PARTITION p0; diff --git a/mysql-test/t/processlist.test b/mysql-test/t/processlist.test index 9c555c0f9fb..a8f8a4ed64c 100644 --- a/mysql-test/t/processlist.test +++ b/mysql-test/t/processlist.test @@ -2,6 +2,7 @@ # MDEV-4578 information_schema.processlist reports incorrect value for Time (2147483647) # +source include/have_debug.inc; source include/have_debug_sync.inc; let $tid= `SELECT CONNECTION_ID()`; @@ -21,6 +22,7 @@ SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed'; connection con1; --replace_result $tid TID reap; +set debug_sync='reset'; connection default; # @@ -28,15 +30,13 @@ connection default; # connection con1; -# Trigger a signal once the thread has gone from "Query" to "Sleep" command -# state. Note we need to execute this twice: Once at the end of SET DEBUG_SYNC, -# and once for the intended time, at the end of SELECT SLEEP(). -SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2'; -connection default; -# Wait for and clear the first signal set during SET DEBUG_SYNC. -SET DEBUG_SYNC= 'now WAIT_FOR query_done'; -SET DEBUG_SYNC= 'now SIGNAL nosignal'; -connection con1; +# This DBUG insertion triggers a DEBUG_SYNC signal "query_done" once +# the below SELECT SLEEP(5) has gone from "Query" to "Sleep" command +# state. (We cannot just set the DEBUG_SYNC directly here, because +# then it can trigger at the end of the SET DEBUG_SYNC statement (or +# at the end of the Prepare step of the SELECT, if --ps-protocol), +# thus occuring too early). +SET debug_dbug="+d,sleep_inject_query_done_debug_sync"; select sleep(5); #run a query that will take some time connection default; diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index d529dc415e7..88940eaf2b8 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -257,3 +257,23 @@ select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 select found_rows() as count; drop table t1, t2; +# +# MDEV-7219 SQL_CALC_FOUND_ROWS yields wrong result +# +create table t1 (i int, v varchar(64), key (i)); + +--disable_query_log +let $1=150; +while ($1) +{ + eval insert into t1 values ($1 % 2, 'foo'); + dec $1; +} +--enable_query_log + +select sql_calc_found_rows * from t1 where i = 0 order by v limit 59,2; +select found_rows(); +select sql_calc_found_rows * from t1 ignore index (i) where i = 0 order by v limit 59,2; +select found_rows(); +drop table t1; + diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 14d50709921..c43193d1b57 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1210,33 +1210,8 @@ disconnect conn1; connection default; DROP USER test_u@localhost; - ---echo # ---echo # Bug #48985: show create table crashes if previous access to the table ---echo # was killed ---echo # - -connect(con1,localhost,root,,); -CONNECTION con1; -LET $ID= `SELECT connection_id()`; - -CONNECTION default; ---disable_query_log -eval KILL QUERY $ID; ---enable_query_log - -CONNECTION con1; ---error ER_QUERY_INTERRUPTED -SHOW CREATE TABLE non_existent; - -DISCONNECT con1; ---source include/wait_until_disconnected.inc -CONNECTION default; - - --echo End of 5.1 tests - --echo # --echo # Bug#52593 SHOW CREATE TABLE is blocked if table is locked --echo # for write by another connection diff --git a/mysql-test/t/sp-innodb.test b/mysql-test/t/sp-innodb.test new file mode 100644 index 00000000000..228ab42544d --- /dev/null +++ b/mysql-test/t/sp-innodb.test @@ -0,0 +1,45 @@ + +--source include/have_innodb.inc + +--disable_warnings +drop table if exists t1,t2; +drop procedure if exists p1; +--enable_warnings + +--echo # +--echo #MDEV-6985: MariaDB crashes on stored procedure call +--echo # +CREATE TABLE `t1` ( + `ID` int(11) NOT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB; + +CREATE TABLE `t2` ( + `ID` int(11) NOT NULL, + `DATE` datetime DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB; + +--delimiter ;; + +CREATE PROCEDURE `p1`() +BEGIN + DECLARE _mySelect CURSOR FOR + SELECT DISTINCT t1.ID + FROM t1 + LEFT JOIN t2 AS t2 ON + t2.ID = t1.ID + AND t2.DATE = ( + SELECT MAX(T3.DATE) FROM t2 AS T3 WHERE T3.ID = t2.ID AND T3.DATE<=NOW() + ) + WHERE t1.ID = 1; + OPEN _mySelect; + CLOSE _mySelect; +END ;; +--delimiter ; + +CALL p1(); +CALL p1(); + +drop procedure p1; +drop table t1,t2; diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test index dee6a7ee8f2..42a3dd193c4 100644 --- a/mysql-test/t/sp_notembedded.test +++ b/mysql-test/t/sp_notembedded.test @@ -374,6 +374,9 @@ CREATE VIEW v1 AS SELECT f1('a') FROM t1; --send SELECT * FROM v1 --connection default +let $wait_condition= + select count(*) = 2 from information_schema.processlist where state = "User sleep"; +--source include/wait_condition.inc --disable_query_log --eval KILL QUERY $ID_2 --eval KILL QUERY $ID_1 diff --git a/mysql-test/t/statistics_index_crash-7362.test b/mysql-test/t/statistics_index_crash-7362.test new file mode 100644 index 00000000000..3873b896dae --- /dev/null +++ b/mysql-test/t/statistics_index_crash-7362.test @@ -0,0 +1,30 @@ +# Test cases that cover the crashes within: +# MDEV-7362 ANALYZE TABLES crash with table-independent-statistics gathering +# MDEV-7380 engine-independent stats SEGV on ANALYZE TABLE (#2) + +--source include/have_stat_tables.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (a longtext, FULLTEXT KEY (`a`)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977414141674541726D')); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +--sorted_result +SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1'; +DROP TABLE t1; + +CREATE TABLE t1 (a longtext, FULLTEXT KEY (`a`)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977414141674541726D')); +ANALYZE TABLE t1 PERSISTENT FOR ALL; +--sorted_result +SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1'; +DROP TABLE t1; + +CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)) ENGINE=MyISAM; +INSERT INTO geom VALUES + (MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), + (MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), + (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))))); +ANALYZE TABLE geom PERSISTENT FOR ALL; +--sorted_result +SELECT * FROM mysql.index_stats WHERE index_name='g' AND table_name='geom'; +DROP TABLE geom; diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 1c17743e7f1..77ce8c595ca 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -446,3 +446,50 @@ SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1; DROP TABLE t1; --echo End of 5.5 tests + +--echo # +--echo # MDEV-7254: Assigned expression is evaluated twice when updating column TIMESTAMP NOT NULL +--echo # + +SET time_zone='+02:00'; +create table t1(value timestamp not null); +set @a:=0; +delimiter //; +create function f1 () returns timestamp +begin + set @a = @a + 1; + return NULL; +end// +delimiter ;// +set timestamp=12340; +insert t1 values (f1()); +select @a, value from t1; +set timestamp=12350; +update t1 set value = f1(); +select @a, value from t1; +drop table t1; +drop function f1; +set timestamp=0; + +# Verify no regressions to TIMESTAMP NULL +create table t1(value timestamp null); +set @a:=0; +delimiter //; +create function f1 () returns timestamp +begin + set @a = @a + 1; + return NULL; +end// +delimiter ;// +set timestamp=12340; +insert t1 values (f1()); +select @a, value from t1; +set timestamp=12350; +update t1 set value = f1(); +select @a, value from t1; +drop table t1; +drop function f1; +set timestamp=0; +SET time_zone=DEFAULT; + +--echo End of 10.0 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index eb905b5c4df..ae78d5504cf 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5335,6 +5335,16 @@ DROP FUNCTION f1; DROP VIEW v1; DROP TABLE t1, t2; + +create view v1 as select 1; + +--let $MYSQLD_DATADIR= `select @@datadir` +--let SEARCH_FILE= $MYSQLD_DATADIR/test/v1.frm +--let SEARCH_PATTERN=mariadb-version +--source include/search_pattern_in_file.inc + +drop view v1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test index b7d31948d23..617daba6b8e 100644 --- a/mysql-test/t/windows.test +++ b/mysql-test/t/windows.test @@ -98,3 +98,19 @@ deallocate prepare abc; SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'socket'; + +--echo # +--echo # Bug#16581605: REPLACE.EXE UTILITY IS BROKEN IN 5.5 +--echo # + +# Creating a temporary text file. +--write_file $MYSQL_TMP_DIR/bug16581605.txt +abc +def +EOF + +#REPLACE.EXE UTILITY will work fine after the fix. +--exec $REPLACE abc xyz < $MYSQL_TMP_DIR/bug16581605.txt + +#Cleanup +remove_file $MYSQL_TMP_DIR/bug16581605.txt; |