diff options
Diffstat (limited to 'mysql-test/t')
32 files changed, 1110 insertions, 39 deletions
diff --git a/mysql-test/t/alter_table_online.test b/mysql-test/t/alter_table_online.test index be8037abe11..20dbfe9c46a 100644 --- a/mysql-test/t/alter_table_online.test +++ b/mysql-test/t/alter_table_online.test @@ -7,7 +7,7 @@ drop table if exists t1,t2,t3; --enable_warnings # -# Test of things that can be done online +# Test of things that can not be done online # create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')); @@ -24,6 +24,13 @@ alter online table t1 comment "new comment"; --error ER_ALTER_OPERATION_NOT_SUPPORTED alter online table t1 rename to t2; +# No OPs + +alter online table t1 algorithm=INPLACE, lock=NONE; +alter online table t1; +alter table t1 algorithm=INPLACE; +alter table t1 lock=NONE; + drop table t1; # diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test index 32d7d70200a..7f394e0f846 100644 --- a/mysql-test/t/blackhole.test +++ b/mysql-test/t/blackhole.test @@ -17,6 +17,16 @@ SELECT 1 FROM t1 WHERE a = ANY (SELECT a FROM t2); DROP TABLE t1, t2; +# +# Bug#19786309 - CRASH IN UNLOCK TABLES AFTER LOCKING AND TRUNCATING TEMPORARY TABLE. +# +create temporary table t1 (a int) engine=blackhole; +lock table t1 write; +truncate table t1; +select * from t1; +unlock tables; +drop temporary table t1; + --echo End of 5.5 tests --echo # diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index 2c6040af7a1..97376eb7412 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -60,3 +60,32 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' and SUPPORT='YES'; --echo End of 5.5 tests + +--source include/not_windows_embedded.inc +--source include/have_example_plugin.inc +# +# Check that --bootstrap can install and uninstall plugins +# +let $PLUGIN_DIR=`select @@plugin_dir`; +--write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql +install soname 'ha_example'; +uninstall plugin unusable; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql + +# +# Check that installed plugins are *not* automatically loaded in --bootstrap +# +--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql +use test; +create table t1(a int) engine=example; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql +flush tables; +show create table t1; +drop table t1; +--replace_result .dll .so +select * from mysql.plugin; +truncate table mysql.plugin; diff --git a/mysql-test/t/bug46261-master.opt b/mysql-test/t/bug46261-master.opt deleted file mode 100644 index 5699a3387b8..00000000000 --- a/mysql-test/t/bug46261-master.opt +++ /dev/null @@ -1 +0,0 @@ ---skip-grant-tables diff --git a/mysql-test/t/bug46261.test b/mysql-test/t/bug46261.test deleted file mode 100644 index 9d8eecf3d52..00000000000 --- a/mysql-test/t/bug46261.test +++ /dev/null @@ -1,16 +0,0 @@ ---source include/not_embedded.inc ---source include/have_example_plugin.inc - ---echo # ---echo # Bug#46261 Plugins can be installed with --skip-grant-tables ---echo # - ---replace_regex /\.dll/.so/ ---error ER_OPTION_PREVENTS_STATEMENT -eval INSTALL PLUGIN example SONAME '$HA_EXAMPLE_SO'; - ---replace_regex /\.dll/.so/ ---error ER_OPTION_PREVENTS_STATEMENT -eval UNINSTALL PLUGIN example; - ---echo End of 5.1 tests diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index 95008d83a38..5e8195e4718 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -507,6 +507,17 @@ select * from t1 where c1 = '=> dž'; select * from t1 where concat(c1) = '=> dž'; drop table t1; + +--echo # +--echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal +--echo # + +SET NAMES utf8 COLLATE utf8_unicode_ci; +--let ENGINE=MyISAM +--source include/ctype_utf8_ilseq.inc +--let ENGINE=HEAP +--source include/ctype_utf8_ilseq.inc + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_uca_innodb.test b/mysql-test/t/ctype_uca_innodb.test new file mode 100644 index 00000000000..cb6caff4a03 --- /dev/null +++ b/mysql-test/t/ctype_uca_innodb.test @@ -0,0 +1,25 @@ +# +# Tests for UCA collations with InnoDB +# + +let collation=utf8_unicode_ci; +--source include/have_collation.inc +--source include/have_innodb.inc + + +--echo # +--echo # Start of 5.5 tests +--echo # + + +--echo # +--echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal +--echo # + +SET NAMES utf8 COLLATE utf8_unicode_ci; +--let ENGINE=InnoDB +--source include/ctype_utf8_ilseq.inc + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 7897462aa02..dba00e96491 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1616,6 +1616,26 @@ UNION ALL SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; --echo # +--echo # MDEV-7814 Assertion `args[0]->fixed' fails in Item_func_conv_charset::Item_func_conv_charset +--echo # +CREATE TABLE t1(a CHAR(1) CHARACTER SET latin1, b INT NOT NULL); +CREATE TABLE t2(a CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci, b INT NOT NULL); +SELECT (SELECT t2.a FROM t2 WHERE t2.a=t1.a) AS aa, b, COUNT(b) FROM t1 GROUP BY aa; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal +--echo # + +SET NAMES utf8 COLLATE utf8_general_ci; +--let ENGINE=InnoDB +--source include/ctype_utf8_ilseq.inc +--let ENGINE=MyISAM +--source include/ctype_utf8_ilseq.inc +--let ENGINE=HEAP +--source include/ctype_utf8_ilseq.inc + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 61ae3695a1f..ddce7f55292 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -492,5 +492,17 @@ 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-6892: WHERE does not apply +--echo # +create table t1 (id int); +create table t2 (id int); +insert into t1 values(1),(2),(3); +insert into t2 values(4),(5),(6); +#explain extended +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; diff --git a/mysql-test/t/explain_non_select.test b/mysql-test/t/explain_non_select.test index f05373c312e..e36fd518b61 100644 --- a/mysql-test/t/explain_non_select.test +++ b/mysql-test/t/explain_non_select.test @@ -197,4 +197,14 @@ select 'OK'; drop function f1; drop table t1; +--echo # +--echo # MDEV-7038: Assertion `status_var.memory_used == 0' failed in THD::~THD() +--echo # on disconnect after executing EXPLAIN for multi-table UPDATE +--echo # +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); +EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1; +DROP TABLE t1; +DROP VIEW v1; diff --git a/mysql-test/t/filesort_bad_i_s-7585.test b/mysql-test/t/filesort_bad_i_s-7585.test new file mode 100644 index 00000000000..daf70acdd52 --- /dev/null +++ b/mysql-test/t/filesort_bad_i_s-7585.test @@ -0,0 +1,14 @@ +# +# MDEV-7585 Assertion `thd->is_error() || kill_errno || thd->killed == ABORT_QUERY' failed in ha_rows filesort +# +SET sql_mode=STRICT_TRANS_TABLES; + +CREATE TABLE t0 (i INT) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT * FROM t0; +CREATE VIEW v2 AS SELECT * FROM v1; +DROP VIEW IF EXISTS v1; + +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 SELECT TABLE_ROWS FROM information_schema.tables ORDER BY TABLE_ROWS; +DROP VIEW v2; +DROP TABLE t1, t0; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 7643676ea61..42a30760a86 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -803,3 +803,21 @@ create table t1 (a char(1) character set utf8); insert into t1 values ('a'),('b'); select 1 from t1 where a in (select group_concat(a) from t1); drop table t1; + +# +# MDEV-7820 Server crashes in in my_strcasecmp_utf8 on subquery in ORDER BY clause of GROUP_CONCAT +# +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('a'),('b'); + +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'); + +CREATE TABLE t3 (f3 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('d'),('e'); + +SELECT GROUP_CONCAT( f2 ORDER BY ( f2 IN ( SELECT f1 FROM t1 WHERE f1 <= f2 ) ) ) AS field +FROM ( SELECT * FROM t2 ) AS sq2, t3 +ORDER BY field; + +drop table t3, t2, t1; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index f4e89da330e..2d05d35bb13 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -5,10 +5,6 @@ # Spatial objects # ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; ---enable_warnings - CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT); CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING); CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON); @@ -1449,6 +1445,14 @@ drop table t1; # SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); +# +# MDEV-7779 View definition changes upon creation +# +CREATE VIEW v1 AS SELECT POINT(1,1) AS p; +SHOW CREATE VIEW v1; +SELECT ASTEXT(p) FROM v1; +DROP VIEW v1; + --echo End of 5.5 tests SHOW CREATE TABLE information_schema.geometry_columns; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 4b1cb82d0f9..dfb7f28ab28 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1515,6 +1515,17 @@ let $query= SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; --echo DROP TABLE t1; + +# +# Bug#19880368 : GROUP_CONCAT CRASHES AFTER DUMP_LEAF_KEY +# +create table t1 (a int, b int); +insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45); +create table t2 (c int, d int); +insert into t2 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45); +select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b); +drop table t1, t2; + --echo # --echo # LP bug#993726 Wrong result from a query with ALL subquery predicate in WHERE --echo # diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index cd6a4c9d328..0f6be0b0ec6 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -694,6 +694,41 @@ DROP TABLE t1; --echo End of 5.3 tests --echo # +--echo # Bug MDEV-7301: Unknown column quoted with backticks in HAVING clause when using function. +--echo # Bug#16221433 MYSQL REJECTS QUERY DUE TO BAD RESOLUTION OF NAMES IN HAVING; VIEW UNREADABLE +--echo # + +CREATE TABLE `t1` ( + `id` int(11) NOT NULL, + `title` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) DEFAULT CHARSET=utf8; + +INSERT INTO `t1` VALUES ('1', 'Just for fun'); +INSERT INTO `t1` VALUES ('2', 'Wait until a sunhine'); +INSERT INTO `t1` VALUES ('3', 'Take a new turn'); + +SELECT `id`, SHA1(`title`) AS `column_1` +FROM `t1` +HAVING `column_1` LIKE '8%'; + +--echo expected 1 row(s) returned + +SELECT `id`, SHA1(`title`) AS `column_1` +FROM `t1` +HAVING UPPER(column_1) LIKE '8%'; + +--echo expected -- 1 row(s) returned + +SELECT `id`, SHA1(`title`) AS `column_1` +FROM `t1` +HAVING UPPER(`column_1`) LIKE '8%'; + +--echo expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR + +drop table t1; + +--echo # --echo # Bug mdev-5160: two-way join with HAVING over the second table --echo # @@ -708,4 +743,3 @@ SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1; DROP TABLE t1,t2; --echo End of 10.0 tests - diff --git a/mysql-test/t/log_errchk.test b/mysql-test/t/log_errchk.test index e4bc6a841dd..2808458e9f1 100644 --- a/mysql-test/t/log_errchk.test +++ b/mysql-test/t/log_errchk.test @@ -6,7 +6,8 @@ # Bug#14757009 : WHEN THE GENERAL_LOG IS A SOCKET AND THE READER GOES AWAY, # MYSQL QUITS WORKING. # -call mtr.add_suppression("Could not use"); +# MDEV-6870 Not possible to use FIFO file as a general_log file +# --let $gen_log_file= $MYSQLTEST_VARDIR/tmp/general_log.fifo --let $slow_query_log_file= $MYSQLTEST_VARDIR/tmp/slow_log.fifo @@ -15,10 +16,9 @@ call mtr.add_suppression("Could not use"); --exec mkfifo $gen_log_file --exec mkfifo $slow_query_log_file ---echo # Case 1: Setting fife file to general_log_file and slow_query_log_file +--echo # Case 1: Setting fifo file to general_log_file and slow_query_log_file --echo # system variable. -# Only regular files can be set to general log. Setting fifo file to general log -# reports an error. +# Setting fifo file to general log reports an error because the other end is closed --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error ER_WRONG_VALUE_FOR_VAR --eval SET GLOBAL general_log_file="$gen_log_file"; @@ -38,11 +38,12 @@ call mtr.add_suppression("Could not use"); --exec echo "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc -# With fix error should be reported in the error log file if file is not a -# regular file. +# Error 6 is reported, because the other end is closed +call mtr.add_suppression("Could not use .* for logging \\(error 6\\)"); +call mtr.add_suppression("File '.*' not found \\(Errcode: 6 "); --perl my $file= $ENV{'GREP_FILE'}; - my $pattern= "Turning logging off for the whole duration"; + my $pattern= "for logging \\(error 6\\)\\. Turning logging off for the whole duration"; open(FILE, "$file") or die("Unable to open $file: $!\n"); my $count = 0; while (<FILE>) { diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 4f8736f0c2d..c013938416e 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -849,6 +849,212 @@ update t1 join v3 using (id) set t1.a=0; drop view v1, v2, v3; drop table t2, t3, t1; +--echo # +--echo # MDEV-7613: MariaDB 5.5.40 server crash on update table left join +--echo # with a view +--echo # + +CREATE TABLE `t1` ( + `f1` varchar(6) COLLATE latin1_general_ci DEFAULT NULL, + `f2` varchar(6) COLLATE latin1_general_ci DEFAULT NULL, + `f3` varchar(7) COLLATE latin1_general_ci DEFAULT NULL, + `f4` varchar(15) COLLATE latin1_general_ci DEFAULT NULL, + `f5` datetime DEFAULT NULL, + `f6` varchar(2) COLLATE latin1_general_ci DEFAULT NULL, + `f7` varchar(2) COLLATE latin1_general_ci DEFAULT NULL, + `ff1` int(1) DEFAULT NULL, + `ff2` int(1) DEFAULT NULL, + `ff3` int(1) DEFAULT NULL, + `ff4` int(1) DEFAULT NULL, + `ff5` int(1) DEFAULT NULL, + `ff6` int(1) DEFAULT NULL, + `ff7` int(1) DEFAULT NULL, + `ff8` int(2) DEFAULT NULL, + `ff9` int(1) DEFAULT NULL, + `ff10` int(1) DEFAULT NULL, + `ff11` int(1) DEFAULT NULL, + `ff12` int(1) DEFAULT NULL, + `ff13` int(1) DEFAULT NULL, + `ff14` int(1) DEFAULT NULL, + `ff15` int(1) DEFAULT NULL, + `f8` varchar(70) COLLATE latin1_general_ci DEFAULT NULL, + `f9` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, + `f10` varchar(50) COLLATE latin1_general_ci NOT NULL, + `f11` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f12` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `f13` text COLLATE latin1_general_ci, + `f14` time DEFAULT NULL, + `f15` varchar(30) COLLATE latin1_general_ci DEFAULT NULL, + `fg1` int(11) DEFAULT NULL, + `fg2` int(11) DEFAULT NULL, + `fg3` int(11) DEFAULT NULL, + `fg4` int(11) DEFAULT NULL, + `fg5` int(11) DEFAULT NULL, + `fg6` int(11) DEFAULT NULL, + `fg7` int(11) DEFAULT NULL, + `fg9` int(11) DEFAULT NULL, + `fg10` int(11) DEFAULT NULL, + `fg11` int(11) DEFAULT NULL, + `fg12` int(11) DEFAULT NULL, + `fg13` int(11) DEFAULT NULL, + `fg14` int(11) DEFAULT NULL, + `fg15` int(11) DEFAULT NULL, + `f16` double DEFAULT NULL, + `f17` double DEFAULT NULL, + `f18` int(11) DEFAULT NULL, + `f19` int(11) DEFAULT NULL, + `f20` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `f21` int(11) DEFAULT NULL, + `f22` int(11) DEFAULT NULL, + `f23` int(11) DEFAULT NULL, + `f24` double DEFAULT NULL, + `f25` int(11) DEFAULT NULL, + `f26` double DEFAULT NULL, + `f27` int(11) DEFAULT NULL, + `f28` int(11) DEFAULT NULL, + `f29` double DEFAULT NULL, + `f30` int(11) DEFAULT NULL, + `f31` double DEFAULT NULL, + `PZ` double DEFAULT NULL, + `f32` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f33` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f34` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f35` varchar(30) COLLATE latin1_general_ci DEFAULT NULL, + `f36` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, + `f37` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f20_2` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, + `f38` varchar(30) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'Email = E-Mail / Whitemail = Brief', + `insert_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`f10`), + KEY `f5_f12` (`f5`,`f12`), + KEY `f5_f20` (`f5`,`f20`), + KEY `f5_f33` (`f5`,`f33`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT; + +INSERT INTO `t1` VALUES ('2011/2','201105','2011/19','gstfbnfr','2011-05-06 +00:00:00','gg','Ag',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'','','','','','','21:56:28','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,0,0,'Dffgult',1,0,0,NULL,0,NULL,0,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ggggil',NULL),('2008/4','200812','2008/50','hgckbgfx','2008-12-08 +00:00:00','gg','Ag',2,NULL,2,1,1,1,1,24,1,NULL,1,1,1,2,0,'gusschlifßlich +zugg +gflffonifrfn','88.77.79.214','10001614','fg-gtgggggdgtfn','fg-gtgggggdgtfn','birgit.tfrpfllf@gggx.df','11:55:21',NULL,1,0,1,1,1,1,1,1,0,1,1,1,0,0,NULL,NULL,0,4,'ffrtrgg',1,6,10,1.66666666666667,4,1,10,14,1.4,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/51','hgckbgfx','2008-12-15 +00:00:00','gg','Ag',4,5,5,4,5,5,5,NULL,4,5,1,1,1,4,0,'gusschlifßlich zugg +gflffonifrfn','79.197.185.64','10001686','fg-gtgggggdgtfn','fg-gtgggggdgtfn','kgtjg@swfftys.df','09:28:42',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,11,4.71428571428571,16,1.2,12,49,4.08111111111111,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/50','nufchti','2008-12-08 +00:00:00','gg','Ag',4,1,1,5,5,5,5,12,4,5,1,1,2,1,0,'gusschlifßlich zugg +gflffonifrfn','89.54.151.216','10001700','fg-gtgggggdgtfn','fg-gtgggggdgtfn','H_K2006@frffnft.df','16:41:45',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,10,4.28571428571429,11,2.6,12,41,1.58111111111111,1,NULL,NULL,'ffrtrgg +Bgckofficf 5','vb5','Nufchtfr, +Iris','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','junghdro','2008-12-11 +00:00:00','Do','Ag',2,2,5,5,4,4,2,72,2,5,2,2,1,1,0,'gusschlifßlich zugg +gflffonifrfn','84.61.20.216','10001849','fg-ggriff','fg-ggriff','schofnf-glftfr@grcor.df','20:18:05',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,24,1.42857142857141,12,2.4,12,16,1,1,NULL,NULL,'ffrtrgg +Bgckofficf 5','vb5','Junghfinrich, +Dorothfg','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','fbflktj','2008-12-08 +00:00:00','gg','Ag',4,2,2,5,1,1,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg +bzw. DigiCggg +Funktion','217.84.62.6','10001888','fg-Kündigungfn','fg-Kündigungfn','f.frofschkf@gggx.df','21:05:59',NULL,1,1,1,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,7,16,2.28571428571429,0,NULL,7,16,2.28571428571429,0,NULL,NULL,'out',NULL,'gbfl, +Kgtjg','49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','gltggggri','2008-12-09 +00:00:00','Di','Ag',4,1,1,4,2,1,2,16,1,2,2,2,2,2,0,'gusschlifßlich zugg +gflffonifrfn','81.171.157.211','10001988','fg-gtgggggdgtfn','fg-gtgggggdgtfn','bistfr@nftcolognf.df','11:07:54',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,21,1,11,2.2,12,12,2.66666666666667,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','ggufllfsg','2008-12-09 +00:00:00','Di','Ag',2,2,2,2,1,1,2,12,2,2,2,1,1,2,0,'ggobilfs +Intfrnft','62.154.142.186','10002097','fg-gtgggggdgtfn','fg-gtgggggdgtfn','norbfrtwfdlich@fgggil.df','09:42:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,12,1.71428571428571,8,1.6,12,20,1.66666666666667,1,NULL,NULL,'ffrtrgg +Bgckofficf 1','vb1','Mufllfr, +ggbinf','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','wggnfg','2008-12-09 +00:00:00','Di','Ag',5,5,5,5,5,5,5,12,5,5,5,5,5,5,0,'gls grsgtz für +Ffstnftz','85.180.141.246','10002127','fg-Kündigungfn','fg-Kündigungfn','rfinhgrt.gdolph@yghoo.df','17:44:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,15,5,25,5,12,60,5,1,NULL,NULL,'ffrtrgg +Bgckofficf 1','vb1','Wggnfr, +Annftt','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','schubrbf','2008-12-10 +00:00:00','Mi','Ag',1,2,NULL,2,1,2,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg +bzw. DigiCggg +Funktion','91.40.98.242','10002160','fg-gtgggggdgtfn','fg-gtgggggdgtfn','olgf.lifb@gggx.nft','18:18:25',NULL,1,1,0,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,6,11,1.81111111111111,0,NULL,6,11,1.81111111111111,0,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL); + +CREATE TABLE `t2` ( + `ft1` datetime DEFAULT NULL, + `ft2` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ft3` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ft4` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '', + `ft5` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '', + `ft6` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft6_2` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft7` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft8` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft9` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft10` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + PRIMARY KEY (`ft4`,`ft5`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +INSERT INTO `t2` VALUES ('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 2','Default','Intern','DEFAULT',NULL,NULL,NULL),('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 3','Default','Intern','DEFAULT',NULL,NULL,NULL); + +CREATE TABLE `t3` ( + `fe1` int(10) NOT NULL DEFAULT '0', + `fe2` char(50) COLLATE latin1_general_ci DEFAULT 'nn', + `f34` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe3` double DEFAULT NULL, + `fe4` double DEFAULT NULL, + `fe5` char(4) COLLATE latin1_general_ci DEFAULT NULL, + `f32` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe6` int(3) DEFAULT '0', + `fe7` char(1) COLLATE latin1_general_ci DEFAULT NULL, + `ft6` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `f33` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'virtuelle f33s', + `fe8` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'aus dem ADS', + `f37` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe9` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe10` int(5) DEFAULT '0', + `fe11` int(10) DEFAULT '0', + `fe12` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe13` double DEFAULT NULL, + `fe14` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe15` date DEFAULT NULL, + `fe16` date DEFAULT NULL, + `fe17` int(10) DEFAULT '0', + `fe18` date NOT NULL DEFAULT '0000-00-00', + `ft3` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`fe1`), + KEY `fe2` (`fe2`,`fe18`,`ft3`), + KEY `f33` (`f33`), + KEY `fe8` (`fe8`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT COMMENT='CustomerService und Outsourcer Userinformationen'; + +INSERT INTO `t3` VALUES (1,'aabggn','gab, glgna',0,NULL,NULL,'gxtgrn D gnd g +gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',91611,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2011-01-01','2014-08-11'),(4,'aabigr','gab, +Iggr',0,NULL,NULL,'gxtgrn D gnd g +gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',0,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2012-10-01','2014-08-11'),(7,'abgcrist','gbg, +ghristggna',15182,1,'ja','ggshilfg gxtgrn 1',1,NULL,'gg +galgs','ag1','ag1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'1900-01-01','2010-06-10'),(8,'abgcrist','gbg, +ghristggna',15182,1,'ja','Zgntralg gftgr galgs Bgtrgggng 1',1,NULL,'gg +galgs','sb1','sb1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2010-07-01','2012-08-11'),(9,'abgcrist','gbg, +ghristggna',15182,1,'ja','galgs Inbggnd 2',1,NULL,'gg +galgs','si2','si2','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2012-09-01','2014-01-11'),(10,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg +galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'1900-01-01','2010-11-10'),(11,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg +galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2010-12-01','2011-08-11'),(12,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 2',1,NULL,'gg +galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2011-09-01','2012-01-11'),(13,'abgcgr','gbg, +ggrnglgg',14962,0.75,NULL,'galgs Ogtbggnd 2',1,NULL,'gg +galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,'2011-09-11',11800647,'2012-02-01','2011-08-11'),(14,'rgghrsgr','gbg, +gigrid',14781,1,'ja','Fgrdgrgngsmanaggmgnt 1',1,NULL,'gg +Zahlgng','fm1','fm1','grfgrt','0',12141,0,'0',1,NULL,NULL,NULL,11010781,'1900-01-01','2012-08-11'); + +CREATE ALGORITHM=MERGE +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v1` AS select `t1a`.`ft1` AS `ft1`,`t1a`.`ft2` AS `ft2`,`t1a`.`ft3` AS `ft3`,`t1a`.`ft4` AS `ft4`,`t1a`.`ft5` AS `ft5`,`t1a`.`ft6` AS `ft6`,`t1a`.`ft6_2` AS `ft6_2`,`t1a`.`ft7` AS `ft7`,`t1a`.`ft8` AS `ft8`,`t1a`.`ft9` AS `ft9`,`t1a`.`ft10` AS `ft10` from `t2` `t1a` where (if((`t1a`.`ft10` = 'virtuell'),0,1) = 1); + +CREATE ALGORITHM=UNDEFINED +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v2` AS select distinct `t1b`.`fe2` AS `fe2`,min(`t1b`.`fe18`) AS `fe18`,max(`t1b`.`ft3`) AS `ft3` from `t3` `t1b` where ((`t1b`.`fe2` <> '') and (curdate() >= `t1b`.`fe18`)) group by `t1b`.`fe2`; + +CREATE ALGORITHM=UNDEFINED +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v3` AS select `t1c`.`fe2` AS `fe2`,`t1c`.`f34` AS `f34`,`t1c`.`f33` AS `f33`,`t1c`.`f32` AS `f32`,`t1c`.`f37` AS `f37`,`t1c`.`fe10` AS `fe10`,if((`tov`.`ft6` in ('klarmobil','callmobile')),`tov`.`ft9`,`tov`.`ft6`) AS `ft6_1`,`tov`.`ft6_2` AS `ft6_2`,`ua`.`fe18` AS `fe18`,`ua`.`ft3` AS `ft3` from ((`t3` `t1c` left join `v2` `ua` on((`t1c`.`fe2` = `ua`.`fe2`))) left join `v1` `tov` on((`t1c`.`fe8` = `tov`.`ft4`))) where (`t1c`.`ft3` = `ua`.`ft3`) group by `t1c`.`fe2`,`t1c`.`f34`,`t1c`.`f33`,`t1c`.`f32` order by `t1c`.`f34`; + +UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'; + +--echo #MDEV-8018: main.multi_update fails with --ps-protocol +prepare stmt1 from "UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +drop view v3,v2,v1; +drop table t1,t2,t3; --echo end of 5.5 tests diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test new file mode 100644 index 00000000000..e222afa89fe --- /dev/null +++ b/mysql-test/t/mysql_upgrade_view.test @@ -0,0 +1,133 @@ +-- source include/have_log_bin.inc + +set sql_log_bin=0; +--disable_warnings +drop table if exists t1,v1,v2,v3,v4,v1badcheck; +drop view if exists t1,v1,v2,v3,v4,v1badcheck; +--enable_warnings + +create table t1(a int); +create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50)); + +let $MYSQLD_DATADIR= `select @@datadir`; + +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1badcheck.frm $MYSQLD_DATADIR/test/v1badcheck.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm + +flush tables; + +check view v1; +check view v1badcheck; +check view v2; +check view v3; + +check view v1 for upgrade; +check view v1badcheck for upgrade; +check view v2 for upgrade; +check view v3 for upgrade; + +--replace_result $MYSQLTEST_VARDIR var +--exec $MYSQL_UPGRADE --force 2>&1 + +# "Phase 1/4: Fixing views" expected (without from_mysql) + +show create view v1; +show create view v2; +show create view v3; + +# Now force a mariadb version to be added + +set sql_log_bin=1; +REPAIR VIEW v1,v2; +REPAIR VIEW v1badcheck; +REPAIR NO_WRITE_TO_BINLOG VIEW v3; +set sql_log_bin=0; + +--source include/show_binlog_events.inc + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '='; +SELECT k,v from kv where k in ('md5','algorithm'); +SELECT k from kv where k ='mariadb-version'; +truncate table kv; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v2.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '='; +SELECT k,v from kv where k in ('md5','algorithm'); +SELECT k from kv where k ='mariadb-version'; +truncate table kv; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v3.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '='; +SELECT k,v from kv where k in ('md5','algorithm'); +SELECT k from kv where k ='mariadb-version'; +truncate table kv; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1badcheck.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '='; +SELECT k,v from kv where k in ('md5','algorithm'); +SELECT k from kv where k ='mariadb-version'; +truncate table kv; + +--disable_warnings +drop view if exists v1,v2,v3,v1badcheck; +--enable_warnings + +# Make it look like a MySQL directory now + +rename table mysql.event to mysql.ev_bk; +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm + +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm + +flush tables; + +create algorithm=temptable view v4 as select a from t1; +show create view v1; +show create view v2; +show create view v3; +show create view v4; + +# here we test the fixing views from mysql to occur +--replace_result $MYSQLTEST_VARDIR var +--exec $MYSQL_UPGRADE --force 2>&1 + +flush tables; +show create view v1; +show create view v2; +show create view v3; +show create view v4; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '='; +SELECT k,v from kv where k in ('md5','algorithm'); +SELECT k from kv where k ='mariadb-version'; +truncate table kv; + +--disable_warnings +drop view if exists v1,v2,v3; +--enable_warnings + +# back to mariadb default +drop table mysql.event; +rename table mysql.ev_bk to mysql.event; + +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm + +# check of binlog and mixing tables (with table specific options) and views +--exec $MYSQL_CHECK --repair --write-binlog --process-tables --use-frm --process-views=UPGRADE_FROM_MYSQL test 2>&1 + +--source include/show_binlog_events.inc + +drop table if exists kv; +drop view v1,v2,v3,v4; +drop table t1; + diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test index c04c8d50f3c..2580db88456 100644 --- a/mysql-test/t/mysqladmin.test +++ b/mysql-test/t/mysqladmin.test @@ -45,3 +45,9 @@ EOF --exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1 --remove_file $MYSQLTEST_VARDIR/tmp/cnf_file + +# +# MDEV-7883 Segmentation failure when running mysqladmin -u root -p +# +--error 1 +--exec $MYSQLADMIN -u root -p 2>&1 > /dev/null diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 3594b8c86eb..e36f106a5be 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -15,15 +15,15 @@ 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=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"; -grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client" ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"; +grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; +grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; flush privileges; connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=RC4-SHA); +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA); connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); @@ -222,8 +222,6 @@ DROP TABLE t1; # Common ciphers to openssl and yassl --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DHE-RSA-AES256-SHA --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC-SHA ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=RC4-SHA --disable_query_log --disable_result_log diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 5b78a352863..a6df0dc5979 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -210,3 +210,12 @@ repair table t1 use_frm; select count(*) from t1; check table t1; drop table t1; + +# +# MDEV-8115 mysql_upgrade crashes the server with REPAIR VIEW +# +create table t1 (a blob); +create view v1 as select * from t1; +repair view v1; +drop view v1; +drop table t1; diff --git a/mysql-test/t/show_grants_with_plugin-7985.test b/mysql-test/t/show_grants_with_plugin-7985.test new file mode 100644 index 00000000000..9c05cb2e06d --- /dev/null +++ b/mysql-test/t/show_grants_with_plugin-7985.test @@ -0,0 +1,161 @@ +--source include/not_embedded.inc +--enable_connect_log +call mtr.add_suppression("password and an authentication plugin"); + +--echo # +--echo # Create a user with mysql_native_password plugin. +--echo # The user has no password or auth_string set. +--echo # + +create user u1; +GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password; +select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; + +--echo # +--echo # The user's grants should show no password at all. +--echo # +show grants for u1; +--echo # +--echo # Test to see if connecting with no password is succesful. +--echo # +--connect (con1, localhost, u1,,) +show grants; +--disconnect con1 + +--connection default +--echo # +--echo # Test after flushing privileges. +--echo # +flush privileges; +--connect (con1, localhost, u1,,) +show grants; +--disconnect con1 + +--connection default +--echo # +--echo # Now add a mysql_native password string in authentication_string. +--echo # +# Password string is SOMETHING +GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password +USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; +select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; +--echo # +--echo # Test to see if connecting with password is succesful. +--echo # +--connect (con1, localhost, u1,'SOMETHING',) +show grants; +--disconnect con1 + +--connection default +--echo # +--echo # Test after flushing privileges. +--echo # +flush privileges; +--connect (con1, localhost, u1,'SOMETHING',) +show grants; +--disconnect con1 +--connection default + +--echo # +--echo # Now we also set a password for the user. +--echo # +set password for u1 = PASSWORD('SOMETHINGELSE'); +select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; + +--echo # +--echo # Here we should use the password field, as that primes over +--echo # the authentication_string field. +--echo # +show grants for u1; + +--echo # +--echo # Logging in with the user's password should work. +--echo # +--connect (con1, localhost, u1,'SOMETHINGELSE',) +show grants; +--disconnect con1 +--connection default +--echo # +--echo # Reload privileges and test logging in again. +--echo # +flush privileges; +show grants for u1; +--echo # +--echo # Here we connect via the user's password again. +--echo # +--connect (con1, localhost, u1,'SOMETHINGELSE',) +show grants; +--disconnect con1 +--connection default + +--echo # +--echo # Now we remove the authentication plugin password, flush privileges and +--echo # try again. +--echo # +update mysql.user set authentication_string = '' where user='u1'; +select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; +flush privileges; +show grants for u1; +--echo # +--echo # Here we connect via the user's password. +--echo # +--connect (con1, localhost, u1,'SOMETHINGELSE',) +select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; +--disconnect con1 +--connection default + +--echo # +--echo # Try and set a wrong auth_string password, with mysql_native_password. +--echo # Make sure it fails. +--echo # +--error ER_PASSWD_LENGTH +GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd'; +--echo # +--echo # Now set a correct password. +--echo # +GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password +USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; +show grants for u1; + +--echo # +--echo # Test if the user can now use that password instead. +--echo # +--connect (con1, localhost, u1,'SOMETHING',) +show grants; +--disconnect con1 + +--echo # +--echo # Test if the user can now use that password instead, after flushing privileges; +--echo # +--connection default +flush privileges; + +--connect (con1, localhost, u1,'SOMETHING',) +show grants; +--disconnect con1 +--connection default + +--echo # +--echo # Clear all passwords from the user. +--echo # +set password for u1 = ''; +select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; + +--echo # +--echo # Test no password connect. +--echo # +--connect (con1, localhost, u1,,) +show grants; +--disconnect con1 +--connection default + +--echo # +--echo # Test no password connect, after flushing privileges. +--echo # +flush privileges; +--connect (con1, localhost, u1,,) +show grants; +--disconnect con1 +--connection default + +drop user u1; diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index 52bbce6c484..6e19fd885e3 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -277,3 +277,11 @@ DROP DATABASE db1; --echo # Restore mysql.proc DROP TABLE mysql.proc; RENAME TABLE proc_backup TO mysql.proc; + +# +# BUG#19875331 - HANDLE_FATAL_SIGNAL 11 IN STRMAKE +# +create database mysqltest1; +create procedure mysqltest1.foo() select "foo"; +update mysql.proc set name='' where db='mysqltest1'; +drop database mysqltest1; diff --git a/mysql-test/t/sp-innodb.test b/mysql-test/t/sp-innodb.test index 228ab42544d..23715166a02 100644 --- a/mysql-test/t/sp-innodb.test +++ b/mysql-test/t/sp-innodb.test @@ -43,3 +43,120 @@ CALL p1(); drop procedure p1; drop table t1,t2; + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +--echo +--echo # +--echo # BUG 16041903: CONTINUE HANDLER NOT INVOKED +--echo # IN A STORED FUNCTION AFTER A LOCK WAIT TIMEOUT +--echo # + +--echo +--echo # Save and set lock wait timeout +SET @lock_wait_timeout_saved= @@lock_wait_timeout; +SET @innodb_lock_wait_timeout_saved= @@innodb_lock_wait_timeout; +SET @@lock_wait_timeout= 1; +SET @@innodb_lock_wait_timeout= 1; + +--echo +--echo # Create a function with exit handler: +DELIMITER //; +CREATE FUNCTION f1() RETURNS VARCHAR(20) +BEGIN + DECLARE EXIT HANDLER FOR SQLSTATE '42S02' RETURN 'No such table'; + INSERT INTO no_such_table VALUES (1); +END// + +--echo +--echo # Create a function calling f1(): +CREATE FUNCTION f2() RETURNS VARCHAR(20) +BEGIN + RETURN f1(); +END// + +--echo +--echo # Create a function provoking deadlock: +CREATE FUNCTION f3() RETURNS VARCHAR(20) +BEGIN + UPDATE t1 SET i= 1 WHERE i= 1; + RETURN 'Will never get here'; +END// + +--echo +--echo # Create a function calling f3, to create +--echo # a deadlock indirectly: +CREATE FUNCTION f4() RETURNS VARCHAR(20) +BEGIN + RETURN f3(); +END// +DELIMITER ;// + +--echo +--echo # Open another connection, create and initialize a table +--echo # to be used for provoking deadlock, put a lock on the table: +connect (con1,localhost,root,,); +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET AUTOCOMMIT= 0; +UPDATE t1 SET i=1 WHERE i=1; + +--echo +--echo # On the default connection, do an update to provoke a +--echo # deadlock, then call the function with handler. This case +--echo # fails without the patch (with error ER_NO_SUCH_TABLE): +--connection default +SET AUTOCOMMIT= 0; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET i=1 WHERE i=1; +SELECT f1() AS 'f1():'; + +--echo +--echo # Provoke another deadlock, then call the function with +--echo # handler indirectly. This case fails without the patch +--echo # (with error ER_NO_SUCH_TABLE): +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET i= 1 WHERE i= 1; +SELECT f2() AS 'f2():'; + +--echo +--echo # Provoke yet another deadlock, but now from within a function, +--echo # then call the function with handler. This succeeds even +--echo # without the patch because is_fatal_sub_stmt_error is reset +--echo # in restore_sub_stmt after the failing function has been +--echo # executed. The test case is included anyway for better coverage: +--error ER_LOCK_WAIT_TIMEOUT +SELECT f3() AS 'f3():'; +SELECT f1() AS 'f1():'; + +--echo # Provoke yet another deadlock, but now from within a function, +--echo # calling another function, then call the function with handler. +--echo # This succeeds even without the patch because +--echo # is_fatal_sub_stmt_error is reset in restore_sub_stmt after +--echo # the failing function has been executed. The test case is +--echo # included anyway for better coverage: +--error ER_LOCK_WAIT_TIMEOUT +SELECT f4() AS 'f4():'; +SELECT f1() AS 'f1():'; + +--echo +--echo # Disconnect, drop functions and table: +--disconnect con1 +DROP FUNCTION f4; +DROP FUNCTION f3; +DROP FUNCTION f2; +DROP FUNCTION f1; +DROP TABLE t1; + +--echo +--echo # Reset lock wait timeouts +SET @@lock_wait_timeout= @lock_wait_timeout_saved; +SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved; + +--echo # +--echo # BUG 16041903: End of test case +--echo # + +# Wait till we reached the initial number of concurrent sessions +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test index 988a9d6c056..0d14ad82692 100644 --- a/mysql-test/t/ssl.test +++ b/mysql-test/t/ssl.test @@ -25,11 +25,14 @@ SHOW STATUS LIKE 'Ssl_server_not_after'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; +# +# MDEV-7697 Client reports ERROR 2006 (MySQL server has gone away) or ERROR 2013 (Lost connection to MySQL server during query) while executing AES* functions under SSL +# +select aes_decrypt('MySQL','adf'); +select 'still connected?'; + connection default; disconnect ssl_con; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc - -## This test file is for testing encrypted communication only, not other -## encryption routines that the SSL library happens to provide! diff --git a/mysql-test/t/ssl_timeout.test b/mysql-test/t/ssl_timeout.test new file mode 100644 index 00000000000..0d96b3f6601 --- /dev/null +++ b/mysql-test/t/ssl_timeout.test @@ -0,0 +1,21 @@ +--source include/have_ssl_communication.inc + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +--echo # connect with read timeout so SLEEP() should timeout +connect (ssl_con,localhost,root,,,,,SSL read_timeout=5); + +--echo # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA +SHOW STATUS LIKE 'Ssl_cipher'; + +# --error CR_SERVER_LOST +--error 2013 +SELECT SLEEP(600); + +connection default; +disconnect ssl_con; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test index 2c60e5645c3..c989cb22558 100644 --- a/mysql-test/t/subselect_sj.test +++ b/mysql-test/t/subselect_sj.test @@ -2693,5 +2693,16 @@ SET join_cache_level=@tmp_mdev5059; set optimizer_switch=@tmp_os_mdev5059; DROP TABLE t1,t2,t3,t4; +--echo # +--echo # MDEV-7911: crash in Item_cond::eval_not_null_tables +--echo # + +create table t1(a int); +insert into t1 values(1),(2),(3),(null); +--error ER_CANT_AGGREGATE_2COLLATIONS +explain +select 1 from t1 where _cp932 "1" in (select '1' from t1); +drop table t1; + # The following command must be the last one the file set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test index a82baf095c1..0bf9c6d9d10 100644 --- a/mysql-test/t/subselect_sj2.test +++ b/mysql-test/t/subselect_sj2.test @@ -1320,5 +1320,76 @@ SELECT * FROM t1 WHERE id in (select distinct id_agente from t2); DROP TABLE t1, t2; +--echo # +--echo # MDEV-7474: Semi-Join's DuplicateWeedout strategy skipped for some values of optimizer_search_depth +--echo # + +CREATE TABLE t1 ( + t1id BIGINT(20) NOT NULL, + code VARCHAR(20), + PRIMARY KEY (t1id) +) COLLATE='utf8mb4_bin' ENGINE=InnoDB; + +CREATE TABLE t2 ( + t2id BIGINT(20) NOT NULL, + t1idref BIGINT(20) NOT NULL, + code VARCHAR(20), + PRIMARY KEY (t2id), + INDEX FK_T2_T1Id (t1idref), + CONSTRAINT FK_T2_T1Id FOREIGN KEY (t1idref) REFERENCES t1 (t1id) +) COLLATE='utf8mb4_bin' ENGINE=InnoDB; + +CREATE TABLE t3 ( + t3idref BIGINT(20) NOT NULL, + t2idref BIGINT(20) NOT NULL, + sequencenumber INT(10) NOT NULL, + PRIMARY KEY (t3idref, t2idref), + INDEX FK_T3_T2Id (t2idref), + CONSTRAINT FK_T3_T2Id FOREIGN KEY (t2idref) REFERENCES t2 (t2id) +) COLLATE='utf8mb4_bin' ENGINE=InnoDB; + +# Load up dummy data (needed to reproduce issue) +INSERT INTO t1 (t1id) VALUES (100001),(100017),(100018),(100026),(100027),(100028),(100029),(100030), +(100031),(100032),(100033),(100034),(100035),(100036),(100037),(100038),(100040),(100041),(100042), +(100043),(100044),(100045),(100046),(100047); + +INSERT IGNORE INTO t2 (t2id, t1idref) SELECT t1id, t1id FROM t1; + +# Now the test Data +INSERT IGNORE INTO t1 VALUES (200001, 'a'); +INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(200013, 200001); +INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3); + +set @tmp7474= @@optimizer_search_depth; +SET SESSION optimizer_search_depth = 1; + +let $query= +SELECT SQL_NO_CACHE +T2_0_.t1idref, +T2_0_.t2id +FROM + t2 T2_0_ +WHERE + T2_0_.t1idref IN ( + SELECT + T1_1_.t1id + FROM + t3 T3_0_ + INNER JOIN + t2 T2_1_ + ON T3_0_.t2idref=T2_1_.t2id + INNER JOIN + t1 T1_1_ + ON T2_1_.t1idref=T1_1_.t1id + WHERE + T3_0_.t3idref= 1 +); + +eval $query; +eval explain $query; + +drop table t3,t2,t1; +set optimizer_search_depth=@tmp7474; + --echo # This must be the last in the file: set optimizer_switch=@subselect_sj2_tmp; diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test index 0d42dca57b7..24f48206013 100644 --- a/mysql-test/t/table_elim.test +++ b/mysql-test/t/table_elim.test @@ -610,3 +610,34 @@ SELECT t1.alpha3 FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code = t3.code ) DROP TABLE t1, t2, t3; SET optimizer_switch=@save_optimizer_switch; + +--echo # +--echo # MDEV-7893: table_elimination works wrong with on computed expression and compound unique key +--echo # (just a testcase) +CREATE TABLE t1 ( + PostID int(10) unsigned NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO t1 (PostID) VALUES (1), (2); + +CREATE TABLE t2 ( + VoteID int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, + EntityID int(10) unsigned NOT NULL, + UserID int(10) unsigned NOT NULL, + UNIQUE KEY EntityID (EntityID,UserID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30); + +SELECT t1.*, T.Voted as Voted +FROM +t1 LEFT JOIN ( + SELECT 1 AS Voted, EntityID + FROM t2 + WHERE t2.UserID = '20' ) AS T + ON T.EntityID = t1.PostID +WHERE t1.PostID='1' +LIMIT 1; + +DROP TABLE t1,t2; + diff --git a/mysql-test/t/trigger-trans.test b/mysql-test/t/trigger-trans.test index 82bee7aa224..c17202055e1 100644 --- a/mysql-test/t/trigger-trans.test +++ b/mysql-test/t/trigger-trans.test @@ -2,6 +2,9 @@ # (or just InnoDB storage engine) --source include/have_innodb.inc +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + --disable_warnings drop table if exists t1; --enable_warnings @@ -182,3 +185,54 @@ insert into t1 values ( 654, 'a'), ( 654, 'b'), ( 654, 'c'), select * from t2 order by b; drop trigger t1_after_insert; drop table t1,t2; + +--echo # +--echo #Bug#19683834 SOME INNODB ERRORS CAUSES STORED FUNCTION +--echo # AND TRIGGER HANDLERS TO BE IGNORED + +--echo #Code fixed in Bug#16041903 +--enable_connect_log + +CREATE TABLE t1 (id int unsigned PRIMARY KEY, val int DEFAULT 0) +ENGINE=InnoDB; +INSERT INTO t1 (id) VALUES (1), (2); + +CREATE TABLE t2 (id int PRIMARY KEY); +CREATE TABLE t3 LIKE t2; + +# Trigger with continue handler for ER_DUP_ENTRY(1062) +DELIMITER //; +CREATE TRIGGER bef_insert BEFORE INSERT ON t2 FOR EACH ROW +BEGIN + DECLARE CONTINUE HANDLER FOR 1062 BEGIN END; + INSERT INTO t3 (id) VALUES (NEW.id); + INSERT INTO t3 (id) VALUES (NEW.id); +END// +DELIMITER ;// + +# Transaction 1: Grab locks on t1 +START TRANSACTION; +UPDATE t1 SET val = val + 1; + +# Transaction 2: +--connect (con2,localhost,root,,test,,) +SET SESSION innodb_lock_wait_timeout = 2; +# Trigger lock timeout (1205) +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t1 SET val = val + 1; + +# This insert should go through, as the continue handler should +# handle ER_DUP_ENTRY, even after ER_LOCK_WAIT_TIMEOUT (Bug#16041903) +INSERT INTO t2 (id) VALUES (1); + +# Cleanup +disconnect con2; +--source include/wait_until_disconnected.inc +connection default; + +DROP TABLE t3, t2, t1; + +--disable_connect_log + +# Wait till we reached the initial number of concurrent sessions +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index ed5a57b5eaf..a12b221dc38 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -492,6 +492,33 @@ drop function f1; set timestamp=0; SET time_zone=DEFAULT; +--echo # +--echo # MDEV-7778 impossible create copy of table, if table contain default value for timestamp field +--echo # + +SET sql_mode="NO_ZERO_DATE"; +CREATE TABLE t1 ( + ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +); +CREATE TABLE t2 AS SELECT * from t1 LIMIT 0; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; +SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-8082 ON UPDATE is not preserved by CREATE TABLE .. SELECT +--echo # +CREATE TABLE t1 ( + vc VARCHAR(10) NOT NULL DEFAULT 'test', + ts timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP +); +CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 0; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; + + --echo End of 10.0 tests --echo # diff --git a/mysql-test/t/uniques_crash-7912.test b/mysql-test/t/uniques_crash-7912.test new file mode 100644 index 00000000000..8dc82f8f540 --- /dev/null +++ b/mysql-test/t/uniques_crash-7912.test @@ -0,0 +1,26 @@ +# +# MDEV-7912 +# +# multitable delete with wrongly set sort_buffer_size crashes in merge_buffers + +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/windows.inc + +call mtr.add_suppression("Out of memory"); + +set sql_mode=""; +--disable_warnings +drop table if exists t1,t2; +create table `t1` (`a` datetime not null) engine=InnoDB; +create table `t2` (`a` int not null) engine=innodb; +replace into t1 values (),(); +insert into t2 values(0); +set session sort_buffer_size = 1024*1024*1024*1024; +#Either fail with EE_OUTOFMEMORY, or succeed +--error 0 , 5 +delete d2 from t2 as d1, t1 as d2 where d1.a <=> d2.a; +--enable_warnings + +drop table t2; +drop table t1; |