summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am10
-rwxr-xr-xmysql-test/mysql-test-run.pl50
-rw-r--r--mysql-test/r/blackhole.result8
-rw-r--r--mysql-test/r/distinct.result12
-rw-r--r--mysql-test/r/func_str.result7
-rw-r--r--mysql-test/r/func_time.result19
-rw-r--r--mysql-test/r/group_min_max.result22
-rw-r--r--mysql-test/r/information_schema.result22
-rw-r--r--mysql-test/r/information_schema_chmod.result5
-rw-r--r--mysql-test/r/join.result4
-rw-r--r--mysql-test/r/merge.result8
-rw-r--r--mysql-test/r/mysql.result12
-rw-r--r--mysql-test/r/ndb_autodiscover3.result45
-rw-r--r--mysql-test/r/openssl_1.result11
-rw-r--r--mysql-test/r/outfile.resultbin1130 -> 1159 bytes
-rw-r--r--mysql-test/r/rpl_temporary.result2
-rw-r--r--mysql-test/r/select.result35
-rw-r--r--mysql-test/r/subselect.result2
-rw-r--r--mysql-test/r/variables.result54
-rw-r--r--mysql-test/std_data/untrusted-cacert.pem53
-rw-r--r--mysql-test/t/blackhole.test12
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/distinct.test16
-rw-r--r--mysql-test/t/func_str.test9
-rw-r--r--mysql-test/t/func_time.test14
-rw-r--r--mysql-test/t/group_min_max.test16
-rw-r--r--mysql-test/t/information_schema.test29
-rw-r--r--mysql-test/t/information_schema_chmod.test20
-rw-r--r--mysql-test/t/merge.test12
-rw-r--r--mysql-test/t/mysql.test8
-rw-r--r--mysql-test/t/ndb_autodiscover3.test65
-rw-r--r--mysql-test/t/openssl_1.test42
-rw-r--r--mysql-test/t/outfile.test1
-rw-r--r--mysql-test/t/rpl_temporary.test14
-rw-r--r--mysql-test/t/select.test34
-rw-r--r--mysql-test/t/variables-master.opt1
-rw-r--r--mysql-test/t/variables.test62
37 files changed, 686 insertions, 51 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 33598748397..73074397086 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -100,15 +100,15 @@ install-data-local:
uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir)
-std_data/client-key.pem:
+std_data/client-key.pem: $(top_srcdir)/SSL/$(@F)
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/client-cert.pem:
+std_data/client-cert.pem: $(top_srcdir)/SSL/$(@F)
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/cacert.pem:
+std_data/cacert.pem: $(top_srcdir)/SSL/$(@F)
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-cert.pem:
+std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F)
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-key.pem:
+std_data/server-key.pem: $(top_srcdir)/SSL/$(@F)
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
SUFFIXES = .sh
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 25c1f6c1ddc..e57a5da2c79 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -134,7 +134,6 @@ our $glob_win32= 0; # OS and native Win32 executables
our $glob_win32_perl= 0; # ActiveState Win32 Perl
our $glob_cygwin_perl= 0; # Cygwin Perl
our $glob_cygwin_shell= undef;
-our $glob_use_libtool= 1;
our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef;
our $glob_hostname= undef;
@@ -189,6 +188,7 @@ our $exe_slave_mysqld;
our $exe_im;
our $exe_my_print_defaults;
our $lib_udf_example;
+our $exe_libtool;
our $opt_bench= 0;
our $opt_small_bench= 0;
@@ -376,7 +376,6 @@ sub main () {
check_ndbcluster_support(); # We check whether to actually use it later
check_ssl_support();
- check_running_as_root();
environment_setup();
signal_setup();
@@ -443,12 +442,6 @@ sub initial_setup () {
$glob_cygwin_perl= ($^O eq "cygwin");
$glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
- # Use libtool on all platforms except windows
- if ( $glob_win32 )
- {
- $glob_use_libtool= 0;
- }
-
# We require that we are in the "mysql-test" directory
# to run mysql-test-run
@@ -1000,6 +993,21 @@ sub snapshot_setup () {
sub executable_setup () {
+ #
+ # Check if libtool is available in this distribution/clone
+ # we need it when valgrinding or debugging non installed binary
+ # Otherwise valgrind will valgrind the libtool wrapper or bash
+ # and gdb will not find the real executable to debug
+ #
+ if ( -x "../libtool")
+ {
+ $exe_libtool= "../libtool";
+ if ($opt_valgrind or $glob_debugger)
+ {
+ mtr_report("Using \"$exe_libtool\" when running valgrind or debugger");
+ }
+ }
+
if ( $opt_source_dist )
{
if ( $glob_win32 )
@@ -1336,7 +1344,7 @@ sub kill_and_cleanup () {
sub check_running_as_root () {
# Check if running as root
# i.e a file can be read regardless what mode we set it to
- my $test_file= "test_running_as_root.txt";
+ my $test_file= "$opt_vardir/test_running_as_root.txt";
mtr_tofile($test_file, "MySQL");
chmod(oct("0000"), $test_file);
@@ -1653,6 +1661,7 @@ sub initialize_servers () {
save_installed_db();
}
}
+ check_running_as_root();
}
}
@@ -2625,6 +2634,15 @@ sub mysqld_start ($$$$$) {
$exe= undef;
}
+ if ($exe_libtool and $opt_valgrind)
+ {
+ # Add "libtool --mode-execute"
+ # if running in valgrind(to avoid valgrinding bash)
+ unshift(@$args, "--mode=execute", $exe);
+ $exe= $exe_libtool;
+ }
+
+
if ( $type eq 'master' )
{
if ( ! defined $exe or
@@ -3122,12 +3140,12 @@ sub run_mysqltest ($) {
debugger_arguments(\$args, \$exe, "client");
}
- if ($glob_use_libtool and $opt_valgrind)
+ if ($exe_libtool and $opt_valgrind)
{
# Add "libtool --mode-execute" before the test to execute
# if running in valgrind(to avoid valgrinding bash)
unshift(@$args, "--mode=execute", $exe);
- $exe= "libtool";
+ $exe= $exe_libtool;
}
if ( $opt_check_testcases )
@@ -3197,9 +3215,9 @@ sub gdb_arguments {
mtr_add_arg($$args, "$type");
mtr_add_arg($$args, "-e");
- if ( $glob_use_libtool )
+ if ( $exe_libtool )
{
- mtr_add_arg($$args, "libtool");
+ mtr_add_arg($$args, $exe_libtool);
mtr_add_arg($$args, "--mode=execute");
}
@@ -3259,9 +3277,9 @@ sub ddd_arguments {
my $save_exe= $$exe;
$$args= [];
- if ( $glob_use_libtool )
+ if ( $exe_libtool )
{
- $$exe= "libtool";
+ $$exe= $exe_libtool;
mtr_add_arg($$args, "--mode=execute");
mtr_add_arg($$args, "ddd");
}
@@ -3282,6 +3300,8 @@ sub debugger_arguments {
my $exe= shift;
my $debugger= $opt_debugger || $opt_client_debugger;
+ # FIXME Need to change the below "eq"'s to
+ # "case unsensitive string contains"
if ( $debugger eq "vcexpress" or $debugger eq "vc")
{
# vc[express] /debugexe exe arg1 .. argn
diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result
index 140d7e73d48..a4c057f256c 100644
--- a/mysql-test/r/blackhole.result
+++ b/mysql-test/r/blackhole.result
@@ -123,3 +123,11 @@ master-bin.000001 # Query 1 # use `test`; create table t3 like t1
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3
master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3
drop table t1,t2,t3;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1 (c char(20)) engine=MyISAM;
+insert into t1 values ("Monty"),("WAX"),("Walrus");
+alter table t1 engine=blackhole;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+drop table t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index a6ad95570f8..89b17d69f40 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -533,3 +533,15 @@ select count(distinct concat(x,y)) from t1;
count(distinct concat(x,y))
2
drop table t1;
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES (1, 101);
+INSERT INTO t1 SELECT a + 1, a + 101 FROM t1;
+INSERT INTO t1 SELECT a + 2, a + 102 FROM t1;
+INSERT INTO t1 SELECT a + 4, a + 104 FROM t1;
+INSERT INTO t1 SELECT a + 8, a + 108 FROM t1;
+EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 8 NULL 16 Using where; Using index
+SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
+a a
+DROP TABLE t1;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index aed79e7f8fa..6f8269bdcbd 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1017,6 +1017,13 @@ t
1000000
1
drop table t1;
+select load_file("lkjlkj");
+load_file("lkjlkj")
+NULL
+select ifnull(load_file("lkjlkj"),"it's null");
+ifnull(load_file("lkjlkj"),"it's null")
+it's null
+End of 4.1 tests
create table t1 (d decimal default null);
insert into t1 values (null);
select format(d, 2) from t1;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index fdb4a0c5996..0e029802555 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -732,6 +732,25 @@ SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAY
count(*)
3
DROP TABLE t1;
+select last_day('2005-00-00');
+last_day('2005-00-00')
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2005-00-00'
+select last_day('2005-00-01');
+last_day('2005-00-01')
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2005-00-01'
+select last_day('2005-01-00');
+last_day('2005-01-00')
+NULL
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '2005-01-00'
+select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
+monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
+monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
+NULL NULL January NULL
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 6370f7699b3..f9b55cc6a7b 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2116,3 +2116,25 @@ COUNT(DISTINCT a)
1
DROP TABLE t1;
DROP PROCEDURE a;
+CREATE TABLE t1 (a varchar(64) NOT NULL default '', PRIMARY KEY(a));
+INSERT INTO t1 (a) VALUES
+(''), ('CENTRAL'), ('EASTERN'), ('GREATER LONDON'),
+('NORTH CENTRAL'), ('NORTH EAST'), ('NORTH WEST'), ('SCOTLAND'),
+('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN');
+EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL PRIMARY 66 NULL 12 Using index for group-by
+SELECT DISTINCT a,a FROM t1 ORDER BY a;
+a a
+
+CENTRAL CENTRAL
+EASTERN EASTERN
+GREATER LONDON GREATER LONDON
+NORTH CENTRAL NORTH CENTRAL
+NORTH EAST NORTH EAST
+NORTH WEST NORTH WEST
+SCOTLAND SCOTLAND
+SOUTH EAST SOUTH EAST
+SOUTH WEST SOUTH WEST
+WESTERN WESTERN
+DROP TABLE t1;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index d5fb046d319..633b11e1f1b 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1083,11 +1083,6 @@ DROP TABLE t1;
DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
-create database mysqltest;
-create table mysqltest.t1(a int);
-select table_schema from information_schema.tables where table_schema='mysqltest';
-table_schema
-drop database mysqltest;
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
from information_schema.columns where
table_schema='information_schema' and
@@ -1096,3 +1091,20 @@ group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num
varchar(20) information_schema.COLUMNS 1
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
+create table t1(f1 char(1) not null, f2 char(9) not null)
+default character set utf8;
+select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
+information_schema.columns where table_schema='test' and table_name = 't1';
+CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH
+1 3
+9 27
+drop table t1;
+use mysql;
+INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
+'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
+'2006-03-02 18:40:03','','');
+select routine_name from information_schema.routines;
+routine_name
+
+delete from proc where name='';
+use test;
diff --git a/mysql-test/r/information_schema_chmod.result b/mysql-test/r/information_schema_chmod.result
new file mode 100644
index 00000000000..36124559439
--- /dev/null
+++ b/mysql-test/r/information_schema_chmod.result
@@ -0,0 +1,5 @@
+create database mysqltest;
+create table mysqltest.t1(a int);
+select table_schema from information_schema.tables where table_schema='mysqltest';
+table_schema
+drop database mysqltest;
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index ecf76d477a0..86288caf398 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -700,8 +700,8 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause'
select * from information_schema.statistics join information_schema.columns
using(table_name,column_name) where table_name='user';
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
-user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 20 60 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
-user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 5 16 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
+user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
+user User NULL mysql 0 mysql PRIMARY 2 A 5 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
drop table t1;
drop table t2;
drop table t3;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 58e1f86b3f9..9a34d6fba58 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -768,3 +768,11 @@ Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
drop table t1, t2, t3;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1 (c char(20)) engine=MyISAM;
+insert into t1 values ("Monty"),("WAX"),("Walrus");
+alter table t1 engine=MERGE;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+drop table t1;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index a067d3ad0f8..4b7084e813c 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -74,7 +74,7 @@ c_cp932
+----------------------+------------+--------+
| >a < | b | 123421 |
| >a < | 0123456789 | 4 |
-| >abcd< | NULL | 4 |
+| >abcd< | | 4 |
+----------------------+------------+--------+
+------+------+---------------------------+
| i | j | k |
@@ -94,6 +94,14 @@ c_cp932
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| i | int(11) | YES | | NULL | |
-| j | int(11) | NO | | NULL | |
+| j | int(11) | NO | | | |
| k | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
++------+------+
+| i | s1 |
++------+------+
+| 1 | x |
+| 2 | NULL |
+| 3 | |
++------+------+
+End of 5.0 tests
diff --git a/mysql-test/r/ndb_autodiscover3.result b/mysql-test/r/ndb_autodiscover3.result
new file mode 100644
index 00000000000..8bc1b968436
--- /dev/null
+++ b/mysql-test/r/ndb_autodiscover3.result
@@ -0,0 +1,45 @@
+drop table if exists t1, t2;
+create table t1 (a int key) engine=ndbcluster;
+begin;
+insert into t1 values (1);
+insert into t1 values (2);
+ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from ndbcluster
+commit;
+ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
+drop table t1;
+create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
+insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
+select * from t2 order by a limit 3;
+a b
+1 1
+2 1
+3 1
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+select * from t2 order by a limit 3;
+ERROR HY000: Can't lock file (errno: 241)
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+show tables;
+Tables_in_test
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+select * from t2 order by a limit 3;
+a
+1
+2
+3
+drop table t2;
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 91382619b6c..1fcfb11525e 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -3,8 +3,8 @@ create table t1(f1 int);
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/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/emailAddress=abstract.mysql.developer@mysql.com";
flush privileges;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
@@ -41,3 +41,10 @@ ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1
drop user ssl_user1@localhost, ssl_user2@localhost,
ssl_user3@localhost, ssl_user4@localhost;
drop table t1;
+mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error
+mysqltest: Could not open connection 'default': 2026 SSL connection error
+Error when connection to server using SSL:Unable to get private key from ''
+mysqltest: Could not open connection 'default': 2026 SSL connection error
+Error when connection to server using SSL:Unable to get certificate from ''
+mysqltest: Could not open connection 'default': 2026 SSL connection error
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
index ee8c3249c9d..040dff576f8 100644
--- a/mysql-test/r/outfile.result
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result
index 42e7712750c..da85ef5104d 100644
--- a/mysql-test/r/rpl_temporary.result
+++ b/mysql-test/r/rpl_temporary.result
@@ -109,8 +109,6 @@ create temporary table t102 (id int);
set @session.pseudo_thread_id=200;
create temporary table t201 (id int);
create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int);
-set @con1_id=connection_id();
-kill @con1_id;
create table t1(f int);
insert into t1 values (1);
select * from t1 /* must be 1 */;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index ea85025a37b..335637b787f 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3411,3 +3411,38 @@ SELECT * FROM t1;
i
255
DROP TABLE t1;
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, c int, e int, primary key(a,b,c));
+insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
+Z
+In next EXPLAIN, B.rows must be exactly 10:
+explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
+and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A range PRIMARY PRIMARY 12 NULL 3 Using where
+1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 10
+drop table t1, t2;
+CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
+INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
+(3,1), (5,1), (8,9), (2,2), (0,9);
+CREATE TABLE t2 (c int, d int, f int, INDEX(c,f));
+INSERT INTO t2 VALUES
+(1,0,0), (1,0,1), (2,0,0), (2,0,1), (3,0,0), (4,0,1),
+(5,0,0), (5,0,1), (6,0,0), (0,0,1), (7,0,0), (7,0,1),
+(0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1);
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY,b b 5 NULL 3 Using where
+1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 14b05238e14..e3d65882f81 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1480,7 +1480,7 @@ Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<e
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 6 NULL 3 Using index
-2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where
+2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index; Using where
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 32cd8790874..70282c5143e 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -1,4 +1,31 @@
drop table if exists t1,t2;
+set @my_binlog_cache_size =@@global.binlog_cache_size;
+set @my_connect_timeout =@@global.connect_timeout;
+set @my_delayed_insert_timeout =@@global.delayed_insert_timeout;
+set @my_delayed_queue_size =@@global.delayed_queue_size;
+set @my_flush =@@global.flush;
+set @my_flush_time =@@global.flush_time;
+set @my_key_buffer_size =@@global.key_buffer_size;
+set @my_max_binlog_cache_size =@@global.max_binlog_cache_size;
+set @my_max_binlog_size =@@global.max_binlog_size;
+set @my_max_connect_errors =@@global.max_connect_errors;
+set @my_max_delayed_threads =@@global.max_delayed_threads;
+set @my_max_heap_table_size =@@global.max_heap_table_size;
+set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
+set @my_max_join_size =@@global.max_join_size;
+set @my_max_user_connections =@@global.max_user_connections;
+set @my_max_write_lock_count =@@global.max_write_lock_count;
+set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size;
+set @my_net_buffer_length =@@global.net_buffer_length;
+set @my_net_write_timeout =@@global.net_write_timeout;
+set @my_net_read_timeout =@@global.net_read_timeout;
+set @my_query_cache_limit =@@global.query_cache_limit;
+set @my_query_cache_type =@@global.query_cache_type;
+set @my_rpl_recovery_rank =@@global.rpl_recovery_rank;
+set @my_server_id =@@global.server_id;
+set @my_slow_launch_time =@@global.slow_launch_time;
+set @my_storage_engine =@@global.storage_engine;
+set @my_thread_cache_size =@@global.thread_cache_size;
set @`test`=1;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@test @`test` @TEST @`TEST` @"teSt"
@@ -612,4 +639,31 @@ select @@version, @@version_comment, @@version_compile_machine,
@@version_compile_os;
@@version @@version_comment @@version_compile_machine @@version_compile_os
# # # #
+set global binlog_cache_size =@my_binlog_cache_size;
+set global connect_timeout =@my_connect_timeout;
+set global delayed_insert_timeout =@my_delayed_insert_timeout;
+set global delayed_queue_size =@my_delayed_queue_size;
+set global flush =@my_flush;
+set global flush_time =@my_flush_time;
+set global key_buffer_size =@my_key_buffer_size;
+set global max_binlog_cache_size =default;
+set global max_binlog_size =@my_max_binlog_size;
+set global max_connect_errors =@my_max_connect_errors;
+set global max_delayed_threads =@my_max_delayed_threads;
+set global max_heap_table_size =@my_max_heap_table_size;
+set global max_insert_delayed_threads=@my_max_insert_delayed_threads;
+set global max_join_size =@my_max_join_size;
+set global max_user_connections =@my_max_user_connections;
+set global max_write_lock_count =@my_max_write_lock_count;
+set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
+set global net_buffer_length =@my_net_buffer_length;
+set global net_write_timeout =@my_net_write_timeout;
+set global net_read_timeout =@my_net_read_timeout;
+set global query_cache_limit =@my_query_cache_limit;
+set global query_cache_type =@my_query_cache_type;
+set global rpl_recovery_rank =@my_rpl_recovery_rank;
+set global server_id =@my_server_id;
+set global slow_launch_time =@my_slow_launch_time;
+set global storage_engine =@my_storage_engine;
+set global thread_cache_size =@my_thread_cache_size;
End of 5.0 tests
diff --git a/mysql-test/std_data/untrusted-cacert.pem b/mysql-test/std_data/untrusted-cacert.pem
new file mode 100644
index 00000000000..981dd004fc6
--- /dev/null
+++ b/mysql-test/std_data/untrusted-cacert.pem
@@ -0,0 +1,53 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 0 (0x0)
+ Signature Algorithm: md5WithRSAEncryption
+ Issuer: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
+ Validity
+ Not Before: Jan 18 20:12:32 2005 GMT
+ Not After : Oct 15 20:12:32 2007 GMT
+ Subject: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (512 bit)
+ Modulus (512 bit):
+ 00:cf:2b:14:00:b0:3c:df:6f:9e:91:40:ec:c8:f6:
+ 90:b2:5b:b4:70:80:a5:a4:0a:73:c7:44:f3:2a:26:
+ c4:2f:f1:3a:f1:c3:c4:ac:fc:c3:d2:c3:bf:f5:d7:
+ 6a:38:42:ad:22:ab:c8:c4:4b:4c:1d:16:af:05:34:
+ 7d:79:97:5e:e1
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ CB:0F:1F:E9:A2:76:71:C9:E6:E8:23:A6:C1:18:B7:CC:44:CF:B9:84
+ X509v3 Authority Key Identifier:
+ keyid:CB:0F:1F:E9:A2:76:71:C9:E6:E8:23:A6:C1:18:B7:CC:44:CF:B9:84
+ DirName:/C=US/ST=Oregon/L=Portland/O=sawtooth/CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
+ serial:00
+
+ X509v3 Basic Constraints:
+ CA:TRUE
+ Signature Algorithm: md5WithRSAEncryption
+ 27:f7:3d:fb:39:6f:73:a4:86:f3:a0:48:22:60:84:e9:5c:3d:
+ 28:36:05:16:44:98:07:87:e1:5d:b5:f3:a7:bc:33:5f:f4:29:
+ a9:5f:87:33:df:e6:8e:bd:e2:f3:0a:c8:00:69:ae:3d:41:47:
+ 03:ea:0b:4c:67:45:4b:ab:f3:39
+-----BEGIN CERTIFICATE-----
+MIIC7zCCApmgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBiTELMAkGA1UEBhMCVVMx
+DzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxhbmQxETAPBgNVBAoTCHNh
+d3Rvb3RoMSQwIgYDVQQDExt3d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAb
+BgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTA1MDExODIwMTIzMloXDTA3
+MTAxNTIwMTIzMlowgYkxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAP
+BgNVBAcTCFBvcnRsYW5kMREwDwYDVQQKEwhzYXd0b290aDEkMCIGA1UEAxMbd3d3
+LnNhd3Rvb3RoLWNvbnN1bHRpbmcuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlh
+c3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDPKxQAsDzfb56RQOzI9pCy
+W7RwgKWkCnPHRPMqJsQv8Trxw8Ss/MPSw7/112o4Qq0iq8jES0wdFq8FNH15l17h
+AgMBAAGjgekwgeYwHQYDVR0OBBYEFMsPH+midnHJ5ugjpsEYt8xEz7mEMIG2BgNV
+HSMEga4wgauAFMsPH+midnHJ5ugjpsEYt8xEz7mEoYGPpIGMMIGJMQswCQYDVQQG
+EwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDERMA8GA1UE
+ChMIc2F3dG9vdGgxJDAiBgNVBAMTG3d3dy5zYXd0b290aC1jb25zdWx0aW5nLmNv
+bTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb22CAQAwDAYDVR0TBAUwAwEB
+/zANBgkqhkiG9w0BAQQFAANBACf3Pfs5b3OkhvOgSCJghOlcPSg2BRZEmAeH4V21
+86e8M1/0KalfhzPf5o694vMKyABprj1BRwPqC0xnRUur8zk=
+-----END CERTIFICATE-----
diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
index e40b84eb5cd..493f74ded3e 100644
--- a/mysql-test/t/blackhole.test
+++ b/mysql-test/t/blackhole.test
@@ -128,3 +128,15 @@ show binlog events;
drop table t1,t2,t3;
# End of 4.1 tests
+
+#
+# BUG#10952 - alter table ... lost data without errors and warnings
+#
+drop table if exists t1;
+create table t1 (c char(20)) engine=MyISAM;
+insert into t1 values ("Monty"),("WAX"),("Walrus");
+--error 1031
+alter table t1 engine=blackhole;
+drop table t1;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 1b587eea40f..007847fab37 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -11,4 +11,3 @@
##############################################################################
ndb_load : Bug#17233
-udf : Not yet
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 45bd0c7a51c..09f07c2852f 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -382,3 +382,19 @@ INSERT INTO t1 VALUES
select count(distinct x,y) from t1;
select count(distinct concat(x,y)) from t1;
drop table t1;
+
+#
+# Bug #18068: SELECT DISTINCT
+#
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
+
+INSERT INTO t1 VALUES (1, 101);
+INSERT INTO t1 SELECT a + 1, a + 101 FROM t1;
+INSERT INTO t1 SELECT a + 2, a + 102 FROM t1;
+INSERT INTO t1 SELECT a + 4, a + 104 FROM t1;
+INSERT INTO t1 SELECT a + 8, a + 108 FROM t1;
+
+EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
+SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 85cedee0f4a..dee06231deb 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -666,7 +666,14 @@ select rpad(i, 7, ' ') as t from t1;
--disable_metadata
drop table t1;
-# End of 4.1 tests
+#
+# Bug #10418: LOAD_FILE does not behave like in manual if file does not exist
+#
+
+select load_file("lkjlkj");
+select ifnull(load_file("lkjlkj"),"it's null");
+
+--echo End of 4.1 tests
#
# Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 4e4fb8f777a..1c7f387e354 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -352,6 +352,20 @@ INSERT INTO t1 VALUES (NOW());
SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
DROP TABLE t1;
+#
+# Bug #10568
+#
+
+select last_day('2005-00-00');
+select last_day('2005-00-01');
+select last_day('2005-01-00');
+
+#
+# Bug #18501: monthname and NULLs
+#
+
+select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
+ monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
# End of 4.1 tests
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index bff07366ec2..d9836ccc8df 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -782,3 +782,19 @@ SELECT COUNT(DISTINCT a) FROM t1 WHERE a=0;
DROP TABLE t1;
DROP PROCEDURE a;
+
+#
+# Bug #18068: SELECT DISTINCT
+#
+
+CREATE TABLE t1 (a varchar(64) NOT NULL default '', PRIMARY KEY(a));
+
+INSERT INTO t1 (a) VALUES
+ (''), ('CENTRAL'), ('EASTERN'), ('GREATER LONDON'),
+ ('NORTH CENTRAL'), ('NORTH EAST'), ('NORTH WEST'), ('SCOTLAND'),
+ ('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN');
+
+EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
+SELECT DISTINCT a,a FROM t1 ORDER BY a;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 90b0fd95eee..e96f1ef4bbd 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -793,15 +793,6 @@ DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
-#
-# Bug #15851 Unlistable directories yield no info from information_schema
-#
-create database mysqltest;
-create table mysqltest.t1(a int);
---exec chmod -r $MYSQLTEST_VARDIR/master-data/mysqltest
-select table_schema from information_schema.tables where table_schema='mysqltest';
---exec chmod +r $MYSQLTEST_VARDIR/master-data/mysqltest
-drop database mysqltest;
#
# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
@@ -811,3 +802,23 @@ from information_schema.columns where
table_schema='information_schema' and
(column_type = 'varchar(7)' or column_type = 'varchar(20)')
group by column_type order by num;
+
+#
+# Bug#19236 bad COLUMNS.CHARACTER_MAXIMUM_LENGHT and CHARACTER_OCTET_LENGTH
+#
+create table t1(f1 char(1) not null, f2 char(9) not null)
+default character set utf8;
+select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
+information_schema.columns where table_schema='test' and table_name = 't1';
+drop table t1;
+
+#
+# Bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
+#
+use mysql;
+INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
+'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
+'2006-03-02 18:40:03','','');
+select routine_name from information_schema.routines;
+delete from proc where name='';
+use test;
diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test
new file mode 100644
index 00000000000..fb850b8e38d
--- /dev/null
+++ b/mysql-test/t/information_schema_chmod.test
@@ -0,0 +1,20 @@
+#
+# Due to "Bug#18474 Unlistable directories yield no info from
+# information_schema, part2" this test can't be run on Window with our
+# current test framework. When "chmod -r" is done within cygwin the
+# MySQL Server can still read the directory.
+# Manual testing shows the functionalty to skip unlistable directories
+# works on windows
+#
+--source include/not_windows.inc
+
+
+#
+# Bug #15851 Unlistable directories yield no info from information_schema
+#
+create database mysqltest;
+create table mysqltest.t1(a int);
+--exec chmod -r $MYSQLTEST_VARDIR/master-data/mysqltest
+select table_schema from information_schema.tables where table_schema='mysqltest';
+--exec chmod +r $MYSQLTEST_VARDIR/master-data/mysqltest
+drop database mysqltest;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 060f1ea167b..7ea14a811ed 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -379,3 +379,15 @@ check table t1, t2;
drop table t1, t2, t3;
# End of 4.1 tests
+
+#
+# BUG#10952 - alter table ... lost data without errors and warnings
+#
+drop table if exists t1;
+create table t1 (c char(20)) engine=MyISAM;
+insert into t1 values ("Monty"),("WAX"),("Walrus");
+--error 1031
+alter table t1 engine=MERGE;
+drop table t1;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index e76553f42e7..ac4c323f51e 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -72,3 +72,11 @@ drop table t1;
#
--exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
+#
+# Bug#19564: mysql displays NULL instead of space
+#
+--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
+
+--echo End of 5.0 tests
+
+
diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test
new file mode 100644
index 00000000000..73b4bf8b94f
--- /dev/null
+++ b/mysql-test/t/ndb_autodiscover3.test
@@ -0,0 +1,65 @@
+-- source include/have_ndb.inc
+-- source include/have_multi_ndb.inc
+-- source include/not_embedded.inc
+
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+#
+# Transaction ongoing while cluster is restarted
+#
+--connection server1
+create table t1 (a int key) engine=ndbcluster;
+
+begin;
+insert into t1 values (1);
+
+--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+--error 1297
+insert into t1 values (2);
+--error 1296
+commit;
+
+drop table t1;
+
+#
+# Stale cache after restart -i
+#
+--connection server1
+create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
+insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
+select * from t2 order by a limit 3;
+
+--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+--connection server2
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+
+# server 1 should have a stale cache, and in this case wrong frm, transaction must be retried
+--connection server1
+--error 1015
+select * from t2 order by a limit 3;
+select * from t2 order by a limit 3;
+
+--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
+
+--connection server1
+show tables;
+create table t2 (a int key) engine=ndbcluster;
+insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+select * from t2 order by a limit 3;
+
+# server 2 should have a stale cache, but with right frm, transaction need not be retried
+--connection server2
+select * from t2 order by a limit 3;
+
+drop table t2;
+# End of 4.1 tests
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index 4cc9113048f..afee381f5b7 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -10,8 +10,8 @@ insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/emailAddress=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/emailAddress=abstract.mysql.developer@mysql.com";
flush privileges;
connect (con1,localhost,ssl_user1,,,,,SSL);
@@ -54,3 +54,41 @@ ssl_user3@localhost, ssl_user4@localhost;
drop table t1;
# End of 4.1 tests
+
+#
+# Test that we can't open connection to server if we are using
+# a different cacert
+#
+--exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql
+--error 1
+--exec $MYSQL_TEST --ssl-ca=$MYSQL_TEST_DIR/std_data/untrusted-cacert.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+
+#
+# Test that we can't open connection to server if we are using
+# a blank ca
+#
+--error 1
+--exec $MYSQL_TEST --ssl-ca= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+
+#
+# Test that we can't open connection to server if we are using
+# a nonexistent ca file
+#
+--error 1
+--exec $MYSQL_TEST --ssl-ca=nonexisting_file.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+
+#
+# Test that we can't open connection to server if we are using
+# a blank client-key
+#
+--error 1
+--exec $MYSQL_TEST --ssl-key= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+
+#
+# Test that we can't open connection to server if we are using
+# a blank client-cert
+#
+--error 1
+--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
+
+
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index d404a6fff9f..c48e6c9730d 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -40,7 +40,6 @@ eval select * into dumpfile "../tmp/outfile-test.2" from t1;
--error 1086
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
enable_query_log;
---error 13,2
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.1
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.2
diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test
index facf0d68d2b..7d2222ea79a 100644
--- a/mysql-test/t/rpl_temporary.test
+++ b/mysql-test/t/rpl_temporary.test
@@ -169,8 +169,18 @@ create temporary table t102 (id int);
set @session.pseudo_thread_id=200;
create temporary table t201 (id int);
create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int);
-set @con1_id=connection_id();
-kill @con1_id;
+
+#
+# Don't kill our own connection to the server as
+# the result code differs depending on platform.
+#
+# Select the id to kill into a variable of mysqltest
+let $con1_id= `select connection_id()`;
+# Switch connection to avoid killing our own connection
+connection master;
+--disable_query_log
+eval kill $con1_id;
+--enable_query_log
#now do something to show that slave is ok after DROP temp tables
connection master;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 8e3c5847846..4b6ae921b9b 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2886,3 +2886,37 @@ SELECT * FROM t1;
UPDATE t1 SET i = i - 1;
SELECT * FROM t1;
DROP TABLE t1;
+
+# BUG#17379
+
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, b int, c int, e int, primary key(a,b,c));
+insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
+analyze table t2;
+select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
+
+explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
+ and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
+drop table t1, t2;
+
+#
+#Bug #18940: selection of optimal execution plan caused by equality
+# propagation (the bug was fixed by the patch for bug #17379)
+
+CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
+INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
+ (3,1), (5,1), (8,9), (2,2), (0,9);
+
+CREATE TABLE t2 (c int, d int, f int, INDEX(c,f));
+INSERT INTO t2 VALUES
+ (1,0,0), (1,0,1), (2,0,0), (2,0,1), (3,0,0), (4,0,1),
+ (5,0,0), (5,0,1), (6,0,0), (0,0,1), (7,0,0), (7,0,1),
+ (0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1);
+
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
+EXPLAIN
+SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/variables-master.opt b/mysql-test/t/variables-master.opt
deleted file mode 100644
index abd826bc7fa..00000000000
--- a/mysql-test/t/variables-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max_join_size=100
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index d6bebe8b5cb..20928c7b6c1 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -5,6 +5,37 @@
drop table if exists t1,t2;
--enable_warnings
+#
+# Bug #19263: variables.test doesn't clean up after itself (I/II -- save)
+#
+set @my_binlog_cache_size =@@global.binlog_cache_size;
+set @my_connect_timeout =@@global.connect_timeout;
+set @my_delayed_insert_timeout =@@global.delayed_insert_timeout;
+set @my_delayed_queue_size =@@global.delayed_queue_size;
+set @my_flush =@@global.flush;
+set @my_flush_time =@@global.flush_time;
+set @my_key_buffer_size =@@global.key_buffer_size;
+set @my_max_binlog_cache_size =@@global.max_binlog_cache_size;
+set @my_max_binlog_size =@@global.max_binlog_size;
+set @my_max_connect_errors =@@global.max_connect_errors;
+set @my_max_delayed_threads =@@global.max_delayed_threads;
+set @my_max_heap_table_size =@@global.max_heap_table_size;
+set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
+set @my_max_join_size =@@global.max_join_size;
+set @my_max_user_connections =@@global.max_user_connections;
+set @my_max_write_lock_count =@@global.max_write_lock_count;
+set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size;
+set @my_net_buffer_length =@@global.net_buffer_length;
+set @my_net_write_timeout =@@global.net_write_timeout;
+set @my_net_read_timeout =@@global.net_read_timeout;
+set @my_query_cache_limit =@@global.query_cache_limit;
+set @my_query_cache_type =@@global.query_cache_type;
+set @my_rpl_recovery_rank =@@global.rpl_recovery_rank;
+set @my_server_id =@@global.server_id;
+set @my_slow_launch_time =@@global.slow_launch_time;
+set @my_storage_engine =@@global.storage_engine;
+set @my_thread_cache_size =@@global.thread_cache_size;
+
# case insensitivity tests (new in 5.0)
set @`test`=1;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@@ -508,4 +539,35 @@ select @@system_time_zone;
select @@version, @@version_comment, @@version_compile_machine,
@@version_compile_os;
+#
+# Bug #19263: variables.test doesn't clean up after itself (II/II -- restore)
+#
+set global binlog_cache_size =@my_binlog_cache_size;
+set global connect_timeout =@my_connect_timeout;
+set global delayed_insert_timeout =@my_delayed_insert_timeout;
+set global delayed_queue_size =@my_delayed_queue_size;
+set global flush =@my_flush;
+set global flush_time =@my_flush_time;
+set global key_buffer_size =@my_key_buffer_size;
+set global max_binlog_cache_size =default; #@my_max_binlog_cache_size;
+set global max_binlog_size =@my_max_binlog_size;
+set global max_connect_errors =@my_max_connect_errors;
+set global max_delayed_threads =@my_max_delayed_threads;
+set global max_heap_table_size =@my_max_heap_table_size;
+set global max_insert_delayed_threads=@my_max_insert_delayed_threads;
+set global max_join_size =@my_max_join_size;
+set global max_user_connections =@my_max_user_connections;
+set global max_write_lock_count =@my_max_write_lock_count;
+set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
+set global net_buffer_length =@my_net_buffer_length;
+set global net_write_timeout =@my_net_write_timeout;
+set global net_read_timeout =@my_net_read_timeout;
+set global query_cache_limit =@my_query_cache_limit;
+set global query_cache_type =@my_query_cache_type;
+set global rpl_recovery_rank =@my_rpl_recovery_rank;
+set global server_id =@my_server_id;
+set global slow_launch_time =@my_slow_launch_time;
+set global storage_engine =@my_storage_engine;
+set global thread_cache_size =@my_thread_cache_size;
+
--echo End of 5.0 tests