diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-09-03 12:58:41 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-09-03 12:58:41 +0200 |
commit | 530a6e74819ec14b5fdc42aa588b236ecb9f2fcd (patch) | |
tree | a4d45b1fd0e434c23577507364fa443226676eb5 /mysql-test/t | |
parent | 5088cbf4ed7224698678f3eaf406361c6e7db4b8 (diff) | |
parent | 4b41e3c7f33714186c97a6cc2e6d3bb93b050c61 (diff) | |
download | mariadb-git-530a6e74819ec14b5fdc42aa588b236ecb9f2fcd.tar.gz |
Merge branch '10.0' into 10.1
referenced_by_foreign_key2(), needed for InnoDB to compile,
was taken from 10.0-galera
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/alter_table.test | 4 | ||||
-rw-r--r-- | mysql-test/t/blackhole_plugin.test | 2 | ||||
-rw-r--r-- | mysql-test/t/derived.test | 35 | ||||
-rw-r--r-- | mysql-test/t/empty_server_name-8224.test | 4 | ||||
-rw-r--r-- | mysql-test/t/func_gconcat.test | 11 | ||||
-rw-r--r-- | mysql-test/t/func_misc.test | 5 | ||||
-rw-r--r-- | mysql-test/t/grant.test | 23 | ||||
-rw-r--r-- | mysql-test/t/innodb_load_xa.test | 3 | ||||
-rw-r--r-- | mysql-test/t/mdev-504.test | 4 | ||||
-rw-r--r-- | mysql-test/t/myisam_recover-master.opt (renamed from mysql-test/t/merge_recover-master.opt) | 0 | ||||
-rw-r--r-- | mysql-test/t/myisam_recover.test (renamed from mysql-test/t/merge_recover.test) | 77 | ||||
-rw-r--r-- | mysql-test/t/mysql_upgrade.test | 1 | ||||
-rw-r--r-- | mysql-test/t/plugin.test | 2 | ||||
-rw-r--r-- | mysql-test/t/sp-group.test | 187 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 69 | ||||
-rw-r--r-- | mysql-test/t/subselect_sj2.test | 39 | ||||
-rw-r--r-- | mysql-test/t/subselect_sj_mat.test | 42 | ||||
-rw-r--r-- | mysql-test/t/type_binary.test | 26 | ||||
-rw-r--r-- | mysql-test/t/view.test | 21 |
19 files changed, 544 insertions, 11 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index cdc188b7776..bce7f3f95bb 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1,3 +1,7 @@ +if (`select plugin_auth_version < "5.6.26" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in XtraDB below 5.6.26 +} --source include/have_innodb.inc # # Test of alter table diff --git a/mysql-test/t/blackhole_plugin.test b/mysql-test/t/blackhole_plugin.test index 8af8fcc941c..0cc7ae0817c 100644 --- a/mysql-test/t/blackhole_plugin.test +++ b/mysql-test/t/blackhole_plugin.test @@ -7,7 +7,7 @@ DROP TABLE t1; --replace_regex /\.dll/.so/ eval INSTALL PLUGIN blackhole SONAME '$HA_BLACKHOLE_SO'; --replace_regex /\.dll/.so/ ---error 1125 +--error ER_PLUGIN_INSTALLED eval INSTALL PLUGIN BLACKHOLE SONAME '$HA_BLACKHOLE_SO'; UNINSTALL PLUGIN blackhole; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index ddce7f55292..d98e7b56905 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -492,7 +492,38 @@ update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where ac set optimizer_switch=@save_derived_optimizer_switch_bug; drop table t1; -set optimizer_switch=@save_derived_optimizer_switch; +--echo # +--echo # MDEV-6219:Server crashes in Bitmap<64u>::merge +--echo # (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT, +--echo # derived_merge +--echo # + +CREATE TABLE t1 (a VARCHAR(8)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'),('bar'); + +create procedure p1() + INSERT INTO t1 SELECT * FROM ( + SELECT * FROM t1 + ) AS sq + WHERE sq.a IN ( SELECT 'baz' FROM DUAL ); + +call p1(); +call p1(); +drop procedure p1; + +PREPARE stmt FROM " + INSERT INTO t1 SELECT * FROM ( + SELECT * FROM t1 + ) AS sq + WHERE sq.a IN ( SELECT 'baz' FROM DUAL ) +"; + +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; + +drop table t1; --echo # --echo # MDEV-6892: WHERE does not apply @@ -506,3 +537,5 @@ select x.id, message from (select id from t1) x left join (select id, 1 as message from t2) y on x.id=y.id where coalesce(message,0) <> 0; drop table t1,t2; + +set optimizer_switch=@save_derived_optimizer_switch; diff --git a/mysql-test/t/empty_server_name-8224.test b/mysql-test/t/empty_server_name-8224.test index 528bce5dac5..b15e9d82eb8 100644 --- a/mysql-test/t/empty_server_name-8224.test +++ b/mysql-test/t/empty_server_name-8224.test @@ -7,3 +7,7 @@ create server '' foreign data wrapper w2 options (host '127.0.0.1'); --shutdown_server 10 --source include/wait_until_disconnected.inc --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect + +-- enable_reconnect +-- source include/wait_until_connected_again.inc +drop server ''; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 42a30760a86..5550eebf1a3 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -821,3 +821,14 @@ FROM ( SELECT * FROM t2 ) AS sq2, t3 ORDER BY field; drop table t3, t2, t1; + +--echo # +--echo # MDEV-7821 - Server crashes in Item_func_group_concat::fix_fields on 2nd +--echo # execution of PS +--echo # +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1),(2); +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a, t1 AS t1b GROUP BY t1a.a"; +EXECUTE stmt; +EXECUTE stmt; +DROP TABLE t1; diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 5236987e16f..ef6472a3848 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -391,6 +391,11 @@ set optimizer_switch=@optimizer_switch_save; drop view v_merge, vm; drop table t1,tv; +--echo # +--echo # MDEV-4017 - GET_LOCK() with negative timeouts has strange behavior +--echo # +SELECT GET_LOCK('ul1', NULL); +SELECT GET_LOCK('ul1', -1); --echo # --echo # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 20632038273..b1580383f22 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1666,6 +1666,7 @@ FLUSH PRIVILEGES; CREATE DATABASE mysqltest1; CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER SELECT 1; +CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1; --error ER_NO_SUCH_TABLE GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost; GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost; @@ -2210,3 +2211,25 @@ DROP DATABASE secret; # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc +--echo # +--echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES +--echo # DIFFERENTLY'. +--echo # +--disable_warnings +drop database if exists mysqltest_db1; +--enable_warnings +create database mysqltest_db1; +create user mysqltest_u1; +--echo # Both GRANT statements below should fail with the same error. +--error ER_SP_DOES_NOT_EXIST +grant execute on function mysqltest_db1.f1 to mysqltest_u1; +--error ER_SP_DOES_NOT_EXIST +grant execute on procedure mysqltest_db1.p1 to mysqltest_u1; +--echo # Let us show that GRANT behaviour for routines is consistent +--echo # with GRANT behaviour for tables. Attempt to grant privilege +--echo # on non-existent table also results in an error. +--error ER_NO_SUCH_TABLE +grant select on mysqltest_db1.t1 to mysqltest_u1; +show grants for mysqltest_u1; +drop database mysqltest_db1; +drop user mysqltest_u1; diff --git a/mysql-test/t/innodb_load_xa.test b/mysql-test/t/innodb_load_xa.test index fe466e1f899..65b74120e8e 100644 --- a/mysql-test/t/innodb_load_xa.test +++ b/mysql-test/t/innodb_load_xa.test @@ -20,3 +20,6 @@ commit; show status like 'Handler_prepare'; drop table t1; uninstall plugin innodb; + +--source include/restart_mysqld.inc + diff --git a/mysql-test/t/mdev-504.test b/mysql-test/t/mdev-504.test index bc38e99067a..fb5c7666d33 100644 --- a/mysql-test/t/mdev-504.test +++ b/mysql-test/t/mdev-504.test @@ -1,5 +1,7 @@ --disable_ps_protocol +SET GLOBAL net_write_timeout = 900; + CREATE TABLE A ( pk INTEGER AUTO_INCREMENT PRIMARY KEY, fdate DATE @@ -74,4 +76,4 @@ DROP TABLE A; DROP PROCEDURE p_analyze; DROP FUNCTION rnd3; SET GLOBAL use_stat_tables = DEFAULT; - +SET GLOBAL net_write_timeout = DEFAULT; diff --git a/mysql-test/t/merge_recover-master.opt b/mysql-test/t/myisam_recover-master.opt index fca5ea079e3..fca5ea079e3 100644 --- a/mysql-test/t/merge_recover-master.opt +++ b/mysql-test/t/myisam_recover-master.opt diff --git a/mysql-test/t/merge_recover.test b/mysql-test/t/myisam_recover.test index f2cb204eeb6..49fe9c33460 100644 --- a/mysql-test/t/merge_recover.test +++ b/mysql-test/t/myisam_recover.test @@ -1,5 +1,9 @@ +--source include/count_sessions.inc + +--echo # +--echo # Tests for corrupted MyISAM tables and MyISAMMRG tables with corrupted +--echo # children.. --echo # ---echo # Test of MyISAM MRG tables with corrupted children. --echo # Run with --myisam-recover=force option. --echo # --echo # Preparation: we need to make sure that the merge parent @@ -57,10 +61,10 @@ eval $lock; --echo # connection default; --echo # ---echo # We have to disable the ps-protocol, to avoid +--echo # We have to disable the ps-protocol, to avoid --echo # "Prepared statement needs to be re-prepared" errors --echo # -- table def versions change all the time with full table cache. ---echo # +--echo # --disable_ps_protocol --disable_warnings drop table if exists t1, t1_mrg, t1_copy; @@ -69,12 +73,12 @@ let $MYSQLD_DATADIR=`select @@datadir`; --echo # --echo # Prepare a MERGE engine table, that refers to a corrupted --echo # child. ---echo # +--echo # create table t1 (a int, key(a)) engine=myisam; create table t1_mrg (a int) union (t1) engine=merge; --echo # --echo # Create a table with a corrupted index file: ---echo # save an old index file, insert more rows, +--echo # save an old index file, insert more rows, --echo # overwrite the new index file with the old one. --echo # insert into t1 (a) values (1), (2), (3); @@ -111,3 +115,66 @@ set @@global.table_open_cache=default; disconnect con1; connection default; --enable_ps_protocol + +--echo # +--echo # 18075170 - sql node restart required to avoid deadlock after +--echo # restore +--echo # +--echo # Check that auto-repair for MyISAM tables can now happen in the +--echo # middle of transaction, without aborting it. +--enable_prepare_warnings + +connection default; + +create table t1 (a int, key(a)) engine=myisam; +create table t2 (a int); +insert into t2 values (1); + +--echo # Create a table with a corrupted index file: +--echo # save an old index file, insert more rows, +--echo # overwrite the new index file with the old one. +insert into t1 (a) values (1); +flush table t1; +--copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t1_copy.MYI +insert into t1 (a) values (4); +flush table t1; +--remove_file $MYSQLD_DATADIR/test/t1.MYI +--copy_file $MYSQLD_DATADIR/test/t1_copy.MYI $MYSQLD_DATADIR/test/t1.MYI +--remove_file $MYSQLD_DATADIR/test/t1_copy.MYI + +--echo # Check table is needed to mark the table as crashed. +check table t1; + +--echo # At this point we have a corrupt t1 +set autocommit = 0; +select * from t2; +--echo # Without fix select from t1 will break the transaction. After the fix +--echo # transaction should be active and should hold lock on table t2. Alter +--echo # table from con2 will wait only if the transaction is not broken. +--replace_regex /'.*[\/\\]/'/ +select * from t1; + +connect(con2, localhost, root); +--SEND ALTER TABLE t2 ADD val INT + +connection default; +--echo # With fix we should have alter table waiting for t2 lock here. +let $wait_condition= + SELECT count(*) = 1 FROM information_schema.processlist WHERE state + LIKE "Waiting%" AND info = "ALTER TABLE t2 ADD val INT"; + +--source include/wait_condition.inc +ROLLBACK; +SET autocommit = 1; + +connection con2; +--REAP + +connection default; +disconnect con2; + +--echo # Cleanup +drop table t1, t2; + +# Wait till all disconnects are completed +-- source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index 8c641428353..a24ba0de2d9 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -15,7 +15,6 @@ file_exists $MYSQLD_DATADIR/mysql_upgrade_info; --echo Run it again - should say already completed --replace_result $MYSQL_SERVER_VERSION VERSION ---error 1 --exec $MYSQL_UPGRADE 2>&1 # It should have created a file in the MySQL Servers datadir diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 13e2c71fbc4..ec7117bb832 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -6,7 +6,7 @@ DROP TABLE t1; INSTALL PLUGIN example SONAME 'ha_example'; --replace_regex /\.dll/.so/ ---error 1125 +--error ER_PLUGIN_INSTALLED INSTALL PLUGIN EXAMPLE SONAME 'ha_example'; UNINSTALL PLUGIN example; diff --git a/mysql-test/t/sp-group.test b/mysql-test/t/sp-group.test new file mode 100644 index 00000000000..2083ac97595 --- /dev/null +++ b/mysql-test/t/sp-group.test @@ -0,0 +1,187 @@ +--source include/have_innodb.inc + +drop table if exists t1; +drop view if exists view_t1; + +# +# Test case for MDEV 7601, MDEV-7594 and MDEV-7555 +# Server crashes in functions related to stored procedures +# Server crashes in different ways while executing concurrent +# flow involving views and non-empty sql_mode with ONLY_FULL_GROUP_BY +# + +SET sql_mode=ONLY_FULL_GROUP_BY; + +CREATE TABLE t1 ( + pk INT, + f0 INT, f1 INT, f2 INT, f3 INT, f4 INT, + f5 INT, f6 INT, f7 INT, f8 INT, f9 INT, + PRIMARY KEY (pk) +); + +CREATE VIEW view_t1 AS SELECT * FROM t1; +CREATE PROCEDURE s1() + SELECT * FROM ( + INFORMATION_SCHEMA.`INNODB_BUFFER_PAGE_LRU` AS table1 + LEFT JOIN test.view_t1 AS table2 + ON ( table2.`f6` = table1.FREE_PAGE_CLOCK) + ) + ORDER BY table1.NUMBER_RECORDS + LIMIT 0 +; +CALL s1; +CALL s1; + +drop table t1; +drop view view_t1; +drop procedure s1; + +# +# MDEV-7590 +# Server crashes in st_select_lex_unit::cleanup on executing a trigger +# + +CREATE TABLE A ( + pk INTEGER AUTO_INCREMENT, + col_int_key INTEGER, + col_varchar_key VARCHAR(1), + PRIMARY KEY (pk) +) ENGINE=MyISAM; +CREATE VIEW view_A AS SELECT * FROM A; +CREATE TABLE C ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER, + col_date_key DATE, + col_date_nokey DATE, + col_time_key TIME, + col_time_nokey TIME, + col_datetime_key DATETIME, + col_datetime_nokey DATETIME, + col_varchar_key VARCHAR(1), + col_varchar_nokey VARCHAR(1), + PRIMARY KEY (pk) +) ENGINE=MyISAM; +CREATE VIEW view_C AS SELECT * FROM C; +CREATE TABLE AA ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER, + col_date_key DATE, + col_date_nokey DATE, + col_time_key TIME, + col_time_nokey TIME, + col_datetime_key DATETIME, + col_datetime_nokey DATETIME, + col_varchar_key VARCHAR(1), + col_varchar_nokey VARCHAR(1), + PRIMARY KEY (pk), + KEY (col_varchar_key, col_int_key) +) ENGINE=MyISAM; +CREATE VIEW view_AA AS SELECT * FROM AA; +CREATE TABLE BB ( + pk INTEGER AUTO_INCREMENT, + col_int_key INTEGER, + col_varchar_key VARCHAR(1), + col_varchar_nokey VARCHAR(1), + PRIMARY KEY (pk), + KEY (col_varchar_key, col_int_key) +) ENGINE=MyISAM; +CREATE VIEW view_BB AS SELECT * FROM BB; +CREATE TABLE DD ( + pk INTEGER AUTO_INCREMENT, + col_int_key INTEGER, + col_date_key DATE, + col_time_key TIME, + col_datetime_key DATETIME, + col_varchar_key VARCHAR(1), + PRIMARY KEY (pk), + KEY (col_varchar_key, col_int_key) +) ENGINE=MyISAM; +CREATE VIEW view_DD AS SELECT * FROM DD; +CREATE TRIGGER k BEFORE INSERT ON `DD` FOR EACH ROW INSERT INTO `view_BB` SELECT * FROM `view_A` LIMIT 0 ; +CREATE TRIGGER r BEFORE INSERT ON `A` FOR EACH ROW INSERT INTO `view_AA` SELECT * FROM `view_C` LIMIT 0 ; +--error ER_WRONG_AUTO_KEY +ALTER TABLE `DD` DROP PRIMARY KEY; +INSERT INTO `view_A` ( `pk` ) VALUES (NULL); +--error 0,ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO `DD` ( `pk` ) VALUES (NULL); +INSERT INTO `A` ( `pk` ) VALUES (NULL); +--error 0,ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO `view_DD` ( `pk` ) VALUES (NULL); + +drop trigger r; +drop trigger k; +drop view view_A,view_AA,view_C,view_BB,view_DD; +drop table A,C,AA,BB,DD; + +# +# MDEV-7581 +# Server crashes in st_select_lex_unit::cleanup after a sequence of statements +# + +CREATE TABLE A ( + i INT, + i1 INT, + i2 INT, + d1 DATE, + d2 DATE, + col_time_nokey1 TIME, + col_time_nokey2 TIME, + col_datetime_nokey1 DATETIME, + col_datetime_nokey2 DATETIME, + col_varchar_nokey1 VARCHAR(1), + col_varchar_nokey2 VARCHAR(1) +) ENGINE=MyISAM; + +CREATE VIEW view_A AS SELECT * FROM A; + +CREATE TABLE B ( + col_varchar_nokey VARCHAR(1) +) ENGINE=MyISAM; + +CREATE TABLE AA ( + i INT, + i1 INT, + i2 INT, + d1 DATE, + d2 DATE, + col_time_nokey1 TIME, + col_time_nokey2 TIME, + col_datetime_nokey1 DATETIME, + col_datetime_nokey2 DATETIME, + col_varchar_nokey1 VARCHAR(1), + col_varchar_nokey2 VARCHAR(1) +) ENGINE=MyISAM; + +CREATE VIEW view_AA AS SELECT * FROM AA; + +CREATE TABLE DD ( + i INT, + i1 INT, + i2 INT, + d1 DATE, + d2 DATE, + col_time_nokey1 TIME, + col_time_nokey2 TIME, + col_datetime_nokey1 DATETIME, + col_datetime_nokey2 DATETIME, + col_varchar_nokey1 VARCHAR(1), + col_varchar_nokey2 VARCHAR(1) +) ENGINE=MyISAM; + +CREATE VIEW view_DD AS SELECT * FROM DD; + +CREATE TRIGGER tr1 BEFORE INSERT ON `AA` FOR EACH ROW INSERT INTO `view_A` SELECT * FROM `view_AA` LIMIT 0 ; +CREATE TRIGGER tr2 BEFORE INSERT ON `B` FOR EACH ROW INSERT INTO `D` SELECT * FROM `A` LIMIT 0 ; + +INSERT INTO `view_AA` ( `i` ) VALUES (1); +INSERT INTO `AA` ( `i` ) VALUES (2); +DELETE FROM `B`; +INSERT INTO `view_DD` ( `i` ) VALUES (1); +INSERT INTO `view_AA` ( `i` ) VALUES (3); + +drop trigger tr1; +drop trigger tr2; +drop view view_A, view_AA,view_DD; +drop table A,B,AA,DD; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 7dda755481c..3a4ddee1de2 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9301,6 +9301,75 @@ DROP TABLE t1; --echo # End of 5.5 test +--echo # +--echo # MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2 +--echo # +create table t1 ( + col1 bigint(20), + col2 char(1), + col3 char(2) +); +insert into t1 values (1,'a','a'), (2,'b','b'); + +create table t2 as select * from t1; +create table t3 as select * from t1; +create table t4 as select * from t1; +create table t5 as select * from t1; +create table t6 as select * from t1; + +flush tables; + +DELIMITER |; + +CREATE PROCEDURE p1() +begin + DECLARE _var1 bigint(20) UNSIGNED; + DECLARE _var2 CHAR(1) DEFAULT NULL; + DECLARE _var3 CHAR(1) DEFAULT NULL; + + DECLARE _done BOOLEAN DEFAULT 0; + + declare cur1 cursor for + select col1, col2, col3 + from t1 + where + col1 in (select t2.col1 from t2 where t2.col2=t1.col2) or + col2 in (select t3.col3 from t3 where t3.col3=t1.col2) ; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1; + + OPEN cur1; + + set _var1 = (select _var1 from t4 limit 1); + set _var1 = (select _var1 from t5 limit 1); + set _var1 = (select _var1 from t6 limit 1); +label1: + LOOP + SET _done = 0; + FETCH cur1 INTO _var1, _var2, _var3; + IF _done THEN + LEAVE label1; + END IF; + END LOOP label1; + CLOSE cur1; +end| +DELIMITER ;| + +set @tmp_toc= @@table_open_cache; +set @tmp_tdc= @@table_definition_cache; + +set global table_open_cache=1; +set global table_definition_cache=1; +call p1(); + +set global table_open_cache= @tmp_toc; +set global table_definition_cache= @tmp_tdc; +drop procedure p1; + +drop table t1,t2,t3,t4,t5,t6; + +--echo # End of 10.0 test + DELIMITER |; CREATE FUNCTION f(f1 VARCHAR(64) COLLATE latin1_german2_ci) RETURNS VARCHAR(64) diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test index 7ee52a0fa8a..5d6639a6d5a 100644 --- a/mysql-test/t/subselect_sj2.test +++ b/mysql-test/t/subselect_sj2.test @@ -1410,5 +1410,44 @@ eval explain $query; drop table t3,t2,t1; set optimizer_search_depth=@tmp7474; +--echo # +--echo # +--echo # +CREATE TABLE t1 ( + id int(16) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE t2 ( + id int(16) NOT NULL AUTO_INCREMENT, + t3_id int(16) NOT NULL DEFAULT '0', + t1_id int(16) NOT NULL DEFAULT '0', + PRIMARY KEY (id), + KEY t3_idx (t3_id), + KEY t1_idx (t1_id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE t3 ( + id int(16) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (id) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + +INSERT INTO t3 VALUES (1); + +INSERT INTO t2 VALUES (1, 1, 1); +INSERT INTO t2 VALUES (2, 1, 2); +INSERT INTO t2 VALUES (3, 1, 2); +INSERT INTO t2 VALUES (4, 1, 1); + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); + +SELECT * FROM t1 WHERE t1.id IN ( + SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1 +); + +drop table t1,t2,t3; + --echo # This must be the last in the file: set optimizer_switch=@subselect_sj2_tmp; diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test index c34c805f90c..d2bafa86028 100644 --- a/mysql-test/t/subselect_sj_mat.test +++ b/mysql-test/t/subselect_sj_mat.test @@ -1841,8 +1841,23 @@ drop database mysqltest2; drop database mysqltest3; drop database mysqltest4; ---echo # End of 5.5 tests +--echo # +--echo # MDEV-7810 Wrong result on execution of a query as a PS +--echo # (both 1st and further executions) + +CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0),(8); + +SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)); +PREPARE stmt FROM " +SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2)) +"; +execute stmt; +execute stmt; + +drop table t1; +--echo # End of 5.5 tests --echo # --echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT --echo # @@ -1885,3 +1900,28 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b); show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%'; drop table t0,t1,t2,t3; + +--echo # +--echo # MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup +--echo # on 2nd execution os PS with multi-table update +--echo # +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (f2 INT); +INSERT INTO t2 VALUES (3),(4); + +CREATE TABLE t3 (f3 INT); +INSERT INTO t3 VALUES (5),(6); + +PREPARE stmt FROM ' + UPDATE t1, t2 + SET f1 = 5 + WHERE 8 IN ( SELECT MIN(f3) FROM t3 ) +'; + +EXECUTE stmt; +EXECUTE stmt; + +DROP TABLE t1,t2,t3; + diff --git a/mysql-test/t/type_binary.test b/mysql-test/t/type_binary.test index 4d5a5312472..b583e257aa9 100644 --- a/mysql-test/t/type_binary.test +++ b/mysql-test/t/type_binary.test @@ -100,3 +100,29 @@ select hex(f2), hex(f3) from t1; drop table t1; --echo End of 5.0 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-8472 BINARY, VARBINARY and BLOB return different warnings on CAST to DECIMAL +--echo # +SET NAMES utf8; +CREATE TABLE t1 (a BINARY(30)); +INSERT INTO t1 VALUES ('1äÖüß@µ*$'); +SELECT CAST(a AS DECIMAL) FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a VARBINARY(30)); +INSERT INTO t1 VALUES ('1äÖüß@µ*$'); +SELECT CAST(a AS DECIMAL) FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES ('1äÖüß@µ*$'); +SELECT CAST(a AS DECIMAL) FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.0 tests +--echo # + diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index e95194e3f2c..8c2a8ac8dc2 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5380,6 +5380,27 @@ show create view v2; drop view v2; drop table t1; +--echo # +--echo # MDEV-8554: Server crashes in base_list_iterator::next_fast on 1st execution of PS with a multi-table update +--echo # +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); # Not necessary, the table can be empty + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); # Not necessary, the table can be empty + +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (5),(6); # Not necessary, the table can be empty + +CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3; + +PREPARE stmt FROM 'UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM t3 )'; +UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 ); +EXECUTE stmt; + +DROP TABLE t1, t2, t3; +DROP VIEW v3; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- |