summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alter_table.test22
-rw-r--r--mysql-test/t/backup.test5
-rw-r--r--mysql-test/t/bigint.test6
-rw-r--r--mysql-test/t/binlog.test5
-rw-r--r--mysql-test/t/binlog_killed.test248
-rw-r--r--mysql-test/t/blackhole.test20
-rw-r--r--mysql-test/t/cast.test14
-rw-r--r--mysql-test/t/create.test111
-rw-r--r--mysql-test/t/ctype_cp932_binlog.test3
-rw-r--r--mysql-test/t/ctype_cp932_notembedded.test32
-rw-r--r--mysql-test/t/ctype_ucs2_def.test16
-rw-r--r--mysql-test/t/ctype_ucs_binlog.test1
-rw-r--r--mysql-test/t/date_formats.test2
-rw-r--r--mysql-test/t/disabled.def6
-rw-r--r--mysql-test/t/drop_temp_table.test4
-rw-r--r--mysql-test/t/flush_block_commit_notembedded.test2
-rw-r--r--mysql-test/t/func_date_add.test10
-rw-r--r--mysql-test/t/func_gconcat.test44
-rw-r--r--mysql-test/t/func_group.test34
-rw-r--r--mysql-test/t/func_in.test31
-rw-r--r--mysql-test/t/func_sapdb.test2
-rw-r--r--mysql-test/t/grant.test27
-rw-r--r--mysql-test/t/grant2.test44
-rw-r--r--mysql-test/t/heap_hash.test25
-rw-r--r--mysql-test/t/innodb.test1
-rw-r--r--mysql-test/t/innodb_mysql.test87
-rw-r--r--mysql-test/t/insert.test139
-rw-r--r--mysql-test/t/insert_select-binlog.test1
-rw-r--r--mysql-test/t/insert_update.test43
-rw-r--r--mysql-test/t/join.test24
-rw-r--r--mysql-test/t/join_outer.test36
-rw-r--r--mysql-test/t/key.test12
-rw-r--r--mysql-test/t/kill.test185
-rw-r--r--mysql-test/t/limit.test17
-rw-r--r--mysql-test/t/loaddata.test26
-rw-r--r--mysql-test/t/long_tmpdir-master.opt1
-rw-r--r--mysql-test/t/long_tmpdir-master.sh3
-rw-r--r--mysql-test/t/long_tmpdir.test9
-rw-r--r--mysql-test/t/metadata.test11
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test54
-rw-r--r--mysql-test/t/myisam.test16
-rw-r--r--mysql-test/t/mysql.test2
-rw-r--r--mysql-test/t/mysql_upgrade.test13
-rw-r--r--mysql-test/t/mysqlbinlog-cp932.test1
-rw-r--r--mysql-test/t/mysqlbinlog.test3
-rw-r--r--mysql-test/t/mysqlbinlog2.test3
-rw-r--r--mysql-test/t/mysqldump.test8
-rw-r--r--mysql-test/t/mysqltest.test264
-rw-r--r--mysql-test/t/ndb_basic.test15
-rw-r--r--mysql-test/t/ndb_insert.test9
-rw-r--r--mysql-test/t/order_by.test4
-rw-r--r--mysql-test/t/outfile.test47
-rw-r--r--mysql-test/t/ps.test32
-rw-r--r--mysql-test/t/ps_1general.test6
-rw-r--r--mysql-test/t/query_cache.test96
-rw-r--r--mysql-test/t/row.test2
-rw-r--r--mysql-test/t/rpl000015.test2
-rw-r--r--mysql-test/t/rpl000017.test2
-rw-r--r--mysql-test/t/rpl_loaddata.test10
-rw-r--r--mysql-test/t/rpl_packet.test2
-rw-r--r--mysql-test/t/rpl_rotate_logs.test17
-rw-r--r--mysql-test/t/rpl_user_variables.test45
-rw-r--r--mysql-test/t/rpl_view.test12
-rw-r--r--mysql-test/t/sp-code.test77
-rw-r--r--mysql-test/t/sp-error.test6
-rw-r--r--mysql-test/t/sp-prelocking.test31
-rw-r--r--mysql-test/t/sp-vars.test44
-rw-r--r--mysql-test/t/sp.test33
-rw-r--r--mysql-test/t/sp_trans.test31
-rw-r--r--mysql-test/t/sp_trans_log.test33
-rw-r--r--mysql-test/t/strict.test12
-rw-r--r--mysql-test/t/subselect.test46
-rw-r--r--mysql-test/t/subselect3.test47
-rw-r--r--mysql-test/t/trigger.test85
-rw-r--r--mysql-test/t/type_date.test13
-rw-r--r--mysql-test/t/type_datetime.test93
-rw-r--r--mysql-test/t/type_enum.test8
-rw-r--r--mysql-test/t/type_float.test20
-rw-r--r--mysql-test/t/type_newdecimal.test32
-rw-r--r--mysql-test/t/user_var-binlog.test3
-rw-r--r--mysql-test/t/user_var.test15
-rw-r--r--mysql-test/t/view.test99
82 files changed, 2506 insertions, 196 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 83686f31e9e..3ced1087757 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -662,3 +662,25 @@ insert into t1 values (null);
select * from t1;
drop table t1;
+
+#
+# Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the
+# NO_ZERO_DATE mode.
+#
+set @orig_sql_mode = @@sql_mode;
+set sql_mode="no_zero_date";
+create table t1(f1 int);
+alter table t1 add column f2 datetime not null, add column f21 date not null;
+insert into t1 values(1,'2000-01-01','2000-01-01');
+--error 1292
+alter table t1 add column f3 datetime not null;
+--error 1292
+alter table t1 add column f3 date not null;
+--error 1292
+alter table t1 add column f4 datetime not null default '2002-02-02',
+ add column f41 date not null;
+alter table t1 add column f4 datetime not null default '2002-02-02',
+ add column f41 date not null default '2002-02-02';
+select * from t1;
+drop table t1;
+set sql_mode= @orig_sql_mode;
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
index a3339ecce69..6ff4144aaf2 100644
--- a/mysql-test/t/backup.test
+++ b/mysql-test/t/backup.test
@@ -1,3 +1,8 @@
+
+# The server need to be started in $MYSQLTEST_VARDIR since it
+# uses ../std_data_ln/
+-- source include/uses_vardir.inc
+
#
# This test is a bit tricky as we can't use backup table to overwrite an old
# table
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 6c1229db83f..9a5fb11229d 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -288,3 +288,9 @@ insert into t1 values (10000002383263201056);
select c1 mod 50 as result from t1;
drop table t1;
+#
+# Bug #8663 cant use bgint unsigned as input to cast
+#
+
+select cast(19999999999999999999 as signed);
+select cast(-19999999999999999999 as signed);
diff --git a/mysql-test/t/binlog.test b/mysql-test/t/binlog.test
index 1063940d378..7c307cb3f94 100644
--- a/mysql-test/t/binlog.test
+++ b/mysql-test/t/binlog.test
@@ -4,6 +4,7 @@
-- source include/not_embedded.inc
-- source include/have_bdb.inc
-- source include/have_innodb.inc
+-- source include/have_log_bin.inc
--disable_warnings
drop table if exists t1, t2;
@@ -19,7 +20,7 @@ begin;
insert t2 values (5);
commit;
# first COMMIT must be Query_log_event, second - Xid_log_event
---replace_result "xid=21" "xid=12"
+--replace_result "xid=22" "xid=13"
--replace_column 2 # 5 #
show binlog events from 98;
drop table t1,t2;
@@ -41,7 +42,7 @@ while ($1)
--enable_query_log
commit;
drop table t1;
---replace_result "xid=32" "xid=19"
+--replace_result "xid=33" "xid=20"
--replace_column 2 # 5 #
show binlog events in 'master-bin.000001' from 98;
--replace_column 2 # 5 #
diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test
new file mode 100644
index 00000000000..034895f17cb
--- /dev/null
+++ b/mysql-test/t/binlog_killed.test
@@ -0,0 +1,248 @@
+-- source include/have_innodb.inc
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+###
+### bug#22725 : incorrect killed error in binlogged query
+###
+
+connect (con1, localhost, root,,);
+connect (con2, localhost, root,,);
+
+create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
+create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
+create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
+
+#
+# effective test for bug#22725
+#
+
+connection con1;
+select get_lock("a", 20);
+
+connection con2;
+let $ID= `select connection_id()`;
+reset master;
+send insert into t2 values (null, null), (null, get_lock("a", 10));
+
+
+connection con1;
+
+disable_abort_on_error;
+disable_query_log;
+disable_result_log;
+
+eval kill query $ID;
+
+connection con2;
+--error 0,ER_QUERY_INTERRUPTED
+reap;
+let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
+
+--exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select
+(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
+is not null;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`;
+let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`;
+eval set @result= $rows- $error_code - $insert_binlogged;
+
+enable_abort_on_error;
+enable_query_log;
+enable_result_log;
+
+select @result /* must be zero either way */;
+
+# the functions are either *insensitive* to killing or killing can cause
+# strange problmes with the error propagation out of SF's stack
+# Bug#27563, Bug#27565, BUG#24971
+#
+# TODO: use if's block as regression test for the bugs or remove
+#
+if (0)
+{
+delimiter |;
+create function bug27563()
+RETURNS int(11)
+DETERMINISTIC
+begin
+ select get_lock("a", 10) into @a;
+ return 1;
+end|
+delimiter ;|
+
+# the function is sensitive to killing requiring innodb though with wrong client error
+# TO FIX in BUG#27565; TODO: remove --error 1105 afterwards
+delimiter |;
+create function bug27565()
+RETURNS int(11)
+DETERMINISTIC
+begin
+ select a from t1 where a=1 into @a for update;
+ return 1;
+end|
+delimiter ;|
+
+reset master;
+
+
+### ta table case: killing causes rollback
+
+# A. autocommit ON
+connection con1;
+select get_lock("a", 20);
+
+connection con2;
+let $ID= `select connection_id()`;
+send insert into t1 values (bug27563(),1);
+
+connection con1;
+eval kill query $ID;
+
+connection con2;
+# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero
+--enable_info
+# todo: remove 0 return after fixing Bug#27563
+--error 0,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+--disable_info
+###--replace_column 2 # 5 #
+### show binlog events from 98 /* nothing in binlog unless Bug#27563 */;
+show master status /* must be only FD event unless Bug#27563 */;
+select count(*) from t1 /* must be zero unless Bug#27563 */;
+
+# M. multi-statement-ta
+connection con2;
+let $ID= `select connection_id()`;
+begin;
+send insert into t1 values (bug27563(),1);
+
+connection con1;
+eval kill query $ID;
+connection con2;
+# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero
+--enable_info
+# todo: remove 0 return after fixing Bug#27563
+--error 0,ER_QUERY_INTERRUPTED
+reap;
+--disable_info
+select count(*) from t1 /* must be zero unless Bug#27563 */;
+commit;
+
+
+### non-ta table case: killing must be recorded in binlog
+
+reset master;
+
+connection con2;
+let $ID= `select connection_id()`;
+send insert into t2 values (bug27563(),1);
+
+connection con1;
+eval kill query $ID;
+
+connection con2;
+# todo: remove 0 return after fixing Bug#27563
+--error 0,ER_QUERY_INTERRUPTED
+reap;
+select count(*) from t2 /* must be one */;
+#show binlog events from 98 /* must have the insert on non-ta table */;
+show master status /* must have the insert event more to FD */;
+# the value of the error flag of KILLED_QUERY is tested further
+
+connection con1;
+select RELEASE_LOCK("a");
+
+### test with effective killing of SF()
+
+delete from t1;
+delete from t2;
+insert into t1 values (1,1);
+insert into t2 values (1,1);
+
+#
+# Bug#27565
+# test where KILL is propagated as error to the top level
+# still another bug with the error message to the user
+# todo: fix reexecute the result file after fixing
+#
+begin; update t1 set b=0 where a=1;
+
+connection con2;
+let $ID= `select connection_id()`;
+send update t2 set b=bug27565()-1 where a=1;
+
+connection con1;
+eval kill query $ID;
+commit;
+
+connection con2;
+# todo: fix Bug #27565 killed query of SF() is not reported correctly and
+# remove 1105 (wrong)
+#--error ER_QUERY_INTERRUPTED
+--error 1105,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+select * from t1 /* must be: (1,0) */;
+select * from t2 /* must be as before: (1,1) */;
+
+## bug#22725 with effective and propagating killing
+#
+# top-level ta-table
+connection con1;
+delete from t3;
+reset master;
+begin; update t1 set b=0 where a=1;
+
+connection con2;
+let $ID= `select connection_id()`;
+# the query won't perform completely since the function gets interrupted
+send insert into t3 values (0,0),(1,bug27565());
+
+connection con1;
+eval kill query $ID;
+rollback;
+
+connection con2;
+# todo: fix Bug #27565 killed query of SF() is not reported correctly and
+# remove 1105 (wrong)
+#--error ER_QUERY_INTERRUPTED
+--error 1105,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+select count(*) from t3 /* must be zero */;
+show master status /* nothing in binlog */;
+
+# top-level non-ta-table
+connection con1;
+delete from t2;
+reset master;
+begin; update t1 set b=0 where a=1;
+
+connection con2;
+let $ID= `select connection_id()`;
+# the query won't perform completely since the function gets intrurrupted
+send insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */;
+
+connection con1;
+eval kill query $ID;
+rollback;
+
+connection con2;
+# todo: fix Bug #27565 killed query of SF() is not reported correctly and
+# remove 1105 (wrong)
+#--error ER_QUERY_INTERRUPTED
+--error 1105,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+
+select count(*) from t2 /* count must be one */;
+show master status /* insert into non-ta must be in binlog */;
+
+drop function bug27563;
+drop function bug27565;
+}
+
+system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ;
+
+drop table t1,t2,t3;
+
diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
index 4bafad2d777..d8ffdeb8312 100644
--- a/mysql-test/t/blackhole.test
+++ b/mysql-test/t/blackhole.test
@@ -4,6 +4,11 @@
#
-- source include/not_embedded.inc
-- source include/have_blackhole.inc
+-- source include/have_log_bin.inc
+
+# The server need to be started in $MYSQLTEST_VARDIR since it
+# uses ../std_data_ln/
+-- source include/uses_vardir.inc
--disable_warnings
drop table if exists t1,t2;
@@ -109,7 +114,7 @@ insert into t1 values(1);
insert ignore into t1 values(1);
replace into t1 values(100);
create table t2 (a varchar(200)) engine=blackhole;
-load data infile '../std_data_ln/words.dat' into table t2;
+eval load data infile '../std_data_ln/words.dat' into table t2;
alter table t1 add b int;
alter table t1 drop b;
create table t3 like t1;
@@ -128,6 +133,17 @@ show binlog events;
drop table t1,t2,t3;
#
+# BUG#27998 - mysqld crashed when executing INSERT DELAYED on a BLACKHOLE
+# table
+#
+CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
+--error 1031
+INSERT DELAYED INTO t1 VALUES(1);
+DROP TABLE t1;
+
+# End of 4.1 tests
+
+#
#Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX
#
CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE;
@@ -142,4 +158,4 @@ ALTER TABLE t1 ADD PRIMARY KEY(a);
DELETE FROM t1 WHERE a=10;
DROP TABLE t1;
-# End of 4.1 tests
+# End of 5.0 tests
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 502c5781f1f..b665eb86656 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -10,7 +10,13 @@ select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
select ~5, cast(~5 as signed);
explain extended select ~5, cast(~5 as signed);
select cast(5 as unsigned) -6.0;
-select cast(NULL as signed), cast(1/0 as signed);
+select cast(NULL as signed), cast(1/0 as signed);
+#
+# Bug #28250: Run-Time Check Failure #3 - The variable 'value' is being used
+# without being def
+#
+# The following line causes Run-Time Check Failure on
+# binaries built with Visual C++ 2005
select cast(NULL as unsigned), cast(1/0 as unsigned);
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
@@ -182,6 +188,12 @@ DROP TABLE t1;
select isnull(date(NULL)), isnull(cast(NULL as DATE));
+#
+# Bug#23656: Wrong result of CAST from DATE to int
+#
+SELECT CAST(cast('01-01-01' as date) AS UNSIGNED);
+SELECT CAST(cast('01-01-01' as date) AS SIGNED);
+
--echo End of 4.1 tests
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index ba5f56e12b1..35198c793b8 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -669,6 +669,117 @@ alter table t1 max_rows=100000000000;
show create table t1;
drop table t1;
+
+#
+# Tests for errors happening at various stages of CREATE TABLES ... SELECT
+#
+# (Also checks that it behaves atomically in the sense that in case
+# of error it is automatically dropped if it has not existed before.)
+#
+# Error during open_and_lock_tables() of tables
+--error ER_NO_SUCH_TABLE
+create table t1 select * from t2;
+# Rather special error which also caught during open tables pahse
+--error ER_UPDATE_TABLE_USED
+create table t1 select * from t1;
+# Error which happens before select_create::prepare()
+--error ER_CANT_AGGREGATE_2COLLATIONS
+create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
+# Error during table creation
+--error ER_KEY_COLUMN_DOES_NOT_EXITS
+create table t1 (primary key(a)) select "b" as b;
+# Error in select_create::prepare() which is not related to table creation
+create table t1 (a int);
+--error ER_WRONG_VALUE_COUNT_ON_ROW
+create table if not exists t1 select 1 as a, 2 as b;
+drop table t1;
+# Finally error which happens during insert
+--error ER_DUP_ENTRY
+create table t1 (primary key (a)) (select 1 as a) union all (select 1 as a);
+# What happens if table already exists ?
+create table t1 (i int);
+--error ER_TABLE_EXISTS_ERROR
+create table t1 select 1 as i;
+create table if not exists t1 select 1 as i;
+select * from t1;
+# Error before select_create::prepare()
+--error ER_CANT_AGGREGATE_2COLLATIONS
+create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
+select * from t1;
+# Error which happens during insertion of rows
+alter table t1 add primary key (i);
+--error ER_DUP_ENTRY
+create table if not exists t1 (select 2 as i) union all (select 2 as i);
+select * from t1;
+drop table t1;
+
+
+# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
+# results of CREATE TABLE ... SELECT when temporary table exists").
+# In this situation we either have to create non-temporary table and
+# insert data in it or insert data in temporary table without creation
+# of permanent table. Since currently temporary tables always shadow
+# permanent tables we adopt second approach.
+create temporary table t1 (j int);
+create table if not exists t1 select 1;
+select * from t1;
+drop temporary table t1;
+--error ER_NO_SUCH_TABLE
+select * from t1;
+--error ER_BAD_TABLE_ERROR
+drop table t1;
+
+
+#
+# CREATE TABLE ... SELECT and LOCK TABLES
+#
+# There is little sense in using CREATE TABLE ... SELECT under
+# LOCK TABLES as it mostly does not work. At least we check that
+# the server doesn't crash, hang and produces sensible errors.
+# Includes test for bug #20662 "Infinite loop in CREATE TABLE
+# IF NOT EXISTS ... SELECT with locked tables".
+create table t1 (i int);
+insert into t1 values (1), (2);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t2 select * from t1;
+--error ER_TABLE_NOT_LOCKED
+create table if not exists t2 select * from t1;
+unlock tables;
+create table t2 (j int);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t2 select * from t1;
+# This should not be ever allowed as it will undermine
+# lock-all-at-once approach
+--error ER_TABLE_NOT_LOCKED
+create table if not exists t2 select * from t1;
+unlock tables;
+lock table t1 read, t2 read;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+create table t2 select * from t1;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+create table if not exists t2 select * from t1;
+unlock tables;
+lock table t1 read, t2 write;
+--error ER_TABLE_EXISTS_ERROR
+create table t2 select * from t1;
+# This is the only case which really works.
+create table if not exists t2 select * from t1;
+select * from t1;
+unlock tables;
+drop table t2;
+
+# OTOH CREATE TEMPORARY TABLE ... SELECT should work
+# well under LOCK TABLES.
+lock tables t1 read;
+create temporary table t2 select * from t1;
+create temporary table if not exists t2 select * from t1;
+select * from t2;
+unlock tables;
+drop table t1, t2;
+
+
#
# Bug#21772: can not name a column 'upgrade' when create a table
#
diff --git a/mysql-test/t/ctype_cp932_binlog.test b/mysql-test/t/ctype_cp932_binlog.test
index ee0e588fdae..7db8f311800 100644
--- a/mysql-test/t/ctype_cp932_binlog.test
+++ b/mysql-test/t/ctype_cp932_binlog.test
@@ -1,5 +1,6 @@
-- source include/not_embedded.inc
-- source include/have_cp932.inc
+-- source include/have_log_bin.inc
--character_set cp932
--disable_warnings
@@ -51,7 +52,7 @@ CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
SELECT HEX(s1),HEX(s2),d FROM t4|
DROP PROCEDURE bug18293|
DROP TABLE t4|
-SHOW BINLOG EVENTS FROM 402|
+SHOW BINLOG EVENTS FROM 362|
delimiter ;|
# End of 5.0 tests
diff --git a/mysql-test/t/ctype_cp932_notembedded.test b/mysql-test/t/ctype_cp932_notembedded.test
deleted file mode 100644
index 52e7acc3f01..00000000000
--- a/mysql-test/t/ctype_cp932_notembedded.test
+++ /dev/null
@@ -1,32 +0,0 @@
--- source include/not_embedded.inc
--- source include/have_cp932.inc
-
---character_set cp932
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set names cp932;
-set character_set_database = cp932;
-
-# Test prepared statement with 0x8300 sequence in parameter while
-# running with cp932 client character set.
-RESET MASTER;
-CREATE TABLE t1(f1 blob);
-PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
-SET @var1= x'8300';
-# TODO: Note that this doesn't actually test the code which was added for
-# bug#11338 because this syntax for prepared statements causes the PS to
-# be replicated differently than if we executed the PS from C or Java.
-# Using this syntax, variable names are inserted into the binlog instead
-# of values. The real goal of this test is to check the code that was
-# added to Item_param::query_val_str() in order to do hex encoding of
-# PS parameters when the client character set is cp932;
-# Bug#11338 has an example java program which can be used to verify this
-# code (and I have used it to test the fix) until there is some way to
-# exercise this code from mysql-test-run.
-EXECUTE stmt1 USING @var1;
-SHOW BINLOG EVENTS FROM 98;
-SELECT HEX(f1) FROM t1;
-DROP table t1;
-# end test for bug#11338
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
index e435d1fb07d..050710b208b 100644
--- a/mysql-test/t/ctype_ucs2_def.test
+++ b/mysql-test/t/ctype_ucs2_def.test
@@ -14,3 +14,19 @@ DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (a int);
drop table t1;
+
+#
+# Bug #27643: query failed : 1114 (The table '' is full)
+#
+# Check that HASH indexes ignore trailing spaces when comparing
+# strings with the ucs2_bin collation
+
+CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
+ col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
+ UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES('A ', 'A ');
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_ucs_binlog.test b/mysql-test/t/ctype_ucs_binlog.test
index 2467d34386c..92d4458a9c2 100644
--- a/mysql-test/t/ctype_ucs_binlog.test
+++ b/mysql-test/t/ctype_ucs_binlog.test
@@ -1,5 +1,6 @@
--source include/not_embedded.inc
--source include/have_ucs2.inc
+--source include/have_log_bin.inc
#
# Check correct binlogging of UCS2 user variables (BUG#3875)
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index 3054ec53faa..faa6d4242db 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -129,6 +129,8 @@ create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
+('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index df56165950f..9d6a9b57e9a 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -10,5 +10,9 @@
#
##############################################################################
-ndb_load : Bug#17233
user_limits : Bug#23921 random failure of user_limits.test
+im_life_cycle : Bug#27851: Instance manager test im_life_cycle fails randomly
+im_daemon_life_cycle : Bug#20294: Instance manager tests fail randomly
+im_options_set : Bug#20294: Instance manager tests fail randomly
+im_options_unset : Bug#20294: Instance manager tests fail randomly
+im_utils : Bug#20294: Instance manager tests fail randomly
diff --git a/mysql-test/t/drop_temp_table.test b/mysql-test/t/drop_temp_table.test
index bc06de4096c..86bdc0eeecc 100644
--- a/mysql-test/t/drop_temp_table.test
+++ b/mysql-test/t/drop_temp_table.test
@@ -1,5 +1,5 @@
-# Embedded server doesn't support binlog
--- source include/not_embedded.inc
+--source include/have_log_bin.inc
+
--disable_warnings
drop database if exists `drop-temp+table-test`;
diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test
index 4650a5a15a8..e3b59e0fc45 100644
--- a/mysql-test/t/flush_block_commit_notembedded.test
+++ b/mysql-test/t/flush_block_commit_notembedded.test
@@ -4,7 +4,7 @@
# This is intended to mimick how mysqldump and innobackup work.
# And it requires InnoDB
--- source include/not_embedded.inc
+-- source include/have_log_bin.inc
-- source include/have_innodb.inc
connect (con1,localhost,root,,);
diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test
index b575eeececa..fc5a5cb2823 100644
--- a/mysql-test/t/func_date_add.test
+++ b/mysql-test/t/func_date_add.test
@@ -77,4 +77,14 @@ SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK;
+#
+# Bug#28450: The Item_date_add_interval in select list may fail the field
+# type assertion.
+#
+create table t1 (a int, b varchar(10));
+insert into t1 values (1, '2001-01-01'),(2, '2002-02-02');
+select '2007-01-01' + interval a day from t1;
+select b + interval a day from t1;
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 0dd82864520..767df5ae233 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -507,4 +507,48 @@ SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
DROP TABLE t1;
+#
+# Bug #28273: GROUP_CONCAT and ORDER BY: No warning when result gets truncated.
+#
+CREATE TABLE t1( a VARCHAR( 10 ), b INT );
+INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1),
+ ( repeat( 'b', 10 ), 2);
+SET group_concat_max_len = 20;
+SELECT GROUP_CONCAT( a ) FROM t1;
+SELECT GROUP_CONCAT( DISTINCT a ) FROM t1;
+SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
+SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1;
+SET group_concat_max_len = DEFAULT;
+DROP TABLE t1;
+# Bug #23856:GROUP_CONCAT and ORDER BY: junk from previous rows for query on I_S
+#
+SET group_concat_max_len= 65535;
+CREATE TABLE t1( a TEXT, b INTEGER );
+INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 );
+SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+SET group_concat_max_len= 10;
+SELECT GROUP_CONCAT(a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
+SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
+
+SET group_concat_max_len= 65535;
+CREATE TABLE t2( a TEXT );
+INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
+INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) );
+INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
+SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2;
+
+CREATE TABLE t3( a TEXT, b INT );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 );
+INSERT INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 );
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1;
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2;
+SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3;
+
+SET group_concat_max_len= DEFAULT;
+DROP TABLE t1, t2, t3;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 654bb8bb75d..2293ac71454 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -827,4 +827,38 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
DROP TABLE t1;
+#
+# Bug #27573: MIN() on an indexed column which is always NULL sets _other_
+# results to NULL
+#
+CREATE TABLE t1 ( a INT, b INT, KEY(a) );
+INSERT INTO t1 VALUES (NULL, 1), (NULL, 2);
+EXPLAIN SELECT MIN(a), MIN(b) FROM t1;
+SELECT MIN(a), MIN(b) FROM t1;
+
+CREATE TABLE t2( a INT, b INT, c INT, KEY(a, b) );
+INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 );
+EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
+SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
+
+CREATE TABLE t3 (a INT, b INT, c int, KEY(a, b));
+INSERT INTO t3 VALUES (1, NULL, 1), (2, NULL, 2), (2, NULL, 2), (3, NULL, 3);
+EXPLAIN SELECT MIN(a), MIN(b) FROM t3 where a = 2;
+SELECT MIN(a), MIN(b) FROM t3 where a = 2;
+
+CREATE TABLE t4 (a INT, b INT, c int, KEY(a, b));
+INSERT INTO t4 VALUES (1, 1, 1), (2, NULL, 2), (2, NULL, 2), (3, 1, 3);
+EXPLAIN SELECT MIN(a), MIN(b) FROM t4 where a = 2;
+SELECT MIN(a), MIN(b) FROM t4 where a = 2;
+SELECT MIN(b), min(c) FROM t4 where a = 2;
+
+CREATE TABLE t5( a INT, b INT, KEY( a, b) );
+INSERT INTO t5 VALUES( 1, 1 ), ( 1, 2 );
+EXPLAIN SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1;
+SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1;
+SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1 and b > 1;
+
+DROP TABLE t1, t2, t3, t4, t5;
+
+###
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 77592d015eb..a84ffada1ee 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -335,19 +335,28 @@ insert into t2 values(13491727406643098568),
(0x8000004000000001),
(0x8000040000000001);
-SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42);
+SELECT HEX(a) FROM t2 WHERE a IN
+ (CAST(0xBB3C3E98175D33C8 AS UNSIGNED),
+ 42);
SELECT HEX(a) FROM t2 WHERE a IN
-(0xBB3C3E98175D33C8,
- 0x7fffffffffffffff,
- 0x8000000000000000,
- 0x8000000000000400,
- 0x8000000000000401,
- 42);
-
-SELECT HEX(a) FROM t2 WHERE a IN (0x7fffffffffffffff,0x8000000000000001);
-SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff);
-SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff,'abc');
+ (CAST(0xBB3C3E98175D33C8 AS UNSIGNED),
+ CAST(0x7fffffffffffffff AS UNSIGNED),
+ CAST(0x8000000000000000 AS UNSIGNED),
+ CAST(0x8000000000000400 AS UNSIGNED),
+ CAST(0x8000000000000401 AS UNSIGNED),
+ 42);
+
+SELECT HEX(a) FROM t2 WHERE a IN
+ (CAST(0x7fffffffffffffff AS UNSIGNED),
+ CAST(0x8000000000000001 AS UNSIGNED));
+SELECT HEX(a) FROM t2 WHERE a IN
+ (CAST(0x7ffffffffffffffe AS UNSIGNED),
+ CAST(0x7fffffffffffffff AS UNSIGNED));
+SELECT HEX(a) FROM t2 WHERE a IN
+ (0x7ffffffffffffffe,
+ 0x7fffffffffffffff,
+ 'abc');
CREATE TABLE t3 (a BIGINT UNSIGNED);
INSERT INTO t3 VALUES (9223372036854775551);
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
index 77d7366afe6..bb65cbaa774 100644
--- a/mysql-test/t/func_sapdb.test
+++ b/mysql-test/t/func_sapdb.test
@@ -41,6 +41,8 @@ select datediff("1997-11-30 23:59:59.000001",null);
select weekofyear("1997-11-30 23:59:59.000001");
+select makedate(03,1);
+select makedate('0003',1);
select makedate(1997,1);
select makedate(1997,0);
select makedate(9999,365);
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 197f20db76e..32eb262fd51 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -413,6 +413,7 @@ connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
-- error 1142
alter table t1 rename t2;
+disconnect user1;
connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
@@ -889,7 +890,7 @@ REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij123456789
# Bug #6774: Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
#
# Check if GRANT ... ON * ... fails when no database is selected
-connect (con1, localhost, root,,*NO-ONE*)
+connect (con1, localhost, root,,*NO-ONE*);
connection con1;
--error ER_NO_DB_ERROR
GRANT PROCESS ON * TO user@localhost;
@@ -1122,5 +1123,29 @@ DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost;
+#
+# Bug#27878: Unchecked privileges on a view referring to a table from another
+# database.
+#
+use test;
+CREATE TABLE t1 (f1 int, f2 int);
+INSERT INTO t1 VALUES(1,1), (2,2);
+CREATE DATABASE db27878;
+GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost';
+GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost';
+GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost';
+use db27878;
+CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1;
+connect (user1,localhost,mysqltest_1,,test);
+connection user1;
+use db27878;
+--error 1356
+UPDATE v1 SET f2 = 4;
+SELECT * FROM test.t1;
+disconnect user1;
+connection default;
+DROP DATABASE db27878;
+use test;
+DROP TABLE t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index d08a9e3f83d..4a3324b1833 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -513,3 +513,47 @@ disconnect bug13310;
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
+
+
+#
+# Bug#25578 "CREATE TABLE LIKE does not require any privileges on source table"
+#
+--disable_warnings
+drop database if exists mysqltest_1;
+drop database if exists mysqltest_2;
+--enable_warnings
+--error 0,ER_CANNOT_USER
+drop user mysqltest_u1@localhost;
+
+create database mysqltest_1;
+create database mysqltest_2;
+grant all on mysqltest_1.* to mysqltest_u1@localhost;
+use mysqltest_2;
+create table t1 (i int);
+
+# Connect as user with all rights on mysqltest_1 but with no rights on mysqltest_2.
+connect (user1,localhost,mysqltest_u1,,mysqltest_1);
+connection user1;
+# As expected error is emitted
+--error ER_TABLEACCESS_DENIED_ERROR
+show create table mysqltest_2.t1;
+# This should emit error as well
+--error ER_TABLEACCESS_DENIED_ERROR
+create table t1 like mysqltest_2.t1;
+
+# Now let us check that SELECT privilege on the source is enough
+connection default;
+grant select on mysqltest_2.t1 to mysqltest_u1@localhost;
+connection user1;
+show create table mysqltest_2.t1;
+create table t1 like mysqltest_2.t1;
+
+# Clean-up
+connection default;
+use test;
+drop database mysqltest_1;
+drop database mysqltest_2;
+drop user mysqltest_u1@localhost;
+
+--echo End of 5.0 tests
+
diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test
index 28a75a5ee11..c0f37fe490e 100644
--- a/mysql-test/t/heap_hash.test
+++ b/mysql-test/t/heap_hash.test
@@ -260,4 +260,27 @@ select a from t1 where a in (1,3);
explain select a from t1 where a in (1,3);
drop table t1;
-# End of 4.1 tests
+--echo End of 4.1 tests
+
+#
+# Bug #27643: query failed : 1114 (The table '' is full)
+#
+# Check that HASH indexes disregard trailing spaces when comparing
+# strings with binary collations
+
+CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ col2 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('A', 'A');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES('A ', 'A ');
+DROP TABLE t1;
+CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
+ col2 VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
+ UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('A', 'A');
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES('A ', 'A ');
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index f7fa7366101..b7f264578f2 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -12,6 +12,7 @@
#######################################################################
-- source include/have_innodb.inc
+-- source include/have_log_bin.inc
#
# Small basic test with ignore
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index c9e1de8c3ab..e6d94fe1627 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -169,6 +169,31 @@ INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
SELECT * FROM t1;
DROP TABLE t1;
+#
+# Bug #28272: EXPLAIN for SELECT from an empty InnoDB table
+#
+
+CREATE TABLE t1 (
+ a1 decimal(10,0) DEFAULT NULL,
+ a2 blob,
+ a3 time DEFAULT NULL,
+ a4 blob,
+ a5 char(175) DEFAULT NULL,
+ a6 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ a7 tinyblob,
+ INDEX idx (a6,a7(239),a5)
+) ENGINE=InnoDB;
+
+EXPLAIN SELECT a4 FROM t1 WHERE
+a6=NULL AND
+a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
+
+EXPLAIN SELECT t1.a4 FROM t1, t1 t WHERE
+t.a6=t.a6 AND t1.a6=NULL AND
+t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
+
+DROP TABLE t1;
+
--echo End of 4.1 tests
#
# Bug #12882 min/max inconsistent on empty table
@@ -518,4 +543,66 @@ select * from t1;
drop table t1;
+#
+# Bug #28189: optimizer erroniously prefers ref access to range access
+# for an InnoDB table
+#
+
+CREATE TABLE t1(
+ id int AUTO_INCREMENT PRIMARY KEY,
+ stat_id int NOT NULL,
+ acct_id int DEFAULT NULL,
+ INDEX idx1 (stat_id, acct_id),
+ INDEX idx2 (acct_id)
+) ENGINE=MyISAM;
+
+CREATE TABLE t2(
+ id int AUTO_INCREMENT PRIMARY KEY,
+ stat_id int NOT NULL,
+ acct_id int DEFAULT NULL,
+ INDEX idx1 (stat_id, acct_id),
+ INDEX idx2 (acct_id)
+) ENGINE=InnoDB;
+
+INSERT INTO t1(stat_id,acct_id) VALUES
+ (1,759), (2,831), (3,785), (4,854), (1,921),
+ (1,553), (2,589), (3,743), (2,827), (2,545),
+ (4,779), (4,783), (1,597), (1,785), (4,832),
+ (1,741), (1,833), (3,788), (2,973), (1,907);
+
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+INSERT INTO t1(stat_id,acct_id) SELECT stat_id, mod(id+100000, acct_id) FROM t1;
+UPDATE t1 SET acct_id=785
+ WHERE MOD(stat_id,2)=0 AND MOD(id,stat_id)=MOD(acct_id,stat_id);
+OPTIMIZE TABLE t1;
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t1 WHERE acct_id=785;
+
+EXPLAIN SELECT COUNT(*) FROM t1 WHERE stat_id IN (1,3) AND acct_id=785;
+
+INSERT INTO t2 SELECT * FROM t1;
+OPTIMIZE TABLE t2;
+
+EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
+
+DROP TABLE t1,t2;
+
+#
+# Bug #28652: assert when alter innodb table operation
+#
+create table t1(a int) engine=innodb;
+alter table t1 comment '123';
+show create table t1;
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index 0a8e184ea5c..76177403bd0 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -216,3 +216,142 @@ select * from t1;
drop view v1;
drop table t1,t2;
+
+#
+# BUG#21483: Server abort or deadlock on INSERT DELAYED with another
+# implicit insert
+#
+# The solution is to downgrade INSERT DELAYED to normal INSERT if the
+# statement uses functions and access tables or triggers, or is called
+# from a function or a trigger.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+delimiter |;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+ INSERT INTO t1 VALUES (1);
+ RETURN 1;
+END |
+CREATE FUNCTION f2() RETURNS INT
+BEGIN
+ INSERT DELAYED INTO t1 VALUES (2);
+ RETURN 1;
+END |
+delimiter ;|
+
+SELECT f1();
+SELECT f2();
+INSERT INTO t1 VALUES (3);
+INSERT DELAYED INTO t1 VALUES (4);
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+INSERT INTO t1 VALUES (f1());
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+INSERT DELAYED INTO t1 VALUES (f1());
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+INSERT INTO t1 VALUES (f2());
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+INSERT DELAYED INTO t1 VALUES (f2());
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+ INSERT INTO t1 VALUES (NEW.i);
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+INSERT INTO t1 VALUES (1);
+
+--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
+INSERT DELAYED INTO t1 VALUES (1);
+
+SELECT * FROM t1;
+
+DROP FUNCTION f2;
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+#
+# BUG#20497: Trigger with INSERT DELAYED causes Error 1165
+#
+# Fixed by the patch for Bug#21483
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+CREATE TABLE t2 (i INT);
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+ INSERT DELAYED INTO t2 VALUES (NEW.i);
+
+CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
+ INSERT DELAYED INTO t2 VALUES (NEW.i);
+
+CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW
+ INSERT DELAYED INTO t2 VALUES (OLD.i);
+
+INSERT INTO t1 VALUES (1);
+INSERT DELAYED INTO t1 VALUES (2);
+SELECT * FROM t1;
+UPDATE t1 SET i = 3 WHERE i = 1;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE i = 3;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+DROP TABLE t1, t2;
+
+#
+# BUG#21714: Wrong NEW.value and server abort on INSERT DELAYED to a
+# table with a trigger
+#
+# Fixed by the patch for Bug#21483
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (i INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
+ SET @a= NEW.i;
+
+SET @a= 0;
+INSERT DELAYED INTO t1 VALUES (1);
+SELECT @a;
+INSERT DELAYED INTO t1 VALUES (2);
+SELECT @a;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (i INT);
+CREATE TABLE t2 (i INT);
+
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+ INSERT INTO t2 VALUES (NEW.i);
+
+CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW
+ INSERT DELAYED INTO t2 VALUES (NEW.i);
+
+CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW
+ INSERT DELAYED INTO t2 VALUES (OLD.i);
+
+INSERT DELAYED INTO t1 VALUES (1);
+SELECT * FROM t1;
+UPDATE t1 SET i = 2 WHERE i = 1;
+SELECT * FROM t1;
+DELETE FROM t1 WHERE i = 2;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+DROP TABLE t1, t2;
+
+--echo End of 5.0 tests.
+
diff --git a/mysql-test/t/insert_select-binlog.test b/mysql-test/t/insert_select-binlog.test
index d4041f86ab5..4bff09577a7 100644
--- a/mysql-test/t/insert_select-binlog.test
+++ b/mysql-test/t/insert_select-binlog.test
@@ -1,5 +1,6 @@
# Embedded server doesn't support binlog
-- source include/not_embedded.inc
+-- source include/have_log_bin.inc
# Check if a partly-completed INSERT SELECT in a MyISAM table goes into the
# binlog
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
index 76df4502769..725fbdb25d7 100644
--- a/mysql-test/t/insert_update.test
+++ b/mysql-test/t/insert_update.test
@@ -247,3 +247,46 @@ REPLACE INTO t1 VALUES (0,"test1",null);
SELECT id, f1 FROM t1;
DROP TABLE t1;
SET SQL_MODE='';
+
+#
+# Bug#27954: multi-row INSERT ... ON DUPLICATE with duplicated
+# row at the first place into table with AUTO_INCREMENT and
+# additional UNIQUE key.
+#
+CREATE TABLE t1 (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ c1 CHAR(1) UNIQUE KEY,
+ cnt INT DEFAULT 1
+);
+INSERT INTO t1 (c1) VALUES ('A'), ('B'), ('C');
+SELECT * FROM t1;
+INSERT INTO t1 (c1) VALUES ('A'), ('X'), ('Y'), ('Z')
+ ON DUPLICATE KEY UPDATE cnt=cnt+1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug#28000: INSERT IGNORE ... SELECT ... ON DUPLICATE
+# with erroneous UPDATE: NOT NULL field with NULL value.
+#
+CREATE TABLE t1 (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ c1 INT NOT NULL,
+ cnt INT DEFAULT 1
+);
+INSERT INTO t1 (id,c1) VALUES (1,10);
+SELECT * FROM t1;
+CREATE TABLE t2 (id INT, c1 INT);
+INSERT INTO t2 VALUES (1,NULL), (2,2);
+--error 1048
+INSERT INTO t1 (id,c1) SELECT 1,NULL
+ ON DUPLICATE KEY UPDATE c1=NULL;
+SELECT * FROM t1;
+INSERT IGNORE INTO t1 (id,c1) SELECT 1,NULL
+ ON DUPLICATE KEY UPDATE c1=NULL, cnt=cnt+1;
+SELECT * FROM t1;
+INSERT IGNORE INTO t1 (id,c1) SELECT * FROM t2
+ ON DUPLICATE KEY UPDATE c1=NULL, cnt=cnt+1;
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index a0fc7059179..68b97854c3b 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -333,6 +333,30 @@ select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
drop table t1,t2,t3;
+#
+# Bug #27531: Query performance degredation in 4.1.22 and greater
+#
+CREATE TABLE t1 (a int, b int default 0, c int default 1);
+
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 (a) SELECT a + 8 FROM t1;
+INSERT INTO t1 (a) SELECT a + 16 FROM t1;
+
+CREATE TABLE t2 (a int, d int, e int default 0);
+
+INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4);
+INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2;
+INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2;
+
+# should use join cache
+EXPLAIN
+SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
+ ORDER BY t1.b, t1.c;
+SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
+ ORDER BY t1.b, t1.c;
+
+DROP TABLE t1,t2;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index a0620e144c2..1a59dbf8fc2 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -825,3 +825,39 @@ SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='bla';
SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='Bla';
DROP TABLE t1,t2;
+
+#
+# Bug 28188: 'not exists' optimization for outer joins
+#
+
+CREATE TABLE t1 (id int PRIMARY KEY, a varchar(8));
+CREATE TABLE t2 (id int NOT NULL, b int NOT NULL, INDEX idx(id));
+INSERT INTO t1 VALUES
+ (1,'aaaaaaa'), (5,'eeeeeee'), (4,'ddddddd'), (2,'bbbbbbb'), (3,'ccccccc');
+INSERT INTO t2 VALUES
+ (3,10), (2,20), (5,30), (3,20), (5,10), (3,40), (3,30), (2,10), (2,40);
+
+EXPLAIN
+SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
+
+flush status;
+SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
+show status like 'Handler_read%';
+
+DROP TABLE t1,t2;
+
+#
+# Bug 28571: outer join with false on condition over constant tables
+#
+
+CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL);
+INSERT INTO t1 VALUES (1,0), (2,1);
+CREATE TABLE t2 (d int PRIMARY KEY);
+INSERT INTO t2 VALUES (1), (2), (3);
+
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
+SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
+SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
+
+DROP TABLE t1,t2;
+
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index e84b2071ab1..3d0e68dc0f3 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -432,3 +432,15 @@ ORDER BY c.b, c.d
;
DROP TABLE t1, t2;
+
+
+#
+# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX.
+#
+CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES( 1 );
+ALTER TABLE t1 DISABLE KEYS;
+EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
+DROP TABLE t1;
+
+--echo End of 5.0 tests.
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 1e99911a7e3..5f6bae00254 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -117,3 +117,188 @@ reap;
select 1;
connection con1;
select RELEASE_LOCK("a");
+
+#
+# Bug#27563: Stored functions and triggers wasn't throwing an error when killed.
+#
+create table t1(f1 int);
+delimiter |;
+create function bug27563() returns int(11)
+deterministic
+begin
+ declare continue handler for sqlstate '70100' set @a:= 'killed';
+ declare continue handler for sqlexception set @a:= 'exception';
+ set @a= get_lock("lock27563", 10);
+ return 1;
+end|
+delimiter ;|
+# Test stored functions
+# Test INSERT
+connection con1;
+select get_lock("lock27563",10);
+connection con2;
+let $ID= `select connection_id()`;
+send insert into t1 values (bug27563());
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+
+# Test UPDATE
+insert into t1 values(0);
+connection con2;
+send update t1 set f1= bug27563();
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+
+# Test DELETE
+insert into t1 values(1);
+connection con2;
+send delete from t1 where bug27563() is null;
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+
+# Test SELECT
+connection con2;
+send select * from t1 where f1= bug27563();
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+
+# Test PROCEDURE
+connection con2;
+delimiter |;
+create procedure proc27563()
+begin
+ declare continue handler for sqlstate '70100' set @a:= 'killed';
+ declare continue handler for sqlexception set @a:= 'exception';
+ select get_lock("lock27563",10);
+ select "shouldn't be selected";
+end|
+delimiter ;|
+send call proc27563();
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+
+# Test TRIGGERS
+connection con2;
+create table t2 (f2 int);
+delimiter |;
+create trigger trg27563 before insert on t1 for each row
+begin
+ declare continue handler for sqlstate '70100' set @a:= 'killed';
+ declare continue handler for sqlexception set @a:= 'exception';
+ set @a:= get_lock("lock27563",10);
+ insert into t2 values(1);
+end|
+delimiter ;|
+send insert into t1 values(2),(3);
+real_sleep 2;
+connection con1;
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection con2;
+--error 1317
+reap;
+select @a;
+connection con1;
+select * from t1;
+select * from t2;
+
+# Cleanup
+select release_lock("lock27563");
+drop table t1, t2;
+drop function bug27563;
+drop procedure proc27563;
+
+#
+# Bug#28598: mysqld crash when killing a long-running explain query.
+#
+--disable_query_log
+connection con1;
+let $ID= `select connection_id()`;
+let $tab_count= 40;
+
+let $i= $tab_count;
+while ($i)
+{
+ eval CREATE TABLE t$i (a$i int, KEY(a$i));
+ eval INSERT INTO t$i VALUES (1),(2),(3),(4),(5),(6),(7);
+ dec $i ;
+}
+set session optimizer_search_depth=0;
+
+let $i=$tab_count;
+while ($i)
+{
+ let $a= a$i;
+ let $t= t$i;
+ dec $i;
+ if ($i)
+ {
+ let $comma=,;
+ let $from=$comma$t$from;
+ let $where=a$i=$a $and $where;
+ }
+ if (!$i)
+ {
+ let $from=FROM $t$from;
+ let $where=WHERE $where;
+ }
+ let $and=AND;
+}
+
+--enable_query_log
+eval PREPARE stmt FROM 'EXPLAIN SELECT * $from $where';
+send EXECUTE stmt;
+--disable_query_log
+
+connection con2;
+real_sleep 2;
+eval kill query $ID;
+let $i= $tab_count;
+while ($i)
+{
+ eval DROP TABLE t$i;
+ dec $i ;
+}
+--enable_query_log
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index bc599b20d36..286c04785ff 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -71,3 +71,20 @@ explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #28464: a string argument to 'limit ?' PS
+#
+
+prepare s from "select 1 limit ?";
+set @a='qwe';
+--error 1210
+execute s using @a;
+prepare s from "select 1 limit 1, ?";
+--error 1210
+execute s using @a;
+prepare s from "select 1 limit ?, ?";
+--error 1210
+execute s using @a, @a;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index e6788cd7798..2757a37b881 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -152,4 +152,30 @@ select * from t2;
--exec rm $MYSQLTEST_VARDIR/tmp/t1
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1,t2;
+
+#
+# Bug#27670: LOAD DATA does not set CURRENT_TIMESTAMP default value for a
+# TIMESTAMP field when no value has been provided.
+#
+create table t1(f1 int, f2 timestamp not null default current_timestamp);
+create table t2(f1 int);
+insert into t2 values(1),(2);
+disable_query_log;
+eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2;
+eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1;
+enable_query_log;
+select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
+--exec rm $MYSQLTEST_VARDIR/tmp/t2
+delete from t1;
+disable_query_log;
+eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t2'
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
+FROM t2;
+eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1
+FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
+enable_query_log;
+select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
+--exec rm $MYSQLTEST_VARDIR/tmp/t2
+drop table t1,t2;
+
# End of 5.0 tests
diff --git a/mysql-test/t/long_tmpdir-master.opt b/mysql-test/t/long_tmpdir-master.opt
new file mode 100644
index 00000000000..398abfc4632
--- /dev/null
+++ b/mysql-test/t/long_tmpdir-master.opt
@@ -0,0 +1 @@
+--tmpdir=$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
diff --git a/mysql-test/t/long_tmpdir-master.sh b/mysql-test/t/long_tmpdir-master.sh
new file mode 100644
index 00000000000..318955fbcca
--- /dev/null
+++ b/mysql-test/t/long_tmpdir-master.sh
@@ -0,0 +1,3 @@
+d="$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789"
+test -d "$d" || mkdir "$d"
+rm -f "$d"/*
diff --git a/mysql-test/t/long_tmpdir.test b/mysql-test/t/long_tmpdir.test
new file mode 100644
index 00000000000..cf0bed29918
--- /dev/null
+++ b/mysql-test/t/long_tmpdir.test
@@ -0,0 +1,9 @@
+#
+# Bug #29015: Stack overflow in processing temporary table name when tmpdir path
+# is long
+#
+
+create view v1 as select table_name from information_schema.tables;
+drop view v1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index a6ebfdc14c1..df4acec2021 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -81,3 +81,14 @@ drop view v1,v2,v3;
--disable_metadata
# End of 4.1 tests
+
+#
+# Bug #28492: subselect returns LONG in >5.0.24a and LONGLONG in <=5.0.24a
+#
+--enable_metadata
+select a.* from (select 2147483648 as v_large) a;
+select a.* from (select 214748364 as v_small) a;
+--disable_metadata
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
index 8bced9f069c..428aba92342 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -5,9 +5,7 @@
# did some tests manually on a slave; tables are replicated fine and
# Exec_Master_Log_Pos advances as expected.
-# Embedded server doesn't support binlogging
--- source include/not_embedded.inc
-
+-- source include/have_log_bin.inc
-- source include/have_innodb.inc
--disable_warnings
@@ -28,9 +26,7 @@ insert into t1 values(1);
insert into t2 select * from t1;
commit;
---replace_column 5 #
---replace_result "xid=14" "xid=8"
-show binlog events from 98;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -42,8 +38,7 @@ insert into t2 select * from t1;
# should say some changes to non-transact1onal tables couldn't be rolled back
rollback;
---replace_column 5 #
-show binlog events from 98;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -57,9 +52,7 @@ insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
---replace_column 5 #
---replace_result "xid=47" "xid=25"
-show binlog events from 98;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -75,9 +68,7 @@ insert into t1 values(7);
commit;
select a from t1 order by a; # check that savepoints work :)
---replace_column 5 #
---replace_result "xid=69" "xid=37"
-show binlog events from 98;
+source include/show_binlog_events.inc;
# and when ROLLBACK is not explicit?
delete from t1;
@@ -97,8 +88,7 @@ connection con2;
# so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that
# logging has been done, we use a user lock.
select get_lock("a",10);
---replace_column 5 #
-show binlog events from 98;
+source include/show_binlog_events.inc;
# and when not in a transact1on?
delete from t1;
@@ -108,9 +98,7 @@ reset master;
insert into t1 values(9);
insert into t2 select * from t1;
---replace_column 5 #
---replace_result "xid=117" "xid=60"
-show binlog events from 98;
+source include/show_binlog_events.inc;
# Check that when the query updat1ng the MyISAM table is the first in the
# transaction, we log it immediately.
@@ -121,16 +109,11 @@ reset master;
insert into t1 values(10); # first make t1 non-empty
begin;
insert into t2 select * from t1;
---replace_column 5 #
---replace_result "xid=131" "xid=66"
-show binlog events from 98;
+source include/show_binlog_events.inc;
insert into t1 values(11);
commit;
---replace_column 5 #
---replace_result "xid=131" "xid=66" "xid=134" "xid=68"
-show binlog events from 98;
-
+source include/show_binlog_events.inc;
# Check that things work like before this BEGIN/ROLLBACK code was added,
# when t2 is INNODB
@@ -146,9 +129,7 @@ insert into t1 values(12);
insert into t2 select * from t1;
commit;
---replace_column 5 #
---replace_result "xid=153" "xid=78"
-show binlog events from 98;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -159,8 +140,7 @@ insert into t1 values(13);
insert into t2 select * from t1;
rollback;
---replace_column 5 #
-show binlog events from 98;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -174,9 +154,7 @@ insert into t2 select * from t1;
rollback to savepoint my_savepoint;
commit;
---replace_column 5 #
---replace_result "xid=185" "xid=94"
-show binlog events from 98;
+source include/show_binlog_events.inc;
delete from t1;
delete from t2;
@@ -192,9 +170,7 @@ insert into t1 values(18);
commit;
select a from t1 order by a; # check that savepoints work :)
---replace_column 5 #
---replace_result "xid=206" "xid=105"
-show binlog events from 98;
+source include/show_binlog_events.inc;
# Test for BUG#5714, where a MyISAM update in the transaction used to
# release row-level locks in InnoDB
@@ -253,9 +229,7 @@ insert into t2 values (3);
disconnect con2;
connection con3;
select get_lock("lock1",60);
---replace_column 5 #
---replace_result "xid=206" "xid=105" "xid=224" "xid=114" "xid=227" "xid=115" "xid=231" "xid=117" "xid=258" "xid=132"
-show binlog events from 98;
+source include/show_binlog_events.inc;
do release_lock("lock1");
drop table t0,t2;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 82d10059c65..12b9423be21 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1145,4 +1145,20 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
create table t4 (c1 int) engine=myisam pack_keys=2;
drop table t1, t2, t3;
+#
+# Bug#28476: force index on a disabled myisam index gives error 124
+#
+CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
+INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+ALTER TABLE t1 DISABLE KEYS;
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+SELECT a FROM t1 USE INDEX (inx) WHERE a=1;
+SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1;
+SELECT b FROM t1 USE INDEX (uinx) WHERE b=1;
+SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1;
+ALTER TABLE t1 ENABLE KEYS;
+SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 0732559e7e1..37bbca77d9f 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -262,7 +262,7 @@ EOF
--exec $MYSQL test -e "show status" 2>&1 > /dev/null
--exec $MYSQL --help 2>&1 > /dev/null
--exec $MYSQL --version 2>&1 > /dev/null
---enable_quary_log
+--enable_query_log
#
# bug #26851: Mysql Client --pager Buffer Overflow
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 3f9626fcc42..233e8c7c256 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -55,3 +55,16 @@ DROP USER mysqltest1@'%';
--replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9]*\)/(errno)/
--error 1
--exec $MYSQL_UPGRADE --skip-verbose --force --host=not_existing_host 2>&1
+
+#
+# Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
+#
+
+# The SQL commands used by mysql_upgrade are written to be run
+# with sql_mode set to '' - thus the scripts should change sql_mode
+# for the session to make sure the SQL is legal.
+
+# Test by setting sql_mode before running mysql_upgrade
+set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
+--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+eval set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
index 1487606a6c2..ca938be7d76 100644
--- a/mysql-test/t/mysqlbinlog-cp932.test
+++ b/mysql-test/t/mysqlbinlog-cp932.test
@@ -1,6 +1,7 @@
# disabled in embedded until tools running is fixed with embedded
--source include/not_embedded.inc
-- source include/have_cp932.inc
+-- source include/have_log_bin.inc
# Bug#16217 (mysql client did not know how not switch its internal charset)
flush logs;
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index a7b3f413f23..ba161ddbb89 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -1,7 +1,6 @@
# We are using .opt file since we need small binlog size
-# Embedded server doesn't support binlogging
--- source include/not_embedded.inc
+-- source include/have_log_bin.inc
# we need this for getting fixed timestamps inside of this test
set timestamp=1000000000;
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index 14b213cd9cc..c6869d67da1 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -1,8 +1,7 @@
# Test for the new options --start-datetime, stop-datetime,
# and a few others.
-# Embedded server doesn't support binlogging
--- source include/not_embedded.inc
+-- source include/have_log_bin.inc
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 4c4690520c6..7681e5a6295 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1,5 +1,6 @@
# Embedded server doesn't support external clients
--source include/not_embedded.inc
+--source include/have_log_bin.inc
--disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
@@ -1528,7 +1529,14 @@ drop user user2;
drop database mysqldump_test_db;
+--echo #
+--echo # Bug #28522: buffer overrun by '\0' byte using --hex-blob.
+--echo #
+CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
+INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
+--exec $MYSQL_DUMP --skip-create --compact --hex-blob test t1
+DROP TABLE t1;
--echo #
--echo # End of 5.0 tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 328206626df..d7c9945fe18 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -46,11 +46,6 @@ select otto from (select 1 as otto) as t1;
--error 0
select otto from (select 1 as otto) as t1;
-# expectation <> response
--- // --error 1054
--- // select otto from (select 1 as otto) as t1;
-
-
# ----------------------------------------------------------------------------
# Negative case(statement):
# The derived table t1 does not contain a column named 'friedrich' .
@@ -331,9 +326,9 @@ select 3 from t1 ;
# This is a comment
# This is a ; comment
# This is a -- comment
--- This is also a comment
--- # This is also a comment
--- This is also a ; comment
+# -- This is also a comment
+# -- # This is also a comment
+# -- This is also a ; comment
# ----------------------------------------------------------------------------
# Test comments with embedded command
@@ -1227,11 +1222,9 @@ select "a" as col1, "c" as col2;
# Test sync_with_master
# ----------------------------------------------------------------------------
--error 1
---exec echo "save_master_pos; sync_with_master 10!;" | $MYSQL_TEST 2>&1
+--exec echo "sync_with_master 10!;" | $MYSQL_TEST 2>&1
--error 1
---exec echo "save_master_pos; sync_with_master 10 !;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1
+--exec echo "sync_with_master a;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test connect
@@ -1740,23 +1733,130 @@ EOF
--exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
-# test for query_sorted
+# test for sorted_result
# ----------------------------------------------------------------------------
create table t1( a int, b char(255), c timestamp);
insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 2", '2007-04-05');
insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 3", '2007-04-05');
select * from t1;
-query_sorted select * from t1;
+--sorted_result
+select * from t1;
+# Should not be sorted
+select * from t1;
disable_result_log;
-query_sorted select * from t1;
+sorted_result;
+select * from t1;
enable_result_log;
-query_sorted select '';
-query_sorted select "h";
-query_sorted select "he";
-query_sorted select "hep";
-query_sorted select "hepp";
+--sorted_result
+select '';
+sorted_result;
+select "h";
+--sorted_result
+select "he";
+--sorted_result
+select "hep";
+--sorted_result
+select "hepp";
+drop table t1;
+
+# 1. Assignment of result set sorting
+sorted_result;
+ SELECT 2 as "my_col"
+UNION
+SELECT 1;
+#
+--sorted_result
+SELECT 2 as "my_col" UNION SELECT 1;
+--sorted_result
+SELECT 2 as "my_col"
+UNION
+SELECT 1;
+
+# 2. Ensure that the table header will be not sorted into the result
+--sorted_result
+SELECT '2' as "3"
+UNION
+SELECT '1';
+
+# 3. Ensure that an empty result set does not cause problems
+CREATE TABLE t1( a CHAR);
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# 4. Ensure that NULL values within the result set do not cause problems
+SELECT NULL as "my_col1",2 AS "my_col2"
+UNION
+SELECT NULL,1;
+--sorted_result
+SELECT NULL as "my_col1",2 AS "my_col2"
+UNION
+SELECT NULL,1;
+#
+SELECT 2 as "my_col1",NULL AS "my_col2"
+UNION
+SELECT 1,NULL;
+--sorted_result
+SELECT 2 as "my_col1",NULL AS "my_col2"
+UNION
+SELECT 1,NULL;
+
+# 5. "sorted_result" changes nothing when applied to a non query statement.
+sorted_result;
+ SET @a = 17;
+#
+# 6. Show that "sorted_result;" before the "SET @a = 17;" above does not affect
+# the now following query.
+SELECT 2 as "my_col"
+UNION
+SELECT 1;
+
+# 7. Ensure that "sorted_result" in combination with $variables works
+let $my_stmt=SELECT 2 as "my_col"
+UNION
+SELECT 1;
+--sorted_result
+eval $my_stmt;
+
+# 8. Ensure that "sorted_result " does not change the semantics of
+# "--error ...." or the protocol output after such an expected failure
+--sorted_result
+--error 1146
+SELECT '2' as "my_col1",2 as "my_col2"
+UNION
+SELECT '1',1 from t2;
+
+# 9. Ensure that several result formatting options including "sorted_result"
+# - have all an effect
+# - "--sorted_result" does not need to be direct before the statement
+# - Row sorting is applied after modification of the column content
+--sorted_result
+--replace_column 1 #
+SELECT '1' as "my_col1",2 as "my_col2"
+UNION
+SELECT '2',1;
+
+# 10. Ensure that at least 1024 rows within a result set do not cause problems
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 SET f1 = 1024;
+INSERT INTO t1 SELECT f1 - 1 FROM t1;
+INSERT INTO t1 SELECT f1 - 2 FROM t1;
+INSERT INTO t1 SELECT f1 - 4 FROM t1;
+INSERT INTO t1 SELECT f1 - 8 FROM t1;
+INSERT INTO t1 SELECT f1 - 16 FROM t1;
+INSERT INTO t1 SELECT f1 - 32 FROM t1;
+INSERT INTO t1 SELECT f1 - 64 FROM t1;
+INSERT INTO t1 SELECT f1 - 128 FROM t1;
+INSERT INTO t1 SELECT f1 - 256 FROM t1;
+INSERT INTO t1 SELECT f1 - 512 FROM t1;
+--disable_result_log
+--sorted_result
+SELECT * FROM t1;
+--enable_result_log
+DROP TABLE t1;
# ----------------------------------------------------------------------------
# Some coverage tests
# ----------------------------------------------------------------------------
@@ -1764,10 +1864,132 @@ query_sorted select "hepp";
--disable_query_log
--exec $MYSQL_TEST --help 2>&1 > /dev/null
--exec $MYSQL_TEST --version 2>&1 > /dev/null
---enable_quary_log
+--enable_query_log
--disable_abort_on_error
--error 1
--exec $MYSQL_TEST a b c 2>&1 > /dev/null
--enable_abort_on_error
+--enable_query_log
+
+# ----------------------------------------------------------------------------
+# test for query_get_value
+# ----------------------------------------------------------------------------
+
+CREATE TABLE t1(
+ a int, b varchar(255), c datetime
+);
+SHOW COLUMNS FROM t1;
+
+#------------ Positive tests ------------
+# 1. constant parameters
+# value is simple string without spaces
+let $value= query_get_value(SHOW COLUMNS FROM t1, Type, 1);
+--echo statement=SHOW COLUMNS FROM t1 row_number=1, column_name="Type", Value=$value
+let $value= query_get_value("SHOW COLUMNS FROM t1", Type, 1);
+--echo statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=$value
+#
+# 2. $variables as parameters
+# value IS NULL
+let $my_show= SHOW COLUMNS FROM t1;
+let $column_name= Default;
+let $row_number= 1;
+let $value= query_get_value($my_show, $column_name, $row_number);
+--echo statement=$my_show row_number=$row_number, column_name=$column_name, Value=$value
+#
+# 3. result set of a SELECT (not recommended, because projection and
+# selection could be done much better by pure SELECT functionality)
+# value is string with space in the middle
+let $value= query_get_value(SELECT 'A B' AS "MyColumn", MyColumn, 1);
+--echo value= ->$value<-
+#
+# 4. column name with space
+let $value= query_get_value(SELECT 1 AS "My Column", My Column, 1);
+--echo value= $value
+#
+#------------ Negative tests ------------
+# 5. Incomplete statement including missing parameters
+# 5.1 incomplete statement
+--error 1
+--exec echo "let \$value= query_get_value(SHOW;" | $MYSQL_TEST 2>&1
+# 5.2 missing query
+--error 1
+--exec echo "let \$value= query_get_value;" | $MYSQL_TEST 2>&1
+# 5.3 missing column name
+--error 1
+--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1);" | $MYSQL_TEST 2>&1
+# 5.4 missing row number
+--error 1
+--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field);" | $MYSQL_TEST 2>&1
+#
+# 6. Somehow "wrong" value of parameters
+# 6.1 row parameter
+# 6.1.1 non sense number 0
+let $value= initialized;
+let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 0);
+--echo value= $value
+# 6.1.2 after the last row
+let $value= initialized;
+let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 10);
+--echo value= $value
+# 6.1.3 invalid row number
+--error 1
+--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field, notnumber);" | $MYSQL_TEST 2>&1
+# 6.2 column name parameter, name of not existing column
+--error 1
+--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, column_not_exists, 1);" | $MYSQL_TEST 2>&1
+# 6.3. statement which never gives a result set
+--error 1
+--exec echo "let \$value= query_get_value(SET @A = 1, Field, 1);" | $MYSQL_TEST 2>&1
+# 6.4. statement contains a ","
+# Note: There is no need to improve this, because we need query_get_value
+# for SHOW commands only.
+--error 1
+--exec echo "let \$value= query_get_value(SELECT 1 AS "A", 1 AS "B", 1);" | $MYSQL_TEST 2>&1
+#
+# 7. empty result set
+let $value= initialized;
+let $value= query_get_value(SELECT a FROM t1, a, 1);
+--echo value= $value
+#
+# 9. failing statement
+--error 1
+--exec echo "let \$value= query_get_value(SHOW COLNS FROM t1, Field, 1);" | $MYSQL_TEST 2>&1
+#
+# 10. Artificial example how to process a complete SHOW result set:
+let $show_statement= SHOW COLUMNS FROM t1;
+let $rowno= 1;
+let $run=1;
+let $count= 0;
+--echo
+--echo Field Type Null Key Default Extra
+while ($run)
+{
+ let $Field= query_get_value($show_statement, Field, $rowno);
+ if (`SELECT '$Field' = 'No such row'`)
+ {
+ let $run= 0;
+ }
+ if (`SELECT '$Field' <> 'No such row'`)
+ {
+ let $Type= query_get_value($show_statement, Type, $rowno);
+ let $Null= query_get_value($show_statement, Null, $rowno);
+ if (`SELECT '$Null' = 'YES'`)
+ {
+ inc $count;
+ }
+ let $Key= query_get_value($show_statement, Key, $rowno);
+ let $Default= query_get_value($show_statement, Default, $rowno);
+ let $Extra= query_get_value($show_statement, Extra, $rowno);
+ --echo $Field $Type $Null ->$Key<- $Default $Extra
+ inc $rowno;
+ }
+}
+--echo
+--echo Number of columns with Default NULL: $count
+--echo
+eval $show_statement;
+
+drop table t1;
--echo End of tests
+
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index 8fda2ede948..70fbfbfe733 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -607,6 +607,21 @@ select * from t1 order by counter;
drop table t1;
#
+# bug#27437
+connection con1;
+create table t1 (a int primary key auto_increment) engine = ndb;
+insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
+connection con2;
+insert into t1(a) values (20),(28);
+connection con1;
+insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
+connection con2;
+insert into t1() values (21), (22);
+connection con1;
+
+drop table t1;
+
+#
# BUG#14514 Creating table with packed key fails silently
#
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
index bf25ca9a133..f346b7dc4ab 100644
--- a/mysql-test/t/ndb_insert.test
+++ b/mysql-test/t/ndb_insert.test
@@ -630,4 +630,13 @@ INSERT IGNORE INTO t1 VALUES (4,NULL),(5,NULL),(6,NULL),(7,4);
SELECT * FROM t1 ORDER BY pk;
DROP TABLE t1;
+#
+# Bug #27980 INSERT IGNORE wrongly ignores NULLs in unique index
+#
+
+create table t1(a int primary key, b int, unique key(b)) engine=ndb;
+insert ignore into t1 values (1,0), (2,0), (2,null), (3,null);
+select * from t1 order by a;
+drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 3e8fa07dfb7..29a290c7fbf 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -719,10 +719,10 @@ CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME);
INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10);
UPDATE t1 SET b = SEC_TO_TIME(a);
--- Correct ORDER
+# Correct ORDER
SELECT a, b FROM t1 ORDER BY b DESC;
--- must be ordered as the above
+# must be ordered as the above
SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
DROP TABLE t1;
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index 7c90fd32909..2b80b0b9d93 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -41,9 +41,9 @@ eval select * into dumpfile "../tmp/outfile-test.2" from t1;
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
enable_query_log;
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
---exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.3
+--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1
+--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.2
+--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
drop table t1;
# Bug#8191
@@ -51,7 +51,7 @@ disable_query_log;
eval select 1 into outfile "../tmp/outfile-test.4";
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.4"));
---exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
+--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
#
# Bug #5382: 'explain select into outfile' crashes the server
@@ -75,7 +75,7 @@ eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
FROM information_schema.schemata LIMIT 0, 5;
# enable_query_log;
---exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
+--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
use information_schema;
# disable_query_log;
@@ -83,7 +83,7 @@ eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
FROM schemata LIMIT 0, 5;
enable_query_log;
---exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
+--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
use test;
#
@@ -96,3 +96,38 @@ create table t1(a int);
eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1;
drop table t1;
+#
+# Bug#28181 Access denied to 'information_schema when
+# select into out file (regression)
+#
+create database mysqltest;
+create user user_1@localhost;
+grant all on mysqltest.* to user_1@localhost;
+connect (con28181_1,localhost,user_1,,mysqltest);
+
+--error 1044
+eval select schema_name
+into outfile "../tmp/outfile-test.4"
+fields terminated by ',' optionally enclosed by '"'
+ lines terminated by '\n'
+from information_schema.schemata
+where schema_name like 'mysqltest';
+
+connection default;
+grant file on *.* to user_1@localhost;
+
+connect (con28181_2,localhost,user_1,,mysqltest);
+eval select schema_name
+into outfile "../tmp/outfile-test.4"
+fields terminated by ',' optionally enclosed by '"'
+ lines terminated by '\n'
+from information_schema.schemata
+where schema_name like 'mysqltest';
+
+connection default;
+--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
+use test;
+revoke all privileges on *.* from user_1@localhost;
+drop user user_1@localhost;
+drop database mysqltest;
+
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 3fbcf84a1f9..93a89c2b275 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -33,13 +33,13 @@ deallocate prepare no_such_statement;
execute stmt1;
# Nesting ps commands is not allowed:
---error 1064
+--error ER_UNSUPPORTED_PS
prepare stmt2 from 'prepare nested_stmt from "select 1"';
---error 1064
+--error ER_UNSUPPORTED_PS
prepare stmt2 from 'execute stmt1';
---error 1064
+--error ER_UNSUPPORTED_PS
prepare stmt2 from 'deallocate prepare z';
# PS insert
@@ -1194,6 +1194,24 @@ show create table t1;
--enable_warnings
drop table t1;
deallocate prepare stmt;
+#
+
+#
+# Bug #27937: crash on the second execution for prepared statement
+# from UNION with ORDER BY an expression containing RAND()
+#
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (2), (3), (1);
+
+PREPARE st1 FROM
+ '(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a';
+
+EXECUTE st1;
+EXECUTE st1;
+
+DEALLOCATE PREPARE st1;
+DROP TABLE t1;
--echo End of 4.1 tests.
@@ -1773,5 +1791,13 @@ execute stmt;
deallocate prepare stmt;
drop tables t1;
+#
+# Bug #28509: strange behaviour: passing a decimal value to PS
+#
+prepare stmt from "create table t1 select ?";
+set @a=1.0;
+execute stmt using @a;
+show create table t1;
+drop table t1;
--echo End of 5.0 tests.
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index d4e6a62c09e..2e7fea2ff3d 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -416,11 +416,11 @@ deallocate prepare stmt_do ;
deallocate prepare stmt_set ;
## nonsense like prepare of prepare,execute or deallocate
---error 1064
+--error ER_UNSUPPORTED_PS
prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
---error 1064
+--error ER_UNSUPPORTED_PS
prepare stmt1 from ' execute stmt2 ' ;
---error 1064
+--error ER_UNSUPPORTED_PS
prepare stmt1 from ' deallocate prepare never_prepared ' ;
## switch the database connection
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 427334805ce..342ef5b6990 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -899,3 +899,99 @@ insert into t1(c1) select c1 from v1;
drop table t1, t2, t3;
drop view v1;
set global query_cache_size=0;
+
+#
+# Query cache and changes to system variables
+#
+
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+set GLOBAL query_cache_type=1;
+set GLOBAL query_cache_limit=10000;
+set GLOBAL query_cache_min_res_unit=0;
+set GLOBAL query_cache_size= 100000;
+
+# default_week_format
+reset query cache;
+set LOCAL default_week_format = 0;
+select week('2007-01-04');
+select week('2007-01-04') from t1;
+select extract(WEEK FROM '2007-01-04') from t1;
+
+set LOCAL default_week_format = 2;
+select week('2007-01-04');
+select week('2007-01-04') from t1;
+select extract(WEEK FROM '2007-01-04') from t1;
+
+# div_precision_increment
+reset query cache;
+set LOCAL div_precision_increment=2;
+select 1/7;
+select 1/7 from t1;
+
+set LOCAL div_precision_increment=4;
+select 1/7;
+select 1/7 from t1;
+
+drop table t1;
+
+CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
+INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
+ ('Full-text indexes', 'are called collections'),
+ ('Only MyISAM tables','support collections'),
+ ('Function MATCH ... AGAINST()','is used to do a search'),
+ ('Full-text search in MySQL', 'implements vector space model');
+
+
+set GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
+
+select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
+
+# swap +/-
+set GLOBAL ft_boolean_syntax='- +><()~*:""&|';
+
+select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
+
+# If in the future we need to cache queries with functions
+# be sure not to cause dead lock if the query cache is flushed
+# while inserting a query in the query cache.
+delimiter |;
+create function change_global() returns integer
+begin
+ set global ft_boolean_syntax='+ -><()~*:""&|';
+ return 1;
+end|
+delimiter ;|
+select *, change_global() from t1;
+drop function change_global;
+
+drop table t1;
+
+set GLOBAL query_cache_type=default;
+set GLOBAL query_cache_limit=default;
+set GLOBAL query_cache_min_res_unit=default;
+set GLOBAL query_cache_size= default;
+
+
+#
+# Bug #28897 UUID() returns non-unique values when query cache is enabled
+#
+
+set GLOBAL query_cache_size=1000000;
+
+create table t1 (a char);
+insert into t1 values ('c');
+
+let $q1= `select UUID(), a from t1`;
+let $q2= `select UUID(), a from t1`;
+
+# disabling the logging of the query because the UUIDs are different each run.
+--disable_query_log
+eval select a from t1 where "$q1" = "$q2";
+--enable_query_log
+
+drop table t1;
+
+set GLOBAL query_cache_size= default;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index d2750fecbac..20d044306a6 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -7,10 +7,8 @@ select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
---disable_ps_warnings
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
---enable_ps_warnings
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index d05e4df66b1..e103d40943f 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -1,3 +1,5 @@
+-- source include/have_log_bin.inc
+
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
connection master;
diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test
index c1d36d53501..4488cbad230 100644
--- a/mysql-test/t/rpl000017.test
+++ b/mysql-test/t/rpl000017.test
@@ -1,3 +1,5 @@
+-- source include/have_log_bin.inc
+
connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
connection master;
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index 5ebdec6f761..a4781ed4faa 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -12,6 +12,7 @@
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
source include/master-slave.inc;
+source include/have_innodb.inc;
connection slave;
reset master;
@@ -150,5 +151,14 @@ drop table t2;
connection master;
drop table t2;
drop table t1;
+
+# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed
+CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
+
+--error 1062
+LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+
+DROP TABLE t1;
+
sync_with_master;
# End of 4.1 tests
diff --git a/mysql-test/t/rpl_packet.test b/mysql-test/t/rpl_packet.test
index db6f475dc94..f410b561663 100644
--- a/mysql-test/t/rpl_packet.test
+++ b/mysql-test/t/rpl_packet.test
@@ -56,7 +56,7 @@ START SLAVE;
# Reconnect to master for new setting to take effect
disconnect master;
-connect (master, localhost, root)
+connect (master, localhost, root);
connection master;
CREATE TABLe `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index 5d9f1c29fe2..69614b45693 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -1,6 +1,8 @@
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
+-- source include/have_log_bin.inc
+
#
# Test is run with max_binlog_size=2048 to force automatic rotation of the
# binary log
@@ -107,9 +109,18 @@ show master logs;
# we just tests if synonyms are accepted
purge binary logs to 'master-bin.000002';
show binary logs;
-# sleeping 10 seconds or more would make the slave believe connection is down
---real_sleep 1
-purge master logs before now();
+
+# Calculate time to use in "purge master logs before" by taking
+# last modification time of t2 and adding 1 second
+# This is donw in order to handle the case where file system
+# time differs from mysqld's time
+--disable_result_log
+select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND)
+ from information_schema.tables
+ where TABLE_SCHEMA="test" and TABLE_NAME="t2";
+--enable_result_log
+
+purge master logs before (@time_for_purge);
show binary logs;
insert into t2 values (65);
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test
index b2f4bfbb29d..8f8f0accbd1 100644
--- a/mysql-test/t/rpl_user_variables.test
+++ b/mysql-test/t/rpl_user_variables.test
@@ -296,13 +296,48 @@ SELECT * from t1;
SELECT * from t2;
connection master;
+drop table t1, t2;
---echo End of 5.0 tests.
+#
+# Bug #26842: master binary log contains invalid queries - replication fails
+#
+save_master_pos;
+connection slave;
+sync_with_master;
+reset master;
-# Cleanup
+connection master;
+create table t1 (a int);
+prepare s from "insert into t1 values (@a),(?)";
+set @a=98; execute s using @a;
+prepare s from "insert into t1 values (?)";
+set @a=99; execute s using @a;
+prepare s from "insert into t1 select 100 limit ?";
+set @a=100; execute s using @a;
-DROP TABLE t1;
-DROP TABLE t2;
+save_master_pos;
+connection slave;
+sync_with_master;
+show binlog events from 98;
+select * from t1;
+connection master;
+drop table t1;
+
+#
+# Bug #12826: Possible to get inconsistent slave using SQL syntax Prepared Statements
+#
+connection master;
+create table t1(a int, b int);
+prepare s1 from 'insert into t1 values (@x:=@x+1, ?)';
+set @x=1; execute s1 using @x;
+select * from t1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+connection master;
+drop table t1;
+
+--echo End of 5.0 tests.
# This test uses a stored function that uses user-defined variables to return data
# The test ensures the value of the user-defined variable is replicated correctly
@@ -310,7 +345,6 @@ DROP TABLE t2;
# This test was constructed for BUG#20141
--disable_warnings
-DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
--enable_warnings
@@ -358,4 +392,3 @@ DROP TABLE t1;
sync_slave_with_master;
stop slave;
-
diff --git a/mysql-test/t/rpl_view.test b/mysql-test/t/rpl_view.test
index 812e5d44d58..21748586130 100644
--- a/mysql-test/t/rpl_view.test
+++ b/mysql-test/t/rpl_view.test
@@ -149,4 +149,16 @@ drop view v1;
sync_slave_with_master;
+#
+# BUG#28244 CREATE VIEW breaks replication when view exists
+#
+connection master;
+CREATE TABLE t1(a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+--error ER_TABLE_EXISTS_ERROR
+CREATE VIEW v1 AS SELECT * FROM t1;
+DROP VIEW v1;
+DROP TABLE t1;
+sync_slave_with_master;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
index 97bc29fcad2..10755f2bf8a 100644
--- a/mysql-test/t/sp-code.test
+++ b/mysql-test/t/sp-code.test
@@ -2,7 +2,7 @@
# Test the debugging feature "show procedure/function code <name>"
#
--- source include/is_debug_build.inc
+-- source include/have_debug.inc
--disable_warnings
drop procedure if exists empty;
@@ -446,4 +446,79 @@ SHOW PROCEDURE CODE p1;
DROP PROCEDURE p1;
+#
+# Bug#26977 exception handlers never hreturn
+#
+--disable_warnings
+drop table if exists t1;
+drop procedure if exists proc_26977_broken;
+drop procedure if exists proc_26977_works;
+--enable_warnings
+
+create table t1(a int unique);
+
+delimiter //;
+
+create procedure proc_26977_broken(v int)
+begin
+ declare i int default 5;
+
+ declare continue handler for sqlexception
+ begin
+ select 'caught something';
+ retry:
+ while i > 0 do
+ begin
+ set i = i - 1;
+ select 'looping', i;
+ end;
+ end while retry;
+ end;
+
+ select 'do something';
+ insert into t1 values (v);
+ select 'do something again';
+ insert into t1 values (v);
+end//
+
+create procedure proc_26977_works(v int)
+begin
+ declare i int default 5;
+
+ declare continue handler for sqlexception
+ begin
+ select 'caught something';
+ retry:
+ while i > 0 do
+ begin
+ set i = i - 1;
+ select 'looping', i;
+ end;
+ end while retry;
+ select 'optimizer: keep hreturn';
+ end;
+
+ select 'do something';
+ insert into t1 values (v);
+ select 'do something again';
+ insert into t1 values (v);
+end//
+delimiter ;//
+
+show procedure code proc_26977_broken;
+
+show procedure code proc_26977_works;
+
+## This caust an error because of jump short cut
+## optimization.
+call proc_26977_broken(1);
+
+## This works
+call proc_26977_works(2);
+
+drop table t1;
+drop procedure proc_26977_broken;
+drop procedure proc_26977_works;
+
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 9e5c795d586..ec91be13ba0 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1454,7 +1454,7 @@ select bug12329();
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed the following statement will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
---error 1100
+--error ER_NO_SUCH_TABLE
execute stmt1;
deallocate prepare stmt1;
drop function bug12329;
@@ -1639,13 +1639,13 @@ create trigger t1_ai after insert on t1 for each row insert into t2 values (new.
create view v1 as select * from t1;
drop table t2;
# Limitation, the desired error is ER_VIEW_INVALID
---error ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
insert into v1 values (1);
drop trigger t1_ai;
create function bug11555_1() returns int return (select max(i) from t2);
create trigger t1_ai after insert on t1 for each row set @a:=bug11555_1();
# Limitation, the desired error is ER_VIEW_INVALID
---error ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
insert into v1 values (2);
drop function bug11555_1;
drop table t1;
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test
index cc3e3b93e06..ec5b7fbad7c 100644
--- a/mysql-test/t/sp-prelocking.test
+++ b/mysql-test/t/sp-prelocking.test
@@ -301,5 +301,36 @@ deallocate prepare stmt;
drop function bug19634;
drop table t1, t2, t3;
+#
+# Bug #27907 Misleading error message when opening/locking tables
+#
+
+--disable_warnings
+drop table if exists bug_27907_logs;
+drop table if exists bug_27907_t1;
+--enable_warnings
+
+create table bug_27907_logs (a int);
+create table bug_27907_t1 (a int);
+
+delimiter |;
+
+create trigger bug_27907_t1_ai after insert on bug_27907_t1
+for each row
+begin
+ insert into bug_27907_logs (a) values (1);
+end|
+
+delimiter ;|
+
+drop table bug_27907_logs;
+
+#
+# was failing before with error ER_NOT_LOCKED
+#
+--error ER_NO_SUCH_TABLE
+insert into bug_27907_t1(a) values (1);
+
+drop table bug_27907_t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/sp-vars.test b/mysql-test/t/sp-vars.test
index 0014dc1f6af..2cc68b054d5 100644
--- a/mysql-test/t/sp-vars.test
+++ b/mysql-test/t/sp-vars.test
@@ -1367,4 +1367,48 @@ CALL p1();
DROP PROCEDURE p1;
+#
+# Bug #27415 Text Variables in stored procedures
+# If the SP varible was also referenced on the right side
+# the result was corrupted.
+#
+DELIMITER |;
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS bug27415_text_test|
+DROP PROCEDURE IF EXISTS bug27415_text_test2|
+--enable_warnings
+
+CREATE PROCEDURE bug27415_text_test(entity_id_str_in text)
+BEGIN
+ DECLARE str_remainder text;
+
+ SET str_remainder = entity_id_str_in;
+
+ select 'before substr', str_remainder;
+ SET str_remainder = SUBSTRING(str_remainder, 3);
+ select 'after substr', str_remainder;
+END|
+
+CREATE PROCEDURE bug27415_text_test2(entity_id_str_in text)
+BEGIN
+ DECLARE str_remainder text;
+ DECLARE str_remainder2 text;
+
+ SET str_remainder2 = entity_id_str_in;
+ select 'before substr', str_remainder2;
+ SET str_remainder = SUBSTRING(str_remainder2, 3);
+ select 'after substr', str_remainder;
+END|
+
+CALL bug27415_text_test('a,b,c')|
+CALL bug27415_text_test('a,b,c')|
+CALL bug27415_text_test2('a,b,c')|
+CALL bug27415_text_test('a,b,c')|
+
+DROP PROCEDURE bug27415_text_test|
+DROP PROCEDURE bug27415_text_test2|
+
+DELIMITER ;|
+
# End of 5.0 tests.
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index c94a526e10c..0de416cdffa 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6975,7 +6975,7 @@ use test|
--disable_warnings
drop function if exists bug20777|
drop table if exists examplebug20777|
---enabled_warnings
+--enable_warnings
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
@@ -7054,6 +7054,17 @@ SELECT bug5274_f2()|
DROP FUNCTION bug5274_f1|
DROP FUNCTION bug5274_f2|
+#
+# Bug#21513 (SP having body starting with quoted label rendered unusable)
+#
+--disable_warnings
+drop procedure if exists proc_21513|
+--enable_warnings
+
+create procedure proc_21513()`my_label`:BEGIN END|
+show create procedure proc_21513|
+
+drop procedure proc_21513|
###
--echo End of 5.0 tests.
@@ -7101,3 +7112,23 @@ select count(*) from t1 /* must be 3 */;
drop table t1,t2;
drop function bug27354;
+
+#
+# Bug #28605: SHOW CREATE VIEW with views using stored_procedures no longer
+# showing SP names.
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12;
+
+CREATE VIEW v1 AS SELECT test.metered(a) as metered FROM t1;
+
+SHOW CREATE VIEW v1;
+
+DROP VIEW v1;
+DROP FUNCTION metered;
+DROP TABLE t1;
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test
index d9b34c303ae..1ea32316f1e 100644
--- a/mysql-test/t/sp_trans.test
+++ b/mysql-test/t/sp_trans.test
@@ -554,37 +554,6 @@ set @@session.max_heap_table_size=default|
#
-# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
-# Bug #23333 stored function + non-transac table + transac table =
-# breaks stmt-based binlog
-# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
-#
---disable_warnings
-drop function if exists bug23333|
-drop table if exists t1,t2|
---enable_warnings
- CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
- CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
-
-insert into t2 values (1,1)|
-
-create function bug23333()
-RETURNS int(11)
-DETERMINISTIC
-begin
- insert into t1 values (null);
- select count(*) from t1 into @a;
- return @a;
-end|
-
-reset master|
---error ER_DUP_ENTRY
-insert into t2 values (bug23333(),1)|
---replace_column 2 # 5 # 6 #
-show binlog events from 98 /* with fixes for #23333 will show there is the query */|
-select count(*),@a from t1 /* must be 1,1 */|
-
-#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
new file mode 100644
index 00000000000..3e440b3ccc1
--- /dev/null
+++ b/mysql-test/t/sp_trans_log.test
@@ -0,0 +1,33 @@
+-- source include/have_innodb.inc
+-- source include/have_log_bin.inc
+
+delimiter |;
+
+#
+# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
+# Bug #23333 stored function + non-transac table + transac table =
+# breaks stmt-based binlog
+# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
+#
+CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
+CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
+
+insert into t2 values (1,1)|
+
+create function bug23333()
+RETURNS int(11)
+DETERMINISTIC
+begin
+ insert into t1 values (null);
+ select count(*) from t1 into @a;
+ return @a;
+end|
+
+reset master|
+--error ER_DUP_ENTRY
+insert into t2 values (bug23333(),1)|
+--replace_column 2 # 5 # 6 #
+show binlog events from 98 /* with fixes for #23333 will show there is the query */|
+select count(*),@a from t1 /* must be 1,1 */|
+drop table t1, t2|
+
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index faca9e7b080..2b71bf1093c 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -7,7 +7,7 @@ set @@sql_mode='ansi,traditional';
select @@sql_mode;
--disable_warnings
-DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1, t2;
--enable_warnings
# Test INSERT with DATE
@@ -890,11 +890,11 @@ INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
--error 1048
INSERT INTO t1 VALUES (103,'',NULL);
---error 1263
+--error 1048
UPDATE t1 SET col1=NULL WHERE col1 =100;
---error 1263
+--error 1048
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
---error 1263
+--error 1048
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
SELECT * FROM t1;
@@ -914,7 +914,7 @@ INSERT INTO t1 (col1) VALUES (2);
INSERT INTO t1 VALUES(default(col1),default(col2));
--error 1364
INSERT INTO t1 (col1) SELECT 1;
---error 1263
+--error 1048
INSERT INTO t1 SELECT 1,NULL;
INSERT IGNORE INTO t1 values (NULL,NULL);
INSERT IGNORE INTO t1 (col1) values (3);
@@ -975,9 +975,7 @@ select * from t1;
# Check that select don't abort even in strict mode (for now)
set sql_mode='traditional';
---disable_ps_warnings
select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') IS NULL;
---enable_ps_warnings
drop table t1;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 5cd2cd5fa7d..d565070835e 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -2874,4 +2874,50 @@ FROM t1;
DROP TABLE t1,t2;
+#
+# Bug #27807: Server crash when executing subquery with EXPLAIN
+#
+CREATE TABLE t1 (a int, b int, KEY (a));
+INSERT INTO t1 VALUES (1,1),(2,1);
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
+DROP TABLE t1;
+
+#
+# Bug #28377: grouping query with a correlated subquery in WHERE condition
+#
+
+CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
+INSERT INTO t1 VALUES
+ (3,'FL'), (2,'GA'), (4,'FL'), (1,'GA'), (5,'NY'), (7,'FL'), (6,'NY');
+CREATE TABLE t2 (id int NOT NULL, INDEX idx(id));
+INSERT INTO t2 VALUES (7), (5), (1), (3);
+
+SELECT id, st FROM t1
+ WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
+SELECT id, st FROM t1
+ WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
+ GROUP BY id;
+
+SELECT id, st FROM t1
+ WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
+SELECT id, st FROM t1
+ WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
+ GROUP BY id;
+
+DROP TABLE t1,t2;
+
+#
+# Bug #28728: crash with EXPLAIN EXTENDED for a query with a derived table
+# over a grouping subselect
+#
+
+CREATE TABLE t1 (a int);
+
+INSERT INTO t1 VALUES (1), (2);
+
+EXPLAIN EXTENDED
+SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index dfe09968fa2..2f844c9cc21 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -260,11 +260,11 @@ insert into t2 values
('dd', 1, NULL);
alter table t1 add index idx(ie1,ie2);
---cc 3 NULL NULL
+# cc 3 NULL NULL
select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=3 and b is null ;
insert into t2 values ('new1', 10,10);
insert into t1 values ('new1', 1234, 10, NULL);
--- new1, 10, 10, NULL,
+# new1, 10, 10, NULL,
select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10;
explain extended
select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10;
@@ -546,3 +546,46 @@ SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
DROP TABLE t1,t2;
+
+#
+# Bug #28375: crash for NOT IN subquery predicate when left operand becomes NULL
+#
+
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int PRIMARY KEY);
+CREATE TABLE t3 (id int PRIMARY KEY, name varchar(10));
+INSERT INTO t1 VALUES (2), (NULL), (3), (1);
+INSERT INTO t2 VALUES (234), (345), (457);
+INSERT INTO t3 VALUES (222,'bbb'), (333,'ccc'), (111,'aaa');
+
+EXPLAIN
+SELECT * FROM t1
+ WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3
+ WHERE t3.name='xxx' AND t2.id=t3.id);
+SELECT * FROM t1
+ WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3
+ WHERE t3.name='xxx' AND t2.id=t3.id);
+
+SELECT (t1.id IN (SELECT t2.id FROM t2,t3
+ WHERE t3.name='xxx' AND t2.id=t3.id)) AS x
+ FROM t1;
+
+DROP TABLE t1,t2,t3;
+
+#
+# Bug #22855: Optimizer doesn't rewrite NOT IN subselects to a correlated
+# subquery
+#
+CREATE TABLE t1 (a INT NOT NULL);
+INSERT INTO t1 VALUES (1),(-1), (65),(66);
+
+CREATE TABLE t2 (a INT UNSIGNED NOT NULL PRIMARY KEY);
+INSERT INTO t2 VALUES (65),(66);
+
+SELECT a FROM t1 WHERE a NOT IN (65,66);
+SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
+EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index a01efba11db..363df94eeb3 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -1000,9 +1000,9 @@ create trigger t1_bi after insert on t1 for each row insert into t3 values (new.
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed these two statements will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
---error 1100 #ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
execute stmt1;
---error 1100 #ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
call p1();
deallocate prepare stmt1;
drop procedure p1;
@@ -1737,4 +1737,85 @@ DROP TRIGGER trg27006_a_insert;
DROP TRIGGER trg27006_a_update;
drop table t1,t2;
+#
+# Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers"
+#
+
+--disable_warnings
+drop table if exists t1, t2, t3;
+--enable_warnings
+create table t1 (i int);
+create trigger t1_bi before insert on t1 for each row set new.i = 7;
+create trigger t1_ai after insert on t1 for each row set @a := 7;
+create table t2 (j int);
+insert into t2 values (1), (2);
+set @a:="";
+create table if not exists t1 select * from t2;
+select * from t1;
+select @a;
+# Let us check that trigger that involves table also works ok.
+drop trigger t1_bi;
+drop trigger t1_ai;
+create table t3 (isave int);
+create trigger t1_bi before insert on t1 for each row insert into t3 values (new.i);
+create table if not exists t1 select * from t2;
+select * from t1;
+select * from t3;
+drop table t1, t2, t3;
+
+#
+# Bug #26162: Trigger DML ignores low_priority_updates setting
+#
+CREATE TABLE t1 (id INTEGER);
+CREATE TABLE t2 (id INTEGER);
+
+INSERT INTO t2 VALUES (1),(2);
+
+# trigger that produces the high priority insert, but should be low, adding
+# LOW_PRIORITY fixes this
+CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
+ INSERT INTO t2 VALUES (new.id);
+
+CONNECT (rl_acquirer, localhost, root,,);
+CONNECT (wl_acquirer, localhost, root,,);
+CONNECT (rl_contender, localhost, root,,);
+
+SELECT GET_LOCK('B26162',20);
+
+CONNECTION rl_acquirer;
+--send
+SELECT 'rl_acquirer', GET_LOCK('B26162',5), id FROM t2 WHERE id = 1;
+
+CONNECTION wl_acquirer;
+SET SESSION LOW_PRIORITY_UPDATES=1;
+SET GLOBAL LOW_PRIORITY_UPDATES=1;
+--send
+INSERT INTO t1 VALUES (5);
+
+CONNECTION rl_contender;
+# must not "see" the row inserted by the INSERT (as it must run before the
+# INSERT)
+--send
+SELECT 'rl_contender', id FROM t2 WHERE id > 1;
+
+CONNECTION default;
+SELECT RELEASE_LOCK('B26162');
+
+CONNECTION wl_acquirer;
+--reap
+CONNECTION rl_acquirer;
+--reap
+CONNECTION rl_contender;
+--reap
+
+CONNECTION default;
+DISCONNECT rl_acquirer;
+DISCONNECT wl_acquirer;
+DISCONNECT rl_contender;
+
+DROP TRIGGER t1_test;
+DROP TABLE t1,t2;
+SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
+SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index c6050753943..02cd07e3c16 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -123,3 +123,16 @@ insert into t1 values ('2000-01-01','2000-01-02');
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #23093: Implicit conversion of 9912101 to date does not match
+# cast(9912101 as date)
+#
+select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date);
+select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date);
+select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date);
+create table t1 (d date , dt datetime , ts timestamp);
+insert into t1 values (9912101,9912101,9912101);
+insert into t1 values (11111,11111,11111);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index fc7b20d77a4..d420afbde37 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -141,6 +141,31 @@ SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
+
+#
+# Test of storing datetime into date fields
+#
+
+set @org_mode=@@sql_mode;
+create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
+show create table t1;
+insert into t1 values ();
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+set @@sql_mode='ansi,traditional';
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+insert into t1 set dt='2007-03-23 13:49:38',da=dt;
+# Test error handling
+--error 1292
+insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
+select * from t1;
+drop table t1;
+--error 1067
+create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
+--error 1067
+create table t1 (t time default '916:00:00 a');
+set @@sql_mode= @org_mode;
+
+
#
# Bug#27590: Wrong DATE/DATETIME comparison.
#
@@ -178,3 +203,71 @@ select f2, f3 from t1 where '01-03-10' between f2 and f3;
select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
drop table t1;
+
+#
+# Bug#28133: Wrong DATE/DATETIME comparison in IN() function.
+#
+create table t1 (f1 date);
+insert into t1 values('01-01-01'),('01-01-02'),('01-01-03');
+select * from t1 where f1 in ('01-01-01','2001-01-02','2001-01-03 00:00:00');
+create table t2(f2 datetime);
+insert into t2 values('01-01-01 00:00:00'),('01-02-03 12:34:56'),('02-04-06 11:22:33');
+select * from t2 where f2 in ('01-01-01','01-02-03 12:34:56','01-02-03');
+select * from t1,t2 where '01-01-02' in (f1, cast(f2 as date));
+select * from t1,t2 where '01-01-01' in (f1, '01-02-03');
+select * from t1,t2 where if(1,'01-02-03 12:34:56','') in (f1, f2);
+create table t3(f3 varchar(20));
+insert into t3 select * from t2;
+select * from t2,t3 where f2 in (f3,'03-04-05');
+select f1,f2,f3 from t1,t2,t3 where (f1,'1') in ((f2,'1'),(f3,'1'));
+select f1 from t1 where ('1',f1) in (('1','01-01-01'),('1','2001-1-1 0:0:0'),('1','02-02-02'));
+drop table t1,t2,t3;
+
+#
+# Bug#27759: Wrong DATE/DATETIME comparison in LEAST()/GREATEST() functions.
+#
+select least(cast('01-01-01' as date), '01-01-02');
+select greatest(cast('01-01-01' as date), '01-01-02');
+select least(cast('01-01-01' as date), '01-01-02') + 0;
+select greatest(cast('01-01-01' as date), '01-01-02') + 0;
+select least(cast('01-01-01' as datetime), '01-01-02') + 0;
+select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed);
+select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(20,2));
+--disable_warnings
+DROP PROCEDURE IF EXISTS test27759 ;
+--enable_warnings
+DELIMITER |;
+CREATE PROCEDURE test27759()
+BEGIN
+declare v_a date default '2007-4-10';
+declare v_b date default '2007-4-11';
+declare v_c datetime default '2004-4-9 0:0:0';
+select v_a as a,v_b as b,
+ least( v_a, v_b ) as a_then_b,
+ least( v_b, v_a ) as b_then_a,
+ least( v_c, v_a ) as c_then_a;
+END;|
+DELIMITER ;|
+call test27759();
+drop procedure test27759;
+
+#
+# Bug#28208: Wrong result of a non-const STRING function with a const
+# DATETIME function.
+#
+create table t1 (f1 date);
+insert into t1 values (curdate());
+select left(f1,10) = curdate() from t1;
+drop table t1;
+
+#
+# Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
+# is involved.
+#
+create table t1(f1 date);
+insert into t1 values('01-01-01'),('02-02-02'),('01-01-01'),('02-02-02');
+set @bug28261='';
+select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
+select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
+select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
+drop table t1;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 4b3429d9ea0..45da469cf2d 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -157,3 +157,11 @@ create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz'));
--echo End of 4.1 tests
+
+#
+# Bug#28729: Field_enum wrongly reported an error while storing an empty string.
+#
+create table t1(f1 set('a','b'), index(f1));
+insert into t1 values(''),(''),('a'),('b');
+select * from t1 where f1='';
+drop table t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index f790bcf6daa..a55200c8853 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -222,3 +222,23 @@ drop table t1;
create table t1 (s1 float(0,2));
--error 1427
create table t1 (s1 float(1,2));
+
+#
+# Bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits"
+#
+
+create table t1 (f1 double(200, 0));
+insert into t1 values (1e199), (-1e199);
+insert into t1 values (1e200), (-1e200);
+insert into t1 values (2e200), (-2e200);
+select f1 + 0e0 from t1;
+drop table t1;
+
+create table t1 (f1 float(30, 0));
+insert into t1 values (1e29), (-1e29);
+insert into t1 values (1e30), (-1e30);
+insert into t1 values (2e30), (-2e30);
+select f1 + 0e0 from t1;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 4c6098d2121..d2b808bd5e0 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -1130,4 +1130,36 @@ alter table t1 modify column a decimal(19);
select * from t1;
drop table t1;
+#
+# Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect
+#
+
+select cast(11.1234 as DECIMAL(3,2));
+select * from (select cast(11.1234 as DECIMAL(3,2))) t;
+
+select cast(a as DECIMAL(3,2))
+ from (select 11.1233 as a
+ UNION select 11.1234
+ UNION select 12.1234
+ ) t;
+
+select cast(a as DECIMAL(3,2)), count(*)
+ from (select 11.1233 as a
+ UNION select 11.1234
+ UNION select 12.1234
+ ) t group by 1;
+
+#
+# Bug #28361 Buffer overflow in DECIMAL code on Windows
+#
+
+create table t1 (s varchar(100));
+insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875);
+drop table t1;
+
+#
+# Bug #27984 Long Decimal Maths produces truncated results
+#
+
+SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b;
--echo End of 5.0 tests
diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test
index 12a5e616fa2..57bf9df2fb0 100644
--- a/mysql-test/t/user_var-binlog.test
+++ b/mysql-test/t/user_var-binlog.test
@@ -1,5 +1,4 @@
-# Embedded server does not support binlogging
---source include/not_embedded.inc
+-- source include/have_log_bin.inc
# Check that user variables are binlogged correctly (BUG#3875)
create table t1 (a varchar(50));
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 70f57fdf283..3a3e8f88f83 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -222,3 +222,18 @@ drop table t1,t2;
insert into city 'blah';
SHOW COUNT(*) WARNINGS;
SHOW COUNT(*) ERRORS;
+
+#
+# Bug#28494: Grouping by Item_func_set_user_var produces incorrect result.
+#
+create table t1(f1 int, f2 varchar(2), f3 float, f4 decimal(2,1));
+insert into t1 values
+ (1, "a", 1.5, 1.6), (1, "a", 1.5, 1.6), (2, "b", 2.5, 2.6),
+ (3, "c", 3.5, 3.6), (4, "d", 4.5, 4.6), (1, "a", 1.5, 1.6),
+ (3, "c", 3.5, 3.6), (1, "a", 1.5, 1.6);
+select @a:=f1, count(f1) from t1 group by 1 desc;
+select @a:=f1, count(f1) from t1 group by 1 asc;
+select @a:=f2, count(f2) from t1 group by 1 desc;
+select @a:=f3, count(f3) from t1 group by 1 desc;
+select @a:=f4, count(f4) from t1 group by 1 desc;
+drop table t1;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index e5bf9de13eb..f574451af08 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3221,4 +3221,103 @@ EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug #27921 View ignores precision for CAST()
+#
+CREATE VIEW v1 AS SELECT CAST( 1.23456789 AS DECIMAL( 7,5 ) ) AS col;
+SELECT * FROM v1;
+DESCRIBE v1;
+DROP VIEW v1;
+
+CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col;
+SHOW CREATE VIEW v1;
+DROP VIEW v1;
+
+#
+# Bug #28716: CHECK OPTION expression is evaluated over expired record buffers
+# when VIEW is updated via temporary tables
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, c INT DEFAULT 0);
+INSERT INTO t1 (a) VALUES (1), (2);
+INSERT INTO t2 (b) VALUES (1), (2);
+CREATE VIEW v1 AS SELECT t2.b,t2.c FROM t1, t2
+ WHERE t1.a=t2.b AND t2.b < 3 WITH CHECK OPTION;
+SELECT * FROM v1;
+UPDATE v1 SET c=1 WHERE b=1;
+SELECT * FROM v1;
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+#
+# Bug #28561: update on multi-table view with CHECK OPTION and
+# a subquery in WHERE condition
+#
+
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int DEFAULT 0);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+
+CREATE VIEW v1 AS
+ SELECT t2.c FROM t1, t2
+ WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+
+UPDATE v1 SET c=1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+#
+# Bug #27827: CHECK OPTION ignores ON conditions when updating
+# a multi-table view with CHECK OPTION.
+#
+
+CREATE TABLE t1 (a1 INT, c INT DEFAULT 0);
+CREATE TABLE t2 (a2 INT);
+CREATE TABLE t3 (a3 INT);
+CREATE TABLE t4 (a4 INT);
+INSERT INTO t1 (a1) VALUES (1),(2);
+INSERT INTO t2 (a2) VALUES (1),(2);
+INSERT INTO t3 (a3) VALUES (1),(2);
+INSERT INTO t4 (a4) VALUES (1),(2);
+
+CREATE VIEW v1 AS
+ SELECT t1.a1, t1.c FROM t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3
+ WITH CHECK OPTION;
+SELECT * FROM v1;
+--error 1369
+UPDATE v1 SET c=3;
+PREPARE t FROM 'UPDATE v1 SET c=3';
+--error 1369
+EXECUTE t;
+--error 1369
+EXECUTE t;
+--error 1369
+INSERT INTO v1(a1, c) VALUES (3, 3);
+UPDATE v1 SET c=1 WHERE a1=1;
+SELECT * FROM v1;
+SELECT * FROM t1;
+
+CREATE VIEW v2 AS SELECT t1.a1, t1.c
+ FROM (t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3)
+ JOIN (t3 JOIN t4 ON t3.a3=t4.a4)
+ ON t2.a2=t3.a3 WITH CHECK OPTION;
+SELECT * FROM v2;
+--error 1369
+UPDATE v2 SET c=3;
+PREPARE t FROM 'UPDATE v2 SET c=3';
+--error 1369
+EXECUTE t;
+--error 1369
+EXECUTE t;
+--error 1369
+INSERT INTO v2(a1, c) VALUES (3, 3);
+UPDATE v2 SET c=2 WHERE a1=1;
+SELECT * FROM v2;
+SELECT * FROM t1;
+
+DROP VIEW v1,v2;
+DROP TABLE t1,t2,t3,t4;
+
--echo End of 5.0 tests.