[Commits] Rev 4018: MDEV-4784 - merge test cases from 5.6 in lp:maria/10.0

Sergey Vojtovich svoj at mariadb.org
Mon Apr 14 12:20:52 EEST 2014


At lp:maria/10.0

------------------------------------------------------------
revno: 4018
revision-id: svoj at mariadb.org-20140414092024-4sj1bzrftns3xxts
parent: sergii at pisem.net-20140228200458-2nzjwfzn554m5aja
committer: Sergey Vojtovich <svoj at mariadb.org>
branch nick: 10.0-mdev5242
timestamp: Mon 2014-04-14 13:20:24 +0400
message:
  MDEV-4784 - merge test cases from 5.6
  
  Main test suite merge.
=== modified file 'mysql-test/include/ctype_filesort2.inc'
--- a/mysql-test/include/ctype_filesort2.inc	2013-11-07 11:16:24 +0000
+++ b/mysql-test/include/ctype_filesort2.inc	2014-04-14 09:20:24 +0000
@@ -13,6 +13,8 @@ INSERT INTO t1 VALUES (_utf8mb4 0xCE85),
 SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
 ALTER TABLE t1 ADD KEY(a);
 SELECT HEX(a), HEX(CONVERT(a USING utf8mb4)) FROM t1 ORDER BY a;
+--echo # Additional test for bug#37244 Character sets: short utf8_bin weight_string value
+SELECT HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
 DROP TABLE IF EXISTS t1;
 --echo #
 --echo # BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES

=== added file 'mysql-test/include/have_daemon_example_plugin.inc'
--- a/mysql-test/include/have_daemon_example_plugin.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_daemon_example_plugin.inc	2014-04-14 09:20:24 +0000
@@ -0,0 +1,16 @@
+disable_query_log;
+#
+# Check if server has support for loading plugins
+#
+if (`SELECT @@have_dynamic_loading != 'YES'`) {
+  --skip daemon example plugin requires dynamic loading
+}
+
+#
+# Check if the variable DAEMONEXAMPLE is set
+#
+if (!$LIBDAEMON_EXAMPLE_SO) {
+  --skip daemon_example plugin requires the environment variable \$DAEMONEXAMPLE to be set (normally done by mtr)
+}
+
+enable_query_log;

=== added file 'mysql-test/include/ib_logfile_size_check.inc'
--- a/mysql-test/include/ib_logfile_size_check.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/ib_logfile_size_check.inc	2014-04-14 09:20:24 +0000
@@ -0,0 +1,14 @@
+perl;
+ my $dir = $ENV{'MYSQLD_DATADIR'};
+ my $size;
+ opendir(DIR, $dir) or die $!;
+ while (my $file = readdir(DIR)) 
+ {
+ 
+   next unless ($file =~ m/\ib_logfile.$/);
+   $size = -s "$dir/$file";
+   print "The size of the ib_logfile(0/1): $size \n"; 
+ }
+ close(DIR);
+ exit(0)
+EOF

=== added file 'mysql-test/include/partition_default_functions.inc'
--- a/mysql-test/include/partition_default_functions.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/partition_default_functions.inc	2014-04-14 09:20:24 +0000
@@ -0,0 +1,109 @@
+# Help file for avoid duplicated tests of different DEFAULT functions
+#
+# Needs $get_handler_status_counts defined
+# normally as:
+# let $get_handler_status_counts=
+# SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
+# WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
+#
+# And a table t3 where a is a DATETIME/DATE/TIME/TIMESTAMP column
+# and b is a char/varchar() column.
+
+if ($null_as_now)
+{
+FLUSH STATUS;
+SET TIMESTAMP = 1234567890;
+INSERT INTO t3 (a) VALUES (NULL);
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+}
+FLUSH STATUS;
+SET TIMESTAMP = 1234567891;
+INSERT INTO t3 VALUES ();
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+FLUSH STATUS;
+INSERT INTO t3 (a) VALUES ('2011-01-01 00:00:00');
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+FLUSH STATUS;
+INSERT INTO t3 (a) VALUES ('2011-01-01 00:00:01');
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+FLUSH STATUS;
+INSERT INTO t3 (a) VALUES ('2011-01-01 00:00:02'), ('2011-01-01 00:00:03');
+eval $get_handler_status_counts;
+--echo # 6 locks (1 table, 2 partition lock/unlock)
+--echo # 2 writes
+FLUSH STATUS;
+SET TIMESTAMP = 1234567892;
+INSERT INTO t3 (a) VALUES ('2011-01-01 00:00:00')
+ON DUPLICATE KEY UPDATE b = "DUP_KEY";
+eval $get_handler_status_counts;
+if ($default_update)
+{
+--echo # 8 locks (1 table, 3 partition lock/unlock) 
+--echo # No pruning due to DEFAULT function on partitioning column
+--echo # 1 read_key + 1 delete + 2 write (1 failed + 1 ok)
+--echo # 1 delete + 1 write due to moved to different partition
+}
+if (!$default_update)
+{
+--echo # 4 locks (1 table, 1 partition lock/unlock) 
+--echo # 1 read_key + 1 update (same partition)
+--echo # 1 (failed) write
+}
+FLUSH STATUS;
+INSERT INTO t3 (a) VALUES ('2011-01-01 00:00:01')
+ON DUPLICATE KEY UPDATE a = '2011-01-01 00:00:05', b = "DUP_KEY2";
+eval $get_handler_status_counts;
+--echo # 8 locks (1 table, 3 partition lock/unlock)
+--echo # No pruning due to updating partitioning field.
+--echo # 1 read_key + 1 delete + 2 write (1 failed + 1 ok)
+--echo # 1 delete + 1 write due to moved to different partition
+FLUSH STATUS;
+SET TIMESTAMP = 1234567893;
+UPDATE t3 SET b = 'Updated' WHERE a = '2011-01-01 00:00:02';
+eval $get_handler_status_counts;
+if ($default_update)
+{
+--echo # 8 locks (1 table, 3 partition lock/unlock) 
+--echo # No pruning due to DEFAULT function on partitioning column
+--echo # 2 read_key + 1 read_rnd (1 read_key due to index lookup,
+--echo # 1 read_rnd + 1 read_key due to positioning before update)
+--echo # 1 delete + 1 write due to moved to different partition
+--echo # + 1 (failed) write
+}
+if (!$default_update)
+{
+--echo # 4 locks (1 table, 1 partition lock/unlock) 
+--echo # 1 read_key + 1 update (same partition)
+--echo # 1 (failed) write
+}
+FLUSH STATUS;
+REPLACE INTO t3 VALUES ('2011-01-01 00:00:04', 'Replace1');
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+FLUSH STATUS;
+REPLACE INTO t3 VALUES ('2011-01-01 00:00:04', 'Replace2');
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+--echo # 1 read_key + 1 update + 1 failed write
+
+--echo #
+--echo # Test of replace of default PK (delete might be needed first)
+--echo #
+DELETE FROM t3 WHERE a = 0;
+FLUSH STATUS;
+SET TIMESTAMP = 1234567894;
+REPLACE INTO t3 (b) VALUES ('Replace3');
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+FLUSH STATUS;
+SET TIMESTAMP = 1234567894;
+REPLACE INTO t3 (b) VALUES ('Replace4');
+eval $get_handler_status_counts;
+--echo # 4 locks (1 table, 1 partition lock/unlock)
+--echo # 1 read_key + 1 update + 1 failed write
+--sorted_result
+SELECT * FROM t3;

=== added file 'mysql-test/include/vardir_size_check.inc'
--- a/mysql-test/include/vardir_size_check.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/vardir_size_check.inc	2014-04-14 09:20:24 +0000
@@ -0,0 +1,26 @@
+--echo Check the size of the vardir
+--echo The output size is in unit blocks
+perl;
+#!/usr/bin/perl
+use warnings;
+use strict;
+use File::Find;
+my $dir = $ENV{'MYSQLTEST_VARDIR'};
+my $size = 0;
+find( sub { $size += -f $_ ? -s _ : 0 }, $dir );
+
+if ( $size < 1717987000 )
+        { print "TRUE", "\n";}
+else   
+        { print "FALSE $size", "\n";}
+
+
+## Expected size for the VAR dir being changed for the PB2 runs
+
+##if ( $size =~ /^496[\d]{5}$/ )
+##	{  
+##               { print "TRUE", "\n";}
+##        }
+##else
+##	{ print "FALSE $size", "\n";}
+EOF

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2014-02-26 14:28:07 +0000
+++ b/mysql-test/mysql-test-run.pl	2014-04-14 09:20:24 +0000
@@ -5350,6 +5350,14 @@ sub mysqld_arguments ($$$) {
     mtr_add_arg($args, "--gdb");
   }
 
+  # Enable the debug sync facility, set default wait timeout.
+  # Facility stays disabled if timeout value is zero.
+  mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
+              $opt_debug_sync_timeout) unless $opt_user_args;
+
+  # Options specified in .opt files should be added last so they can
+  # override defaults above.
+
   my $found_skip_core= 0;
   foreach my $arg ( @$extra_opts )
   {
@@ -5381,11 +5389,6 @@ sub mysqld_arguments ($$$) {
     mtr_add_arg($args, "%s", "--core-file");
   }
 
-  # Enable the debug sync facility, set default wait timeout.
-  # Facility stays disabled if timeout value is zero.
-  mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
-              $opt_debug_sync_timeout) unless $opt_user_args;
-
   return $args;
 }
 

=== added file 'mysql-test/r/bug12969156.result'
--- a/mysql-test/r/bug12969156.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug12969156.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,24 @@
+#
+# Bug #12969156 : SEGMENTATION FAULT ON UNINSTALLING
+#  DAEMON_EXAMPLE PLUGIN
+#
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;
+INSTALL PLUGIN daemon_example SONAME 'DAEMONEXAMPLE';
+UNINSTALL PLUGIN daemon_example;

=== added file 'mysql-test/r/bug33509.result'
--- a/mysql-test/r/bug33509.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug33509.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,76 @@
+create table t1 (a int not null);
+drop procedure if exists p1|
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
+prepare s1 from '
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( select a from t1) 
+  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
+execute s1;
+END;
+|
+call p1();
+a
+drop procedure p1;
+drop table t1;

=== added file 'mysql-test/r/bug46080.result'
--- a/mysql-test/r/bug46080.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug46080.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,18 @@
+#
+# Bug #46080: group_concat(... order by) crashes server when
+#  sort_buffer_size cannot allocate
+#
+call mtr.add_suppression("Out of memory at line .*, '.*my_alloc.c'");
+call mtr.add_suppression("needed .* byte (.*k)., memory in use: .* bytes (.*k)");
+CREATE TABLE t1(a CHAR(255));
+INSERT INTO t1 VALUES ('a');
+SET @@SESSION.sort_buffer_size=5*16*1000000;
+SET @@SESSION.max_heap_table_size=5*1000000;
+Warnings:
+Warning	1292	Truncated incorrect max_heap_table_size value: '5000000'
+# Must not crash.
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
+DROP TABLE t1;
+SET @@SESSION.sort_buffer_size=default;
+SET @@SESSION.max_heap_table_size=default;
+End of 5.0 tests

=== modified file 'mysql-test/r/ctype_utf16.result'
--- a/mysql-test/r/ctype_utf16.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/ctype_utf16.result	2014-04-14 09:20:24 +0000
@@ -670,6 +670,13 @@ HEX(a)	HEX(CONVERT(a USING utf8mb4))
 FF9D	EFBE9D
 D800DF84	F0908E84
 DBC0DC00	F4808080
+# Additional test for bug#37244 Character sets: short utf8_bin weight_string value
+SELECT HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+HEX(a)	HEX(WEIGHT_STRING(a))
+0385	000385
+FF9D	00FF9D
+D800DF84	010384
+DBC0DC00	100000
 DROP TABLE IF EXISTS t1;
 #
 # BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES

=== modified file 'mysql-test/r/ctype_utf16le.result'
--- a/mysql-test/r/ctype_utf16le.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/ctype_utf16le.result	2014-04-14 09:20:24 +0000
@@ -713,6 +713,13 @@ HEX(a)	HEX(CONVERT(a USING utf8mb4))
 9DFF	EFBE9D
 00D884DF	F0908E84
 C0DB00DC	F4808080
+# Additional test for bug#37244 Character sets: short utf8_bin weight_string value
+SELECT HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+HEX(a)	HEX(WEIGHT_STRING(a))
+8503	000385
+9DFF	00FF9D
+00D884DF	010384
+C0DB00DC	100000
 DROP TABLE IF EXISTS t1;
 #
 # BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES

=== modified file 'mysql-test/r/ctype_utf32.result'
--- a/mysql-test/r/ctype_utf32.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/ctype_utf32.result	2014-04-14 09:20:24 +0000
@@ -669,6 +669,13 @@ HEX(a)	HEX(CONVERT(a USING utf8mb4))
 0000FF9D	EFBE9D
 00010384	F0908E84
 00100000	F4808080
+# Additional test for bug#37244 Character sets: short utf8_bin weight_string value
+SELECT HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+HEX(a)	HEX(WEIGHT_STRING(a))
+00000385	000385
+0000FF9D	00FF9D
+00010384	010384
+00100000	100000
 DROP TABLE IF EXISTS t1;
 #
 # BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES

=== modified file 'mysql-test/r/ctype_utf8mb4.result'
--- a/mysql-test/r/ctype_utf8mb4.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/ctype_utf8mb4.result	2014-04-14 09:20:24 +0000
@@ -1148,6 +1148,13 @@ CE85	CE85
 EFBE9D	EFBE9D
 F0908E84	F0908E84
 F4808080	F4808080
+# Additional test for bug#37244 Character sets: short utf8_bin weight_string value
+SELECT HEX(a), HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a;
+HEX(a)	HEX(WEIGHT_STRING(a))
+CE85	000385
+EFBE9D	00FF9D
+F0908E84	010384
+F4808080	100000
 DROP TABLE IF EXISTS t1;
 #
 # BUG#16691598 - ORDER BY LOWER(COLUMN) PRODUCES

=== added file 'mysql-test/r/debug_sync2.result'
--- a/mysql-test/r/debug_sync2.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/debug_sync2.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,14 @@
+#
+# Bug#13688248 CRASH IN DIAGNOSTICS_AREA::SET_OK_STATUS WHEN USING DEBUG_SYNC
+#
+SET SESSION DEBUG_SYNC= 'RESET';
+CREATE TABLE t1 (pk INT, PRIMARY KEY(pk));
+SET SESSION sql_mode=TRADITIONAL;
+SET SESSION autocommit=1;
+INSERT INTO t1 VALUES(1);
+SET SESSION debug_sync='write_row_replace SIGNAL go_ahead1 WAIT_FOR comes_never ';
+REPLACE INTO t1 ( pk ) VALUES ( 1 );
+Warnings:
+Warning	1639	debug sync point wait timed out
+DROP TABLE t1;
+SET DEBUG_SYNC='RESET';

=== modified file 'mysql-test/r/delayed.result'
--- a/mysql-test/r/delayed.result	2011-07-02 20:08:51 +0000
+++ b/mysql-test/r/delayed.result	2014-04-14 09:20:24 +0000
@@ -466,3 +466,12 @@ commit;
 # Reaping ALTER TABLE:
 # Connection 'default'.
 drop tables tm, t1, t2;
+#
+# Bug#13259227 ASSERTION TABLES->TABLE->POS_IN_TABLE_LIST
+#              == TABLES FAILED IN SQL_BASE.CC:4668
+#
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1(a int);
+INSERT DELAYED t1 VALUES (1);
+ERROR 42S02: Table 'test.t1' doesn't exist
+DROP TEMPORARY TABLE t1;

=== added file 'mysql-test/r/delete_innodb.result'
--- a/mysql-test/r/delete_innodb.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/delete_innodb.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,23 @@
+#
+# Bug#58709 assert in mysql_execute_command
+#
+DROP TABLE IF EXISTS t2, t1;
+DROP PROCEDURE IF EXISTS p1;
+CREATE TABLE t1 (i INT PRIMARY KEY) engine=InnoDB;
+CREATE TABLE t2 (i INT, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION) engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DELETE IGNORE FROM t1 WHERE i = 1;
+Warnings:
+Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION)
+CREATE PROCEDURE p1() DELETE IGNORE FROM t1 WHERE i = 1;
+CALL p1();
+Warnings:
+Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION)
+PREPARE stm FROM 'CALL p1()';
+EXECUTE stm;
+Warnings:
+Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`i`) REFERENCES `t1` (`i`) ON DELETE NO ACTION)
+DEALLOCATE PREPARE stm;
+DROP TABLE t2, t1;
+DROP PROCEDURE p1;

=== modified file 'mysql-test/r/distinct.result'
--- a/mysql-test/r/distinct.result	2014-02-25 15:04:35 +0000
+++ b/mysql-test/r/distinct.result	2014-04-14 09:20:24 +0000
@@ -1040,3 +1040,85 @@ count(distinct case when id<=63 then id
 drop table tb;
 SET @@tmp_table_size= @tmp_table_size_save;
 End of 5.5 tests
+#
+# Bug#13335170 - ASSERT IN
+# PLAN_CHANGE_WATCHDOG::~PLAN_CHANGE_WATCHDOG() ON SELECT DISTINCT 
+#
+CREATE TABLE t1 (
+col_int_key int(11) NOT NULL,
+col_time_key time NOT NULL,
+col_datetime_key datetime NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_datetime_key (col_datetime_key)
+) ENGINE=InnoDB;
+Warnings:
+Warning	1286	Unknown storage engine 'InnoDB'
+Warning	1266	Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES (7,'06:17:39','2003-08-21 00:00:00');
+SELECT DISTINCT col_int_key
+FROM t1
+WHERE col_int_key IN  ( 18, 6, 84, 4, 0, 2, 8, 3, 7, 9, 1 )  
+AND col_datetime_key BETWEEN '2001-08-04' AND '2003-06-13'  
+ORDER BY col_time_key
+LIMIT 3;
+col_int_key
+DROP TABLE t1;
+#
+# BUG#13540692: WRONG NULL HANDLING WITH RIGHT JOIN + 
+#               DISTINCT OR ORDER BY
+#
+CREATE TABLE t1 (
+a INT,
+b INT NOT NULL
+);
+INSERT INTO t1 VALUES (1,2), (3,3);
+
+EXPLAIN SELECT DISTINCT subselect.b
+FROM t1 LEFT JOIN 
+(SELECT it_b.* FROM t1 as it_a LEFT JOIN t1 as it_b ON true) AS subselect 
+ON t1.a = subselect.b
+;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using temporary
+1	SIMPLE	it_a	ALL	NULL	NULL	NULL	NULL	2	Using where; Using join buffer (flat, BNL join)
+1	SIMPLE	it_b	ALL	NULL	NULL	NULL	NULL	2	Using where; Using join buffer (incremental, BNL join)
+SELECT DISTINCT subselect.b
+FROM t1 LEFT JOIN 
+(SELECT it_b.* FROM t1 as it_a LEFT JOIN t1 as it_b ON true) AS subselect 
+ON t1.a = subselect.b
+;
+b
+3
+NULL
+DROP TABLE t1;
+#
+# BUG#13538387: WRONG RESULT ON SELECT DISTINCT + LEFT JOIN + 
+#               LIMIT + MIX OF MYISAM AND INNODB
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (2),(3);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (
+a INT,
+b INT,
+PRIMARY KEY (b)
+);
+INSERT INTO t3 VALUES (2001,1), (2007,2);
+EXPLAIN SELECT DISTINCT t3.a AS t3_date
+FROM t1
+LEFT JOIN t2 ON false
+LEFT JOIN t3 ON t2.b = t3.b
+LIMIT 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	system	NULL	NULL	NULL	NULL	0	const row not found; Using temporary
+1	SIMPLE	t3	const	PRIMARY	NULL	NULL	NULL	1	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Distinct
+SELECT DISTINCT t3.a AS t3_date
+FROM t1
+LEFT JOIN t2 ON false
+LEFT JOIN t3 ON t2.b = t3.b
+LIMIT 1;
+t3_date
+NULL
+DROP TABLE t1,t2,t3;

=== added file 'mysql-test/r/ds_mrr-big.result'
--- a/mysql-test/r/ds_mrr-big.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/ds_mrr-big.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,78 @@
+#
+# Bug 12365385 STRAIGHT_JOIN QUERY QUICKLY EXHAUSTS SYSTEM+VIRT. 
+#              MEMORY LEADING TO SYSTEM CRASH
+#
+CREATE TABLE ten (a INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE hundred (a INTEGER);
+INSERT INTO hundred
+SELECT a1.a + 10 * a2.a FROM ten a1, ten a2;
+CREATE TABLE thousand (a INTEGER);
+INSERT INTO thousand
+SELECT a1.a + 10 * a2.a + 100 * a3.a FROM ten a1, ten a2, ten a3;
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+i1 INTEGER NOT NULL,
+c1 VARCHAR(10) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1
+SELECT a, 1, 'MySQL' FROM thousand;
+CREATE TABLE t2 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(10) NOT NULL,
+c2 varchar(10) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t2
+SELECT a, 'MySQL', 'MySQL' FROM ten;
+CREATE TABLE t3 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(10) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t3
+SELECT a, 'MySQL' FROM hundred;
+CREATE TABLE t4 (
+pk int(11) NOT NULL,
+c1_key varchar(10) CHARACTER SET utf8 NOT NULL,
+c2 varchar(10) NOT NULL,
+c3 varchar(10) NOT NULL,
+PRIMARY KEY (pk),
+KEY k1 (c1_key)
+);
+CREATE TABLE t5 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(10) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t5
+SELECT a, 'MySQL' FROM ten;
+set optimizer_switch=`mrr=on,mrr_cost_based=off`;
+EXPLAIN SELECT STRAIGHT_JOIN *
+FROM 
+(t1 LEFT JOIN 
+(t2 LEFT JOIN
+(t3 LEFT OUTER JOIN t4 ON t3.c1 <= t4.c1_key)
+ON t2.c1 = t4.c3) 
+ON t1.c1 = t4.c2)
+RIGHT OUTER JOIN t5 ON t2.c2 <= t5.c1
+WHERE t1.i1 = 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t5	ALL	NULL	NULL	NULL	NULL	10	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	1000	Using where; Using join buffer (flat, BNL join)
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	10	Using where; Using join buffer (incremental, BNL join)
+1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	100	Using join buffer (incremental, BNL join)
+1	SIMPLE	t4	ALL	k1	NULL	NULL	NULL	0	Range checked for each record (index map: 0x2)
+SELECT STRAIGHT_JOIN *
+FROM 
+(t1 LEFT JOIN 
+(t2 LEFT JOIN
+(t3 LEFT OUTER JOIN t4 ON t3.c1 <= t4.c1_key)
+ON t2.c1 = t4.c3) 
+ON t1.c1 = t4.c2)
+RIGHT OUTER JOIN t5 ON t2.c2 <= t5.c1
+WHERE t1.i1 = 1;
+pk	i1	c1	pk	c1	c2	pk	c1	pk	c1_key	c2	c3	pk	c1
+DROP TABLE ten, hundred, thousand;
+DROP TABLE t1, t2, t3, t4, t5;

=== added file 'mysql-test/r/fulltext_plugin.result'
--- a/mysql-test/r/fulltext_plugin.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/fulltext_plugin.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,5 @@
+INSTALL PLUGIN simple_parser SONAME 'mypluglib';
+CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
+ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser;
+DROP TABLE t1;
+UNINSTALL PLUGIN simple_parser;

=== modified file 'mysql-test/r/func_analyse.result'
--- a/mysql-test/r/func_analyse.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/func_analyse.result	2014-04-14 09:20:24 +0000
@@ -149,3 +149,24 @@ Field_name	Min_value	Max_value	Min_lengt
 test.t2.f2	1	1	1	1	0	0	1.0000	0.0000	ENUM('1') NOT NULL
 DROP TABLE t1, t2;
 End of 5.1 tests
+#
+# Bug #47338 assertion in handler::ha_external_lock
+#
+drop table if exists t1;
+CREATE TEMPORARY TABLE t1 (f2 INT, f1 INT, PRIMARY KEY (f1)) ENGINE = MyISAM;
+INSERT t1 ( f1 ) VALUES ( 5 );
+INSERT t1 ( f1 ) VALUES ( 6 );
+ALTER TABLE t1 ENGINE = MyISAM;
+ANALYZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+SELECT f1,f2 FROM t1 A WHERE f1 BETWEEN 0 AND 1;
+f1	f2
+drop table t1;
+#
+# Bug #13358379   EXPLAIN SELECT ... PROCEDURE ANALYZE CRASHES THE SERVER
+#
+CREATE TABLE t1 (i INT);
+EXPLAIN SELECT * FROM t1 PROCEDURE ANALYSE();
+DROP TABLE t1;
+# End of 5.6 tests

=== modified file 'mysql-test/r/func_crypt.result'
--- a/mysql-test/r/func_crypt.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/func_crypt.result	2014-04-14 09:20:24 +0000
@@ -106,3 +106,18 @@ OLD_PASSWORD(c1)	PASSWORD(c1)
 77023ffe214c04ff	*82E58A2C08AAFE72C8EB523069CD8ADB33F78F58
 DROP TABLE t1;
 End of 5.0 tests
+#
+# Start of 5.6 tests
+#
+#
+# Bug#13812875 ILLEGAL MIX OF COLLATIONS WITH FUNCTIONS THAT USED TO WORK
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a varchar(1));
+SELECT * FROM t1 WHERE a=password('a');
+a
+DROP TABLE t1;
+SET NAMES latin1;
+#
+# End of 5.6 tests
+#

=== modified file 'mysql-test/r/func_digest.result'
--- a/mysql-test/r/func_digest.result	2010-07-07 06:38:11 +0000
+++ b/mysql-test/r/func_digest.result	2014-04-14 09:20:24 +0000
@@ -1426,3 +1426,14 @@ Catalog	Database	Table	Table_alias	Colum
 def					sha2('1',224)	253	56	56	Y	0	31	8
 sha2('1',224)
 e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
+#
+# Bug#13812875 ILLEGAL MIX OF COLLATIONS WITH FUNCTIONS THAT USED TO WORK
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a varchar(1));
+SELECT * FROM t1 WHERE a=sha1('a');
+a
+SELECT * FROM t1 WHERE a=sha2('a',224);
+a
+DROP TABLE t1;
+SET NAMES latin1;

=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/func_group.result	2014-04-14 09:20:24 +0000
@@ -2196,6 +2196,15 @@ AVG(DISTINCT outr.col_int_nokey)
 DROP TABLE t1;
 # End of the bug#57932
 #
+# BUG#12773464 - 61925: WRONG RESULT WITH AGGREGATE + NOT BETWEEN + KEY
+#
+CREATE TABLE t1 (a int, KEY (a));
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
+MAX(a)
+10
+DROP TABLE t1;
+#
 # MDEV-5257: MIN/MAX Optimization (Select tables optimized away) does not work for DateTime
 # MDEV-3855: MIN/MAX optimization doesnt work for int_col > INET_ATON
 #  (correct the fix for Bug #884175)

=== modified file 'mysql-test/r/func_group_innodb.result'
--- a/mysql-test/r/func_group_innodb.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/func_group_innodb.result	2014-04-14 09:20:24 +0000
@@ -245,3 +245,19 @@ id	select_type	table	type	possible_keys
 1	SIMPLE	t1	range	NULL	b	263	NULL	4	Using index for group-by
 DROP TABLE t1;
 End of 5.5 tests
+#
+# Bug#13724099 1032 BYTE MEMORY LEAK NEW_CACHED_ITEM IN
+#              SUBQUERY WITH GROUPING OF OUTER COLUMN
+#
+CREATE TABLE t1 (
+a BLOB,
+b INT)
+engine=innodb;
+INSERT INTO t1 VALUES ('a', 0);
+SELECT 0 FROM t1
+WHERE 0 = (SELECT group_concat(b)
+FROM t1 t GROUP BY t1.a)
+;
+0
+0
+DROP TABLE t1;

=== added file 'mysql-test/r/func_group_innodb_16k.result'
--- a/mysql-test/r/func_group_innodb_16k.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/func_group_innodb_16k.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,16 @@
+#
+# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+#
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0),
+('', 'a', null), ('', 'a', 0);
+ANALYZE TABLE t1;
+SELECT MIN(c) FROM t1 GROUP BY b;
+MIN(c)
+0
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	NULL	b	263	NULL	3	Using index for group-by
+DROP TABLE t1;
+End of 5.6 tests

=== modified file 'mysql-test/r/func_if.result'
--- a/mysql-test/r/func_if.result	2012-05-21 18:54:41 +0000
+++ b/mysql-test/r/func_if.result	2014-04-14 09:20:24 +0000
@@ -204,6 +204,22 @@ NULL
 0
 DROP TABLE t1;
 #
+# Bug#12620084
+# ASSERTION WHEN CHECKING FIELD_TYPES[FIELD_POS] AND IT'S MYSQL_TYPE_NULL
+#
+SELECT if(0, (SELECT min('hello')), NULL);
+if(0, (SELECT min('hello')), NULL)
+NULL
+SELECT if(1, (SELECT min('hello')), NULL);
+if(1, (SELECT min('hello')), NULL)
+hello
+SELECT if(0, NULL, (SELECT min('hello')));
+if(0, NULL, (SELECT min('hello')))
+hello
+SELECT if(1, NULL, (SELECT min('hello')));
+if(1, NULL, (SELECT min('hello')))
+NULL
+#
 # Bug#12532830 
 # SIGFPE OR ASSERTION (PRECISION <= ((9 * 9) - 8*2)) && (DEC <= 30)
 #

=== modified file 'mysql-test/r/func_misc.result'
--- a/mysql-test/r/func_misc.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/func_misc.result	2014-04-14 09:20:24 +0000
@@ -104,6 +104,99 @@ t1	CREATE TABLE `t1` (
   `length(uuid())` int(10) NOT NULL DEFAULT '0'
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+#------------------------------------------------------------------------
+# Tests for Bug#6760 and Bug#12689
+SET @row_count = 4;
+SET @sleep_time_per_result_row = 1;
+SET @max_acceptable_delay = 2;
+SET @@global.query_cache_size = 1024 * 64;
+DROP TEMPORARY TABLE IF EXISTS t_history;
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
+start_ts DATETIME, end_ts DATETIME,
+start_cached INTEGER, end_cached INTEGER);
+CREATE TABLE t1 (f1 BIGINT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t_history
+SET attempt = 4 - 4 + 1, start_ts = NOW(),
+start_cached = 0;
+SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
+f1	SLEEP(@sleep_time_per_result_row)
+1	0
+1	0
+1	0
+1	0
+UPDATE t_history SET end_ts = NOW()
+WHERE attempt = 4 - 4 + 1;
+UPDATE t_history SET end_cached = 0
+WHERE attempt = 4 - 4 + 1;
+INSERT INTO t_history
+SET attempt = 4 - 3 + 1, start_ts = NOW(),
+start_cached = 0;
+SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
+f1	SLEEP(@sleep_time_per_result_row)
+1	0
+1	0
+1	0
+1	0
+UPDATE t_history SET end_ts = NOW()
+WHERE attempt = 4 - 3 + 1;
+UPDATE t_history SET end_cached = 0
+WHERE attempt = 4 - 3 + 1;
+INSERT INTO t_history
+SET attempt = 4 - 2 + 1, start_ts = NOW(),
+start_cached = 0;
+SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
+f1	SLEEP(@sleep_time_per_result_row)
+1	0
+1	0
+1	0
+1	0
+UPDATE t_history SET end_ts = NOW()
+WHERE attempt = 4 - 2 + 1;
+UPDATE t_history SET end_cached = 0
+WHERE attempt = 4 - 2 + 1;
+INSERT INTO t_history
+SET attempt = 4 - 1 + 1, start_ts = NOW(),
+start_cached = 0;
+SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
+f1	SLEEP(@sleep_time_per_result_row)
+1	0
+1	0
+1	0
+1	0
+UPDATE t_history SET end_ts = NOW()
+WHERE attempt = 4 - 1 + 1;
+UPDATE t_history SET end_cached = 0
+WHERE attempt = 4 - 1 + 1;
+# Test 1: Does the query with SLEEP need a reasonable time?
+SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history
+WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
+BETWEEN 0 AND @max_acceptable_delay;
+SELECT @aux1 AS "Expect 1";
+Expect 1
+1
+# Test 2: Does the query with SLEEP need a reasonable time even in case
+#         of the non first execution?
+SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history
+WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
+BETWEEN 0 AND @max_acceptable_delay
+AND attempt > 1;
+SELECT @aux2 AS "Expect 1";
+Expect 1
+1
+# Test 3: The query with SLEEP must be not cached.
+SELECT COUNT(*) = 4 INTO @aux3 FROM t_history
+WHERE end_cached = start_cached;
+SELECT @aux3 AS "Expect 1";
+Expect 1
+1
+DROP TABLE t1;
+DROP TEMPORARY TABLE t_history;
+SET @@global.query_cache_size = default;
 create table t1 select INET_ATON('255.255.0.1') as `a`;
 show create table t1;
 Table	Create Table

=== modified file 'mysql-test/r/func_set.result'
--- a/mysql-test/r/func_set.result	2013-08-20 11:48:29 +0000
+++ b/mysql-test/r/func_set.result	2014-04-14 09:20:24 +0000
@@ -221,6 +221,50 @@ NULL
 
 DROP TABLE t1;
 #
+# BUG#12211480: GROUP BY MAKE_SET WITH EMPTY SET VALUES CRASH IN MY_HASH_SORT_SIMPLE
+#
+CREATE TABLE t1 (a INT, b CHAR NOT NULL);
+INSERT INTO t1 VALUES (NULL,'1'),(NULL,'1');
+SELECT COUNT(*) FROM t1 GROUP BY MAKE_SET(a,b);
+COUNT(*)
+2
+DROP TABLE t1;
+# End of test BUG#12211480
+#
+# Bug#12677197 MAKE_SET() AND MY_EMPTY_STRING BUGS CAUSE CRASHING
+#
+do
+nullif( ( rtrim( make_set((cast(('%S') as unsigned)),
+(point((0xaf),(''))))
+)
+), (''))
+;
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: '%S'
+do
+dayofmonth( ( not( trim( trailing( convert((''), binary(4)))
+from( make_set( ('>>'), ('`'))))
+)))
+;
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: '>>'
+Warning	1292	Incorrect datetime value: '1'
+do quote(make_set((''), (cast(('-2147483649.1') as binary(513)))));
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: ''
+do
+trim( both(-8388607)
+from( make_set( ( extract( minute_second from
+( str_to_date((rpad(1.0,4,1)), ('')))
+)
+),
+( char((connection_id()) using macce)))
+)
+)
+;
+Warnings:
+Warning	1292	Truncated incorrect date value: '1.01'
+#
 # Start of 5.3 tests
 #
 #

=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/func_str.result	2014-04-14 09:20:24 +0000
@@ -4470,3 +4470,19 @@ SELECT FROM_BASE64(TO_BASE64(dt1)) FROM
 FROM_BASE64(TO_BASE64(dt1))
 2011-01-01 02:03:04
 DROP TABLE t1;
+#
+# Bug#13812875 ILLEGAL MIX OF COLLATIONS WITH FUNCTIONS THAT USED TO WORK
+#
+SET NAMES utf8;
+CREATE TABLE t1 (a varchar(1));
+SELECT * FROM t1 WHERE a=md5('a');
+a
+SELECT * FROM t1 WHERE a=hex('a');
+a
+SELECT * FROM t1 WHERE a=to_base64('a');
+a
+DROP TABLE t1;
+SET NAMES latin1;
+#
+# End of 5.6 tests
+#

=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2014-02-04 09:49:44 +0000
+++ b/mysql-test/r/func_time.result	2014-04-14 09:20:24 +0000
@@ -1432,6 +1432,15 @@ DO WEEK((DATE_ADD((CAST(0 AS DATE)), INT
 Warnings:
 Warning	1292	Incorrect datetime value: '0000-00-00'
 #
+# Bug #13098726 MY_TIME.C:786: CALC_DAYNR: ASSERTION `DELSUM+(INT)
+# Y/4-TEMP > 0' FAILED
+SELECT SUBTIME('0000-01-00 00:00','00:00');
+SUBTIME('0000-01-00 00:00','00:00')
+NULL
+SELECT LEAST(TIMESTAMP('0000-01-00','0'),'2011-10-24') > 0;
+LEAST(TIMESTAMP('0000-01-00','0'),'2011-10-24') > 0
+NULL
+#
 # BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
 # SIMILAR TO '2009-10-00' 
 #
@@ -1665,6 +1674,37 @@ Code	1411
 Message	Incorrect datetime value: '000001' for function str_to_date
 End of 5.1 tests
 #
+# BUG#43578 "MyISAM&Maria gives wrong rows with range access
+# ORDER BY DESC on date index"
+#
+CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY, c2 DATE NULL, c3 INT,
+INDEX idx2(c2));
+SET TIMESTAMP=1235553613;
+INSERT INTO t1 VALUES(NOW(),NOW(),3),
+(ADDTIME(NOW(),'1 01:01:01'),ADDTIME(NOW(),'1 01:01:01'),4),
+(ADDTIME(NOW(),'2 01:01:01'),ADDTIME(NOW(),'2 01:01:01'),5),
+(ADDTIME(NOW(),'3 01:01:01'),ADDTIME(NOW(),'3 01:01:01'),6);
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+Note	1265	Data truncated for column 'c1' at row 2
+Note	1265	Data truncated for column 'c2' at row 2
+Note	1265	Data truncated for column 'c1' at row 3
+Note	1265	Data truncated for column 'c2' at row 3
+Note	1265	Data truncated for column 'c1' at row 4
+Note	1265	Data truncated for column 'c2' at row 4
+SELECT * FROM t1;
+c1	c2	c3
+2009-02-25	2009-02-25	3
+2009-02-26	2009-02-26	4
+2009-02-27	2009-02-27	5
+2009-02-28	2009-02-28	6
+SELECT * FROM t1 WHERE c1 > ADDTIME(NOW(),'1 01:01:01') ORDER BY c1 DESC;
+c1	c2	c3
+2009-02-28	2009-02-28	6
+2009-02-27	2009-02-27	5
+drop table t1;
+#
 # Bug#57039: constant subtime expression returns incorrect result.
 #
 CREATE TABLE t1 (`date_date` datetime NOT NULL);
@@ -1720,6 +1760,101 @@ insert into t1 values ('00:00:00'),('00:
 select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
 1
 drop table t1;
+#
+# End of 5.5 tests
+#
+#
+# Start of 5.6 tests
+#
+#
+# BUG#13545236 - ASSERT IN SEC_SINCE_EPOCH
+#
+CREATE TABLE t1 (a TIME NOT NULL);
+INSERT INTO t1 VALUES ('04:39:24');
+INSERT INTO t1 VALUES ('00:20:09');
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR , a, TIMESTAMP('0000-00-00')),
+'+00:00','+00:00');
+a
+Warnings:
+Warning	1292	Incorrect datetime value: '0000-00-00 00:00:00'
+Warning	1292	Incorrect datetime value: '0000-00-00 00:00:00'
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR, a, DATE('0000-00-00')),
+'+00:00','+00:00');
+a
+Warnings:
+Warning	1292	Incorrect datetime value: '0000-00-00'
+Warning	1292	Incorrect datetime value: '0000-00-00'
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00');
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP('0000-00-01')) IS NULL;
+a
+00:00:00
+Warnings:
+Warning	1264	Out of range value for column 'a' at row 1
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP'0000-00-01 00:00:00') IS NULL;
+a
+00:00:00
+Warnings:
+Warning	1264	Out of range value for column 'a' at row 1
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE('0000-00-01')) IS NULL;
+a
+00:00:00
+Warnings:
+Warning	1264	Out of range value for column 'a' at row 1
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE'0000-00-01') IS NULL;
+a
+00:00:00
+Warnings:
+Warning	1264	Out of range value for column 'a' at row 1
+DROP TABLE t1;
+#
+# BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP 
+# Part2 (5.6)
+CREATE TABLE t1 (a VARCHAR(32) NOT NULL);
+INSERT INTO t1 VALUES ('a');
+SELECT 1 FROM t1 GROUP BY @a:=UNIX_TIMESTAMP(a);
+1
+1
+Warnings:
+Warning	1292	Incorrect datetime value: 'a'
+SELECT a, UNIX_TIMESTAMP(a), UNIX_TIMESTAMP('a') FROM t1;
+a	UNIX_TIMESTAMP(a)	UNIX_TIMESTAMP('a')
+a	NULL	NULL
+Warnings:
+Warning	1292	Incorrect datetime value: 'a'
+Warning	1292	Incorrect datetime value: 'a'
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('5000-01-01 00:00:00');
+SELECT a, UNIX_TIMESTAMP(a), UNIX_TIMESTAMP('5000-01-01 00:00:00') FROM t1;
+a	UNIX_TIMESTAMP(a)	UNIX_TIMESTAMP('5000-01-01 00:00:00')
+5000-01-01 00:00:00	NULL	NULL
+DROP TABLE t1;
+#
+# Bug#13988413 CRASH/ASSERTION AFTER INVALID MEMORY READ 
+#              IN MY_USECONDS_TO_STR
+#
+DO contains(1, if(0, coalesce(NULL), now()));
+CREATE TABLE t1 AS SELECT IF(0, coalesce(NULL), now(0)) + 0;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `IF(0, coalesce(NULL), now(0)) + 0` decimal(26,6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# Bug#13982125 BUFFER OVERFLOW OF VARIABLE BUF IN
+#              ITEM_FUNC_MAKETIME::GET_TIME
+#
+DO maketime(~0, 49, 0.123456789);
+Warnings:
+Warning	1292	Truncated incorrect time value: '18446744073709551615:49:00'
+#
+# Bug#14042545 ASSERTION FAILED: DEC <= 6 IN MY_USECONDS_TO_STR()
+#
+DO is_used_lock(ifnull(now(), CASE 1 WHEN 1 THEN NULL END));
 select time('10:10:10') > 10;
 time('10:10:10') > 10
 1

=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/gis.result	2014-04-14 09:20:24 +0000
@@ -834,6 +834,17 @@ create table t1 (g geometry not null);
 insert into t1 values(default);
 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
 drop table t1;
+CREATE TABLE t1 (a GEOMETRY);
+CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
+CREATE VIEW v2 AS SELECT a FROM t1;
+DESCRIBE v1;
+Field	Type	Null	Key	Default	Extra
+GeomFromwkb(ASBINARY(a))	geometry	YES		NULL	
+DESCRIBE v2;
+Field	Type	Null	Key	Default	Extra
+a	geometry	YES		NULL	
+DROP VIEW v1,v2;
+DROP TABLE t1;
 create table t1 (name VARCHAR(100), square GEOMETRY);
 INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
 INSERT INTO t1 VALUES("small",  GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
@@ -1602,3 +1613,9 @@ insert into t1 values(Geomfromtext('POLY
 ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
 drop table t1;
 End of 5.5 tests
+#
+# Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE
+#
+SELECT ST_Union('', ''), md5(1);
+ST_Union('', '')	md5(1)
+NULL	c4ca4238a0b923820dcc509a6f75849b

=== modified file 'mysql-test/r/having.result'
--- a/mysql-test/r/having.result	2013-11-20 11:05:39 +0000
+++ b/mysql-test/r/having.result	2014-04-14 09:20:24 +0000
@@ -638,6 +638,90 @@ set optimizer_switch=@save_optimizer_swi
 drop table t1,t2,t3;
 End of 5.2 tests
 #
+# BUG#46077 "wrong result: HAVING + ORDER BY + MyISAM + ICP
+# returns extra rows"
+#
+CREATE TABLE `t1` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_key` int(11) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`)
+) AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES (1,7),(2,9);
+SELECT `pk`, `int_key` field1
+FROM t1 WHERE  `pk`  <  3
+HAVING  field1  <  8
+ORDER  BY field1;
+pk	field1
+1	7
+drop table `t1`;
+End of 5.5 tests
+#
+# Bug#12402590 ASSERT AT PROTOCOL::END_STATEMENT ON MYSQL-TRUNK
+#              RUNNING RQG_OPT_SUBQUERY TEST
+#
+CREATE TABLE t2 (
+f1 INT,
+PRIMARY KEY (f1)
+);
+INSERT INTO t2 VALUES (1), (2);
+CREATE TABLE t1 (
+f1 INT,
+f2 VARCHAR(1),
+f3 VARCHAR(1),
+PRIMARY KEY (f1),
+KEY (f2, f1)
+);
+INSERT INTO t1 VALUES (8, 'g', 'g'), (11, 'a', 'a');
+SELECT t1.f1 FROM t1 JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f3 AND t1.f2 IN ('f')
+HAVING (1 ,6) IN (SELECT 3, 6)
+ORDER BY t1.f1;
+f1
+DROP TABLE t1, t2;
+#
+# Bug#13406172: HAVING CLAUSE ON AGGREGATED COLUMN RETURNS
+#               WRONG RESULT WITH MYISAM
+#
+CREATE TABLE ot (i int) ENGINE=MyISAM;
+INSERT INTO ot VALUES (1);
+CREATE TABLE it (i int) ENGINE=MyISAM;
+INSERT INTO it VALUES (7), (8);
+SELECT COUNT(i) AS x
+FROM ot
+WHERE (i) IN (SELECT i FROM it WHERE it.i <= 4) OR i IS NULL
+HAVING x > 1;
+x
+CREATE FUNCTION f(a INTEGER) RETURNS INTEGER DETERMINISTIC RETURN a*a;
+SELECT BIT_AND(i) AS x
+FROM ot
+WHERE f(2) < 2
+HAVING x < 2;
+x
+DROP TABLE it,ot;
+DROP FUNCTION f;
+#
+# Bug#11760517: MIN/MAX FAILS TO EVALUATE HAVING CONDITION,
+#               RETURNS INCORRECT NULL RESULT
+#
+CREATE TABLE t1 (pk INT PRIMARY KEY, i4 INT);
+INSERT INTO t1 VALUES (2,7), (4,7), (6,2), (17,0);
+
+SELECT MIN(table1.i4), MIN(table2.pk) as min_pk
+FROM t1 as table1, t1 as table2
+WHERE table1.pk = 1;
+MIN(table1.i4)	min_pk
+NULL	NULL
+
+SELECT MIN(table1.i4), MIN(table2.pk) as min_pk
+FROM t1 as table1, t1 as table2
+WHERE table1.pk = 1
+HAVING min_pk <= 10;
+MIN(table1.i4)	min_pk
+
+DROP TABLE t1;
+End of 5.6 tests
+#
 # Bug mdev-5160: two-way join with HAVING over the second table
 #
 CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;

=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2013-12-22 16:06:50 +0000
+++ b/mysql-test/r/information_schema.result	2014-04-14 09:20:24 +0000
@@ -1711,6 +1711,34 @@ select 1 from information_schema.tables
 1
 drop user mysqltest_1 at localhost;
 End of 5.1 tests.
+create function f1 (p1 int, p2 datetime, p3 decimal(10,2))
+returns char(10) return null;
+create procedure p1 (p1 float(8,5), p2 char(32), p3 varchar(10)) begin end;
+create procedure p2 (p1 enum('c', 's'), p2 blob, p3 text) begin end;
+select * from information_schema.parameters where specific_schema='test';
+SPECIFIC_CATALOG	SPECIFIC_SCHEMA	SPECIFIC_NAME	ORDINAL_POSITION	PARAMETER_MODE	PARAMETER_NAME	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	DATETIME_PRECISION	CHARACTER_SET_NAME	COLLATION_NAME	DTD_IDENTIFIER	ROUTINE_TYPE
+def	test	f1	0	NULL	NULL	char	10	10	NULL	NULL	NULL	latin1	latin1_swedish_ci	char(10)	FUNCTION
+def	test	f1	1	IN	p1	int	NULL	NULL	10	0	NULL	NULL	NULL	int(11)	FUNCTION
+def	test	f1	2	IN	p2	datetime	NULL	NULL	NULL	NULL	0	NULL	NULL	datetime	FUNCTION
+def	test	f1	3	IN	p3	decimal	NULL	NULL	10	2	NULL	NULL	NULL	decimal(10,2)	FUNCTION
+def	test	p1	1	IN	p1	float	NULL	NULL	8	5	NULL	NULL	NULL	float(8,5)	PROCEDURE
+def	test	p1	2	IN	p2	char	32	32	NULL	NULL	NULL	latin1	latin1_swedish_ci	char(32)	PROCEDURE
+def	test	p1	3	IN	p3	varchar	10	10	NULL	NULL	NULL	latin1	latin1_swedish_ci	varchar(10)	PROCEDURE
+def	test	p2	1	IN	p1	enum	1	1	NULL	NULL	NULL	latin1	latin1_swedish_ci	enum('c','s')	PROCEDURE
+def	test	p2	2	IN	p2	blob	65535	65535	NULL	NULL	NULL	NULL	NULL	blob	PROCEDURE
+def	test	p2	3	IN	p3	text	65535	65535	NULL	NULL	NULL	latin1	latin1_swedish_ci	text	PROCEDURE
+select data_type, character_maximum_length,
+character_octet_length, numeric_precision,
+numeric_scale, character_set_name,
+collation_name, dtd_identifier
+from information_schema.routines where routine_schema='test';
+data_type	character_maximum_length	character_octet_length	numeric_precision	numeric_scale	character_set_name	collation_name	dtd_identifier
+char	10	10	NULL	NULL	latin1	latin1_swedish_ci	char(10)
+	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+drop procedure p1;
+drop procedure p2;
+drop function f1;
 #
 # Additional test for WL#3726 "DDL locking for all metadata objects"
 # To avoid possible deadlocks process of filling of I_S tables should
@@ -1800,6 +1828,12 @@ ERROR 42000: Access denied for user 'roo
 LOCK TABLES t1 READ, information_schema.tables READ;
 ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 DROP TABLE t1;
+create function f1() returns int return 1;
+select routine_name, routine_type from information_schema.routines
+where routine_schema = 'test';
+routine_name	routine_type
+f1	FUNCTION
+drop function f1;
 SELECT *
 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
 LEFT JOIN INFORMATION_SCHEMA.COLUMNS
@@ -1960,6 +1994,66 @@ event_object_table	trigger_name
 # Switching to connection 'default'.
 #
 #
+# Test case to test DATETIME_PRECISION of information_schema.columns table
+# 
+drop database if exists mysqltest;
+create database mysqltest;
+use mysqltest;
+create table mysqltest.t(a int, b date, c time, d datetime, e timestamp);
+create table mysqltest.t0(a int, b date, c time(0), d datetime(0), e timestamp(0));
+create table mysqltest.t1(a int, b date, c time(1), d datetime(1), e timestamp(1));
+create table mysqltest.t2(a int, b date, c time(2), d datetime(2), e timestamp(2));
+create table mysqltest.t3(a int, b date, c time(3), d datetime(3), e timestamp(3));
+create table mysqltest.t4(a int, b date, c time(4), d datetime(4), e timestamp(4));
+create table mysqltest.t5(a int, b date, c time(5), d datetime(5), e timestamp(5));
+create table mysqltest.t6(a int, b date, c time(6), d datetime(6), e timestamp(6));
+select TABLE_NAME,COLUMN_NAME,DATA_TYPE,DATETIME_PRECISION from information_schema.columns where TABLE_SCHEMA='mysqltest';
+TABLE_NAME	COLUMN_NAME	DATA_TYPE	DATETIME_PRECISION
+t	a	int	NULL
+t	b	date	NULL
+t	c	time	0
+t	d	datetime	0
+t	e	timestamp	0
+t0	a	int	NULL
+t0	b	date	NULL
+t0	c	time	0
+t0	d	datetime	0
+t0	e	timestamp	0
+t1	a	int	NULL
+t1	b	date	NULL
+t1	c	time	1
+t1	d	datetime	1
+t1	e	timestamp	1
+t2	a	int	NULL
+t2	b	date	NULL
+t2	c	time	2
+t2	d	datetime	2
+t2	e	timestamp	2
+t3	a	int	NULL
+t3	b	date	NULL
+t3	c	time	3
+t3	d	datetime	3
+t3	e	timestamp	3
+t4	a	int	NULL
+t4	b	date	NULL
+t4	c	time	4
+t4	d	datetime	4
+t4	e	timestamp	4
+t5	a	int	NULL
+t5	b	date	NULL
+t5	c	time	5
+t5	d	datetime	5
+t5	e	timestamp	5
+t6	a	int	NULL
+t6	b	date	NULL
+t6	c	time	6
+t6	d	datetime	6
+t6	e	timestamp	6
+#
+# Clean-up.
+drop database mysqltest;
+use test;
+#
 # MDEV-3818: Query against view over IS tables worse than equivalent query without view
 #
 create view v1 as select table_schema, table_name, column_name from information_schema.columns;
@@ -1980,8 +2074,19 @@ id	select_type	table	type	possible_keys
 Note	1003	select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where ((`information_schema`.`columns`.`TABLE_SCHEMA` = 'osm') and (`information_schema`.`columns`.`TABLE_NAME` = 'test'))
 drop view v1;
 #
-# Clean-up.
-drop database mysqltest;
-#
 # End of 5.5 tests
 #
+#
+# Bug #13966514 : CRASH IN GET_SCHEMA_TABLES_RESULT WITH MIN/MAX,
+#   LEFT/RIGHT JOIN ON I_S TABLE
+#
+CREATE TABLE t1(a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+# must not crash
+SELECT MAX(a) FROM information_schema.engines RIGHT JOIN t1 ON 1;
+MAX(a)
+1
+DROP TABLE t1;
+#
+# End of 5.6 tests
+#

=== modified file 'mysql-test/r/information_schema_parameters.result'
--- a/mysql-test/r/information_schema_parameters.result	2011-12-12 22:58:40 +0000
+++ b/mysql-test/r/information_schema_parameters.result	2014-04-14 09:20:24 +0000
@@ -491,4 +491,76 @@ WHERE SPECIFIC_SCHEMA = 'i_s_parameters_
 SPECIFIC_CATALOG	SPECIFIC_SCHEMA	SPECIFIC_NAME	ORDINAL_POSITION	PARAMETER_MODE	PARAMETER_NAME	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	DATETIME_PRECISION	CHARACTER_SET_NAME	COLLATION_NAME	DTD_IDENTIFIER	ROUTINE_TYPE
 def	i_s_parameters_test	test_func5	0	NULL	NULL	varchar	30	90	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(30)	FUNCTION
 def	i_s_parameters_test	test_func5	1	IN	s	char	20	60	NULL	NULL	NULL	utf8	utf8_general_ci	char(20)	FUNCTION
+# ========== parameters.13 ==========
+DROP DATABASE IF EXISTS i_s_parameters_test;
+CREATE DATABASE i_s_parameters_test;
+USE i_s_parameters_test;
+CREATE PROCEDURE test_proc (OUT p_p1 datetime,OUT p_p2 time,OUT p_p3 timestamp) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc0 (OUT p_p1 datetime(0),OUT p_p2 time(0),OUT p_p3 timestamp(0)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc1 (OUT p_p1 datetime(1),OUT p_p2 time(1),OUT p_p3 timestamp(1)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc2 (OUT p_p1 datetime(2),OUT p_p2 time(2),OUT p_p3 timestamp(2)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc3 (OUT p_p1 datetime(3),OUT p_p2 time(3),OUT p_p3 timestamp(3)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc4 (OUT p_p1 datetime(4),OUT p_p2 time(4),OUT p_p3 timestamp(4)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc5 (OUT p_p1 datetime(5),OUT p_p2 time(5),OUT p_p3 timestamp(5)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc6 (OUT p_p1 datetime(6),OUT p_p2 time(6),OUT p_p3 timestamp(6)) BEGIN SELECT 1 ; END; \\
+CREATE FUNCTION test_func (f_p1 DATETIME, f_p2 TIMESTAMP) RETURNS TIME RETURN NULL;
+CREATE FUNCTION test_func0 (f_p1 DATETIME(0), f_p2 TIMESTAMP(0)) RETURNS TIME(0) RETURN NULL;
+CREATE FUNCTION test_func1 (f_p1 DATETIME(1), f_p2 TIMESTAMP(1)) RETURNS TIME(1) RETURN NULL;
+CREATE FUNCTION test_func2 (f_p1 DATETIME(2), f_p2 TIMESTAMP(2)) RETURNS TIME(2) RETURN NULL;
+CREATE FUNCTION test_func3 (f_p1 DATETIME(3), f_p2 TIMESTAMP(3)) RETURNS TIME(3) RETURN NULL;
+CREATE FUNCTION test_func4 (f_p1 DATETIME(4), f_p2 TIMESTAMP(4)) RETURNS TIME(4) RETURN NULL;
+CREATE FUNCTION test_func5 (f_p1 DATETIME(5), f_p2 TIMESTAMP(5)) RETURNS TIME(5) RETURN NULL;
+CREATE FUNCTION test_func6 (f_p1 DATETIME(6), f_p2 TIMESTAMP(6)) RETURNS TIME(6) RETURN NULL;
+SELECT SPECIFIC_SCHEMA, SPECIFIC_NAME, PARAMETER_NAME, DATA_TYPE, 
+DATETIME_PRECISION from INFORMATION_SCHEMA.PARAMETERS WHERE 
+SPECIFIC_SCHEMA='i_s_parameters_test';
+SPECIFIC_SCHEMA	SPECIFIC_NAME	PARAMETER_NAME	DATA_TYPE	DATETIME_PRECISION
+i_s_parameters_test	test_func	NULL	time	0
+i_s_parameters_test	test_func	f_p1	datetime	0
+i_s_parameters_test	test_func	f_p2	timestamp	0
+i_s_parameters_test	test_func0	NULL	time	0
+i_s_parameters_test	test_func0	f_p1	datetime	0
+i_s_parameters_test	test_func0	f_p2	timestamp	0
+i_s_parameters_test	test_func1	NULL	time	1
+i_s_parameters_test	test_func1	f_p1	datetime	1
+i_s_parameters_test	test_func1	f_p2	timestamp	1
+i_s_parameters_test	test_func2	NULL	time	2
+i_s_parameters_test	test_func2	f_p1	datetime	2
+i_s_parameters_test	test_func2	f_p2	timestamp	2
+i_s_parameters_test	test_func3	NULL	time	3
+i_s_parameters_test	test_func3	f_p1	datetime	3
+i_s_parameters_test	test_func3	f_p2	timestamp	3
+i_s_parameters_test	test_func4	NULL	time	4
+i_s_parameters_test	test_func4	f_p1	datetime	4
+i_s_parameters_test	test_func4	f_p2	timestamp	4
+i_s_parameters_test	test_func5	NULL	time	5
+i_s_parameters_test	test_func5	f_p1	datetime	5
+i_s_parameters_test	test_func5	f_p2	timestamp	5
+i_s_parameters_test	test_func6	NULL	time	6
+i_s_parameters_test	test_func6	f_p1	datetime	6
+i_s_parameters_test	test_func6	f_p2	timestamp	6
+i_s_parameters_test	test_proc	p_p1	datetime	0
+i_s_parameters_test	test_proc	p_p2	time	0
+i_s_parameters_test	test_proc	p_p3	timestamp	0
+i_s_parameters_test	test_proc0	p_p1	datetime	0
+i_s_parameters_test	test_proc0	p_p2	time	0
+i_s_parameters_test	test_proc0	p_p3	timestamp	0
+i_s_parameters_test	test_proc1	p_p1	datetime	1
+i_s_parameters_test	test_proc1	p_p2	time	1
+i_s_parameters_test	test_proc1	p_p3	timestamp	1
+i_s_parameters_test	test_proc2	p_p1	datetime	2
+i_s_parameters_test	test_proc2	p_p2	time	2
+i_s_parameters_test	test_proc2	p_p3	timestamp	2
+i_s_parameters_test	test_proc3	p_p1	datetime	3
+i_s_parameters_test	test_proc3	p_p2	time	3
+i_s_parameters_test	test_proc3	p_p3	timestamp	3
+i_s_parameters_test	test_proc4	p_p1	datetime	4
+i_s_parameters_test	test_proc4	p_p2	time	4
+i_s_parameters_test	test_proc4	p_p3	timestamp	4
+i_s_parameters_test	test_proc5	p_p1	datetime	5
+i_s_parameters_test	test_proc5	p_p2	time	5
+i_s_parameters_test	test_proc5	p_p3	timestamp	5
+i_s_parameters_test	test_proc6	p_p1	datetime	6
+i_s_parameters_test	test_proc6	p_p2	time	6
+i_s_parameters_test	test_proc6	p_p3	timestamp	6
 DROP DATABASE i_s_parameters_test;

=== modified file 'mysql-test/r/information_schema_routines.result'
--- a/mysql-test/r/information_schema_routines.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/information_schema_routines.result	2014-04-14 09:20:24 +0000
@@ -786,4 +786,61 @@ SELECT * FROM INFORMATION_SCHEMA.ROUTINE
 WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5';
 SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	DATETIME_PRECISION	CHARACTER_SET_NAME	COLLATION_NAME	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
 test_func5	def	i_s_routines_test	test_func5	FUNCTION	varchar	30	90	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(30)	SQL	RETURN CONCAT('XYZ, ' ,s)	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	<created>	<modified>			root at localhost	latin1	latin1_swedish_ci	utf8_general_ci
+# ========== routines.10 ==========
+DROP DATABASE IF EXISTS i_s_routines_test;
+CREATE DATABASE i_s_routines_test;
+USE i_s_routines_test;
+CREATE PROCEDURE test_proc1 (OUT p_p1 timestamp) BEGIN SELECT 1 ; END; \\
+CREATE FUNCTION test_func_t (f_p1 DATETIME) RETURNS TIME RETURN NULL;
+CREATE FUNCTION test_func_dt (f_p1 DATETIME) RETURNS DATETIME RETURN NULL;
+CREATE FUNCTION test_func_ts (f_p1 DATETIME) RETURNS TIMESTAMP RETURN NULL;
+CREATE FUNCTION test_func_t0 (f_p1 DATETIME) RETURNS TIME(0) RETURN NULL;
+CREATE FUNCTION test_func_dt0 (f_p1 DATETIME) RETURNS DATETIME(0) RETURN NULL;
+CREATE FUNCTION test_func_ts0 (f_p1 DATETIME) RETURNS TIMESTAMP(0) RETURN NULL;
+CREATE FUNCTION test_func_t1 (f_p1 DATETIME) RETURNS TIME(1) RETURN NULL;
+CREATE FUNCTION test_func_dt1 (f_p1 DATETIME) RETURNS DATETIME(1) RETURN NULL;
+CREATE FUNCTION test_func_ts1 (f_p1 DATETIME) RETURNS TIMESTAMP(1) RETURN NULL;
+CREATE FUNCTION test_func_t2 (f_p1 DATETIME) RETURNS TIME(2) RETURN NULL;
+CREATE FUNCTION test_func_dt2 (f_p1 DATETIME) RETURNS DATETIME(2) RETURN NULL;
+CREATE FUNCTION test_func_ts2 (f_p1 DATETIME) RETURNS TIMESTAMP(2) RETURN NULL;
+CREATE FUNCTION test_func_t3 (f_p1 DATETIME) RETURNS TIME(3) RETURN NULL;
+CREATE FUNCTION test_func_dt3 (f_p1 DATETIME) RETURNS DATETIME(3) RETURN NULL;
+CREATE FUNCTION test_func_ts3 (f_p1 DATETIME) RETURNS TIMESTAMP(3) RETURN NULL;
+CREATE FUNCTION test_func_t4 (f_p1 DATETIME) RETURNS TIME(4) RETURN NULL;
+CREATE FUNCTION test_func_dt4 (f_p1 DATETIME) RETURNS DATETIME(4) RETURN NULL;
+CREATE FUNCTION test_func_ts4 (f_p1 DATETIME) RETURNS TIMESTAMP(4) RETURN NULL;
+CREATE FUNCTION test_func_t5 (f_p1 DATETIME) RETURNS TIME(5) RETURN NULL;
+CREATE FUNCTION test_func_dt5 (f_p1 DATETIME) RETURNS DATETIME(5) RETURN NULL;
+CREATE FUNCTION test_func_ts5 (f_p1 DATETIME) RETURNS TIMESTAMP(5) RETURN NULL;
+CREATE FUNCTION test_func_t6 (f_p1 DATETIME) RETURNS TIME(6) RETURN NULL;
+CREATE FUNCTION test_func_dt6 (f_p1 DATETIME) RETURNS DATETIME(6) RETURN NULL;
+CREATE FUNCTION test_func_ts6 (f_p1 DATETIME) RETURNS TIMESTAMP(6) RETURN NULL;
+SELECT ROUTINE_NAME, ROUTINE_TYPE, DATA_TYPE, DATETIME_PRECISION from 
+INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='i_s_routines_test';
+ROUTINE_NAME	ROUTINE_TYPE	DATA_TYPE	DATETIME_PRECISION
+test_func_dt	FUNCTION	datetime	0
+test_func_dt0	FUNCTION	datetime	0
+test_func_dt1	FUNCTION	datetime	1
+test_func_dt2	FUNCTION	datetime	2
+test_func_dt3	FUNCTION	datetime	3
+test_func_dt4	FUNCTION	datetime	4
+test_func_dt5	FUNCTION	datetime	5
+test_func_dt6	FUNCTION	datetime	6
+test_func_t	FUNCTION	time	0
+test_func_t0	FUNCTION	time	0
+test_func_t1	FUNCTION	time	1
+test_func_t2	FUNCTION	time	2
+test_func_t3	FUNCTION	time	3
+test_func_t4	FUNCTION	time	4
+test_func_t5	FUNCTION	time	5
+test_func_t6	FUNCTION	time	6
+test_func_ts	FUNCTION	timestamp	0
+test_func_ts0	FUNCTION	timestamp	0
+test_func_ts1	FUNCTION	timestamp	1
+test_func_ts2	FUNCTION	timestamp	2
+test_func_ts3	FUNCTION	timestamp	3
+test_func_ts4	FUNCTION	timestamp	4
+test_func_ts5	FUNCTION	timestamp	5
+test_func_ts6	FUNCTION	timestamp	6
+test_proc1	PROCEDURE		NULL
 DROP DATABASE i_s_routines_test;

=== added file 'mysql-test/r/innodb_log_file_size_functionality.result'
--- a/mysql-test/r/innodb_log_file_size_functionality.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_log_file_size_functionality.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,73 @@
+'#________________________VAR_09_INNODB_LOG_FILE_SIZE__________________#'
+echo '##'
+--echo '#---------------------WL6372_VAR_9_01----------------------#'
+####################################################################
+#   Checking default value                                         #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_log_file_size)
+1 Expected
+SELECT @@GLOBAL.innodb_log_file_size;
+@@GLOBAL.innodb_log_file_size
+5242880
+5242880 Expected
+'#---------------------WL6372_VAR_9_02----------------------#'
+SET @@local.innodb_log_file_size=1;
+ERROR HY000: Variable 'innodb_log_file_size' is a read only variable
+Expected error 'Read only variable'
+SET @@session.innodb_log_file_size=1;
+ERROR HY000: Variable 'innodb_log_file_size' is a read only variable
+Expected error 'Read only variable'
+SET @@GLOBAL.innodb_log_file_size=1;
+ERROR HY000: Variable 'innodb_log_file_size' is a read only variable
+Expected error 'Read only variable'
+SET @@GLOBAL.innodb_log_file_size=DEFAULT;
+ERROR HY000: Variable 'innodb_log_file_size' is a read only variable
+Expected error 'Read only variable'
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+COUNT(@@GLOBAL.innodb_log_file_size)
+1
+1 Expected
+'#---------------------WL6372_VAR_9_03----------------------#'
+SELECT @@GLOBAL.innodb_log_file_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_file_size';
+@@GLOBAL.innodb_log_file_size = VARIABLE_VALUE
+1
+1 Expected
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+COUNT(@@GLOBAL.innodb_log_file_size)
+1
+1 Expected
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='innodb_log_file_size';
+COUNT(VARIABLE_VALUE)
+1
+1 Expected
+'#---------------------WL6372_VAR_9_04----------------------#'
+SELECT @@innodb_log_file_size = @@GLOBAL.innodb_log_file_size;
+@@innodb_log_file_size = @@GLOBAL.innodb_log_file_size
+1
+1 Expected
+SELECT COUNT(@@local.innodb_log_file_size);
+ERROR HY000: Variable 'innodb_log_file_size' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT COUNT(@@SESSION.innodb_log_file_size);
+ERROR HY000: Variable 'innodb_log_file_size' is a GLOBAL variable
+Expected error 'Variable is a GLOBAL variable'
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+COUNT(@@GLOBAL.innodb_log_file_size)
+1
+1 Expected
+SELECT innodb_log_file_size = @@SESSION.innodb_log_file_size;
+ERROR 42S22: Unknown column 'innodb_log_file_size' in 'field list'
+Expected error 'Unknown column innodb_log_file_size in field list'
+'#---------------------WL6372_VAR_9_05----------------------#'
+Check the size of the vardir
+The output size is in unit blocks
+TRUE
+TRUE Expected
+'#---------------------WL6372_VAR_9_06----------------------#'
+The size of the ib_logfile(0/1): 5242880 
+The size of the ib_logfile(0/1): 5242880 
+5242880 expected

=== modified file 'mysql-test/r/innodb_mysql_lock.result'
--- a/mysql-test/r/innodb_mysql_lock.result	2012-10-30 10:41:41 +0000
+++ b/mysql-test/r/innodb_mysql_lock.result	2014-04-14 09:20:24 +0000
@@ -175,4 +175,34 @@ id	value
 1	12345
 COMMIT;
 DROP TABLE t1;
+#
+# Bug#11747690 33650: MYSQL_ALTER_TABLE() UNNECESSARILY DOES
+#              FULL TABLE COPY 
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT, b VARCHAR(250), PRIMARY KEY(a,b))
+engine=innodb default charset=utf8;
+INSERT INTO t1 VALUES (1, 'a'), (2, 'b');
+CREATE INDEX t1ba ON t1(b,a);
+affected rows: 0
+info: Records: 0  Duplicates: 0  Warnings: 0
+DROP TABLE t1;
+#
+# Bug#11750045 - 40344: ALTER IGNORE TABLE T ADD INDEX DOES NOT IGNORE
+#                IN FAST INDEX CREATION
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT NOT NULL, b INT) engine = innodb;
+INSERT INTO t1 VALUES (1,1), (2,1), (3,1);
+# Should give error
+ALTER TABLE t1 ADD UNIQUE INDEX (b);
+ERROR 23000: Duplicate entry '1' for key 'b'
+# Should not give error
+# Also check that copy algorithm is used
+ALTER IGNORE TABLE t1 ADD UNIQUE INDEX (b);
+affected rows: 3
+info: Records: 3  Duplicates: 2  Warnings: 0
+SHOW WARNINGS;
+Level	Code	Message
+DROP TABLE t1;
 set global innodb_lock_wait_timeout=@old_innodb_lock_wait_timeout;

=== modified file 'mysql-test/r/join.result'
--- a/mysql-test/r/join.result	2013-11-20 11:05:39 +0000
+++ b/mysql-test/r/join.result	2014-04-14 09:20:24 +0000
@@ -1277,6 +1277,53 @@ Handler_read_rnd_next	1
 DROP TABLE t1, t2;
 End of 5.1 tests
 #
+# Bug 13102033 - CRASH IN COPY_FUNCS IN SQL_SELECT.CC ON JOIN +
+#                GROUP BY + ORDER BY
+#
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+i1 INTEGER NOT NULL,
+i2 INTEGER NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (7,8,1), (8,2,2);
+CREATE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN SELECT t1.pk
+FROM v1, t1
+WHERE v1.i2 = 211
+AND v1.i2 > 7
+OR t1.i1 < 3
+GROUP BY t1.pk
+ORDER BY v1.i2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using temporary; Using filesort
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where; Using join buffer (flat, BNL join)
+SELECT t1.pk
+FROM v1, t1
+WHERE v1.i2 = 211
+AND v1.i2 > 7
+OR t1.i1 < 3
+GROUP BY t1.pk
+ORDER BY v1.i2;
+pk
+8
+EXPLAIN SELECT t1.pk
+FROM v1, t1
+WHERE (v1.i2 = 211 AND v1.i2 > 7)
+OR (t1.i1 < 3 AND v1.i2 < 10);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where; Using join buffer (flat, BNL join)
+SELECT t1.pk
+FROM v1, t1
+WHERE (v1.i2 = 211 AND v1.i2 > 7)
+OR (t1.i1 < 3 AND v1.i2 < 10);
+pk
+8
+8
+DROP VIEW v1;
+DROP TABLE t1;
+#
 # Bug #43368: STRAIGHT_JOIN DOESN'T WORK FOR NESTED JOINS 
 #
 create table t1(c1 int primary key, c2 char(10)) engine=myisam;

=== modified file 'mysql-test/r/lock.result'
--- a/mysql-test/r/lock.result	2011-10-19 19:45:18 +0000
+++ b/mysql-test/r/lock.result	2014-04-14 09:20:24 +0000
@@ -468,6 +468,18 @@ UNLOCK TABLES;
 UNLOCK TABLES;
 DROP TABLE t1, t2;
 #
+# Additional test coverage for WL#5534 - Online ALTER phase 1.
+#
+DROP TABLE IF EXISTS t1, m1;
+CREATE TABLE t1(a INT);
+CREATE TABLE m1(a INT) engine=merge union(t1);
+LOCK TABLES m1 WRITE;
+ALTER TABLE m1 COMMENT 'test';
+# This triggered an assert in MDL_ticket::downgrade_lock
+FLUSH TABLE m1;
+UNLOCK TABLES;
+DROP TABLE m1, t1;
+#
 # End of 6.0 tests.
 #
 create table t1 (a int) engine=myisam;

=== modified file 'mysql-test/r/merge.result'
--- a/mysql-test/r/merge.result	2014-01-31 10:06:28 +0000
+++ b/mysql-test/r/merge.result	2014-04-14 09:20:24 +0000
@@ -996,6 +996,11 @@ m1	CREATE TABLE `m1` (
   `a` int(11) DEFAULT NULL
 ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1, m1;
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+MAX(a)
+NULL
+DROP TABLE t1;
 CREATE TABLE t1(a INT);
 CREATE TABLE t2(a VARCHAR(10));
 CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
@@ -3922,3 +3927,23 @@ ERROR HY000: Unable to open underlying t
 DROP TRIGGER trg1;
 DROP TABLE t1;
 DROP TABLE m1;
+#
+# Test for bug #11764786 - 57657: TEMPORARY MERGE TABLE WITH TEMPORARY
+#                                 UNDERLYING TABLE, IS BROKEN BY ALTER.
+#
+DROP TABLES IF EXISTS t1, t2, t3, t4;
+CREATE TEMPORARY TABLE t1(i INT) ENGINE= MyISAM;
+CREATE TEMPORARY TABLE t2(i INT) ENGINE= MERGE UNION= (t1) INSERT_METHOD= LAST;
+ALTER TABLE t2 INSERT_METHOD= FIRST;
+CHECK TABLE t2;
+Table	Op	Msg_type	Msg_text
+test.t2	check	status	OK
+CREATE TABLE t3(i INT) ENGINE= MyISAM;
+CREATE TABLE t4(i int) ENGINE= MERGE UNION= (t3) INSERT_METHOD= LAST;
+ALTER TABLE t4 INSERT_METHOD= FIRST;
+CHECK TABLE t4;
+Table	Op	Msg_type	Msg_text
+test.t4	check	status	OK
+# Clean-up
+DROP TABLES t1, t2, t3, t4;
+# End of bug #11764786 - 57657

=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result	2013-11-20 11:05:39 +0000
+++ b/mysql-test/r/myisam.result	2014-04-14 09:20:24 +0000
@@ -2527,6 +2527,18 @@ test.t1	check	error	Size of indexfile is
 test.t1	check	warning	Size of datafile is: 14       Should be: 7
 test.t1	check	error	Corrupt
 DROP TABLE t1;
+#
+# Bug#14093521 SIMPLE SELECT..WHERE QUERY ON YEAR GIVES DIFFERENT ORDER BY TRANSFORMED RESULT
+#
+CREATE TABLE t1 (f1 year(4), key k1(f1)) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(0000),(0000);
+SELECT * FROM t1 FORCE INDEX(k1) WHERE f1 = 'lhsi';
+f1
+0000
+0000
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'lhsi'
+DROP TABLE t1;
 show variables like 'myisam_block_size';
 Variable_name	Value
 myisam_block_size	1024

=== added file 'mysql-test/r/myisam_row_rpl.result'
--- a/mysql-test/r/myisam_row_rpl.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/myisam_row_rpl.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,57 @@
+include/master-slave.inc
+[connection master]
+#
+# Bug#11940249: RBR: MYISAM TABLE CORRUPTION AFTER FIRST LARGE INSERT
+#               ON SLAVE
+#
+# Must have > 100 rows in the first rpl event (to trigger bulk_insert
+# optimization for insert into an empty table, by disable all non-unique
+# indexes and recreate them afterwards.)
+# and then it must be a second rpl event for the same insert (i.e.
+# during the same lock).
+# Note that --binlog-row-event-max-size=1024 is set in the .opt files
+# to enforce the default size.
+CREATE TABLE tmp (a VARCHAR(10), b INT) ENGINE=Memory;
+INSERT INTO tmp VALUES ('aZa', 1), ('zAz', 2), ('M', 3);
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+CREATE TABLE t
+(a VARCHAR(10),
+b INT,
+KEY a (a))
+ENGINE = MyISAM;
+INSERT INTO t SELECT * FROM tmp;
+# on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+COUNT(*)
+192
+# on master:
+include/show_binlog_events.inc
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t)
+master-bin.000001	#	Write_rows_v1	#	#	table_id: #
+master-bin.000001	#	Write_rows_v1	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+RENAME TABLE t to t_2;
+RENAME TABLE t_2 to t;
+# on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+COUNT(*)
+192
+CHECK TABLE t;
+Table	Op	Msg_type	Msg_text
+test.t	check	status	OK
+REPAIR TABLE t;
+Table	Op	Msg_type	Msg_text
+test.t	repair	status	OK
+SELECT COUNT(*) FROM t WHERE b > -1;
+COUNT(*)
+192
+include/diff_tables.inc [master:t, slave:t]
+DROP TABLE t, tmp;
+include/rpl_end.inc

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2013-11-08 16:59:08 +0000
+++ b/mysql-test/r/mysqltest.result	2014-04-14 09:20:24 +0000
@@ -941,6 +941,12 @@ mysqltest: At line 1: query 'change_user
 REPLACED_FILE1.txt
 file1.txt
 file2.txt
+prefix1.txt
+prefix2.txt
+prefix3.txt
+SELECT "bla bla file" as x;
+x
+bla bla file
 file11.txt
 dir-list.txt
 SELECT 'c:\\a.txt' AS col;

=== modified file 'mysql-test/r/olap.result'
--- a/mysql-test/r/olap.result	2011-12-12 22:58:40 +0000
+++ b/mysql-test/r/olap.result	2014-04-14 09:20:24 +0000
@@ -766,3 +766,31 @@ SELECT DISTINCT b FROM t1, t2 GROUP BY a
 NULL
 DROP TABLE t1, t2;
 End of 5.0 tests
+#
+# Bug#13011553 CRASH IN SORTCMP OR CACHED_ITEM_STR::CMP IF GROUP BY SUBQUERY WITH ROLLUP
+#
+CREATE TABLE t1 (f1 DATETIME) ENGINE = MyISAM;
+INSERT INTO  t1 VALUES ('2012-12-20 00:00:00'), (NULL);
+SELECT f1 FROM t1 GROUP BY
+(SELECT f1 FROM t1 HAVING f1 < '2012-12-21 00:00:00') WITH ROLLUP;
+f1
+2012-12-20 00:00:00
+2012-12-20 00:00:00
+DROP TABLE t1;
+CREATE TABLE t1 (f1 DATE) ENGINE = MyISAM;
+INSERT INTO  t1 VALUES ('2012-12-20'), (NULL);
+SELECT f1 FROM t1 GROUP BY
+(SELECT f1 FROM t1 HAVING f1 < '2012-12-21') WITH ROLLUP;
+f1
+2012-12-20
+2012-12-20
+DROP TABLE t1;
+CREATE TABLE t1 (f1 TIME) ENGINE = MyISAM;
+INSERT INTO  t1 VALUES ('11:11:11'), (NULL);
+SELECT f1 FROM t1 GROUP BY
+(SELECT f1 FROM t1 HAVING f1 < '12:12:12') WITH ROLLUP;
+f1
+11:11:11
+11:11:11
+DROP TABLE t1;
+End of 5.5 tests

=== modified file 'mysql-test/r/parser.result'
--- a/mysql-test/r/parser.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/parser.result	2014-04-14 09:20:24 +0000
@@ -618,3 +618,8 @@ DROP TABLE t1, t2, t3;
 #
 # End of 5.1 tests
 #
+#
+# Bug#13819132 BROKEN SYNTAX ACCEPTED FOR START TRANSACTION
+#
+START TRANSACTION ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,' at line 1

=== modified file 'mysql-test/r/partition_cache.result'
--- a/mysql-test/r/partition_cache.result	2012-07-13 19:17:32 +0000
+++ b/mysql-test/r/partition_cache.result	2014-04-14 09:20:24 +0000
@@ -203,3 +203,29 @@ Variable_name	Value
 Qcache_hits	1
 set @@global.query_cache_size = @save_query_cache_size;
 drop table t2;
+SET @old_query_cache_size = @@global.query_cache_size;
+SET GLOBAL query_cache_size=1355776;
+CREATE TABLE t1
+(`NUM` varchar(4) NOT NULL,
+`UPDATE_TIME` datetime NOT NULL,
+PRIMARY KEY (`NUM`,`UPDATE_TIME`))
+PARTITION BY RANGE (month(UPDATE_TIME))
+(PARTITION p2 VALUES LESS THAN (3) ENGINE = InnoDB,
+PARTITION p3 VALUES LESS THAN (4) ENGINE = InnoDB);
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+NUM	UPDATE_TIME
+INSERT INTO t1 VALUES ('AAA', '2010-03-11 00:00:00');
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+NUM	UPDATE_TIME
+AAA	2010-03-11 00:00:00
+ALTER TABLE t1 TRUNCATE PARTITION p3;
+COMMIT;
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+NUM	UPDATE_TIME
+SELECT SQL_NO_CACHE * FROM t1 WHERE MONTH(update_time)=3;
+NUM	UPDATE_TIME
+ALTER TABLE t1 DROP PARTITION p3;
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+NUM	UPDATE_TIME
+DROP TABLE t1;
+SET @@global.query_cache_size = @old_query_cache_size;

=== modified file 'mysql-test/r/partition_disabled.result'
--- a/mysql-test/r/partition_disabled.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/partition_disabled.result	2014-04-14 09:20:24 +0000
@@ -91,3 +91,18 @@ explain partitions select * from t1 wher
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	NULL	ALL	NULL	NULL	NULL	NULL	5	Using where
 drop table t1;
+#
+# bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
+#                                 TABLE CORRUPTS MYISAM
+DROP TABLE if exists `t1`;
+CREATE TABLE  `t1`(`a` INT)ENGINE=myisam;
+ALTER TABLE `t1` ADD COLUMN `b` INT;
+CREATE UNIQUE INDEX `i1` ON `t1`(`b`);
+CREATE UNIQUE INDEX `i2` ON `t1`(`a`);
+ALTER TABLE `t1` ADD PRIMARY KEY  (`a`);
+ALTER TABLE `t1` REMOVE PARTITIONING;
+ERROR HY000: Partition management on a not partitioned table is not possible
+CHECK TABLE `t1` EXTENDED;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+DROP TABLE t1;

=== modified file 'mysql-test/r/partition_error.result'
--- a/mysql-test/r/partition_error.result	2013-09-27 12:58:49 +0000
+++ b/mysql-test/r/partition_error.result	2014-04-14 09:20:24 +0000
@@ -904,6 +904,19 @@ a int not null,
 b int not null,
 c int not null,
 primary key(a,b))
+partition by range columns (a,d)
+(partition x1 VALUES LESS THAN (1,1),
+partition x2 VALUES LESS THAN (2,2),
+partition x3 VALUES LESS THAN (3,3));
+ERROR HY000: Field in list of fields for partition function not found in table
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
+NULL
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
 partition by key (a,d)
 partitions 3
 (partition x1 tablespace ts1,

=== modified file 'mysql-test/r/partition_hash.result'
--- a/mysql-test/r/partition_hash.result	2011-10-19 19:45:18 +0000
+++ b/mysql-test/r/partition_hash.result	2014-04-14 09:20:24 +0000
@@ -1,4 +1,58 @@
 drop table if exists t1;
+#
+# Bug#12725206/Bug#61765: WRONG QUERY RESULTS ON SUBPARTITIONS BASED
+#                         ON USIGNED BIGINT
+#
+CREATE TABLE t1 (
+a int(11) NOT NULL,
+b bigint(20) UNSIGNED NOT NULL
+)
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (b)
+SUBPARTITIONS 3
+(PARTITION p1 VALUES LESS THAN (1308614400),
+PARTITION p2 VALUES LESS THAN (1308700800),
+PARTITION p3 VALUES LESS THAN (1308787200),
+PARTITION p4 VALUES LESS THAN (1308873600),
+PARTITION p5 VALUES LESS THAN (1308960000)
+);
+INSERT INTO t1 VALUES
+(1308614400,18446744073709551615),
+(1308700800,0xFFFFFFFFFFFFFFFE),
+(1308787200,18446744073709551613),
+(1308873600,18446744073709551612),
+(1308873600, 12531568256096620965),
+(1308873600, 12531568256096),
+(1308873600, 9223372036854775808);
+SELECT a,b,HEX(b) FROM t1 ORDER BY a, b;
+a	b	HEX(b)
+1308614400	18446744073709551615	FFFFFFFFFFFFFFFF
+1308700800	18446744073709551614	FFFFFFFFFFFFFFFE
+1308787200	18446744073709551613	FFFFFFFFFFFFFFFD
+1308873600	12531568256096	B65BBACA460
+1308873600	9223372036854775808	8000000000000000
+1308873600	12531568256096620965	ADE912EF0F3351A5
+1308873600	18446744073709551612	FFFFFFFFFFFFFFFC
+# The following queries returned nothing
+SELECT * FROM t1 WHERE b = 9223372036854775808;
+a	b
+1308873600	9223372036854775808
+SELECT * FROM t1 WHERE b = 18446744073709551612;
+a	b
+1308873600	18446744073709551612
+SELECT * FROM t1 WHERE b = 18446744073709551615;
+a	b
+1308614400	18446744073709551615
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 9223372036854775808;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	p1_p1sp2,p2_p2sp2,p3_p3sp2,p4_p4sp2,p5_p5sp2	ALL	NULL	NULL	NULL	NULL	3	Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 18446744073709551612;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	p1_p1sp1,p2_p2sp1,p3_p3sp1,p4_p4sp1,p5_p5sp1	ALL	NULL	NULL	NULL	NULL	3	Using where
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 18446744073709551615;
+id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	p1_p1sp1,p2_p2sp1,p3_p3sp1,p4_p4sp1,p5_p5sp1	ALL	NULL	NULL	NULL	NULL	3	Using where
+DROP TABLE t1;
 CREATE TABLE t1 (c1 INT)
 PARTITION BY HASH (c1)
 PARTITIONS 15;

=== modified file 'mysql-test/r/partition_list.result'
--- a/mysql-test/r/partition_list.result	2009-10-21 18:04:34 +0000
+++ b/mysql-test/r/partition_list.result	2014-04-14 09:20:24 +0000
@@ -1,4 +1,136 @@
 drop table if exists t1;
+#
+# Bug#62505: ALTER TABLE ADD PARTITION fails for LIST partitions with
+#            more than 16 items
+#
+CREATE TABLE t1 (a INT);
+# SUCCESS with 20 items because this is initial partitioning action
+# (The parser already knows that it is only on column)
+ALTER TABLE t1
+PARTITION BY LIST(a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,
+11,12,13,14,15,16,17,18,19,20));
+# BUG: FAILED, because number of items > 16 during partition add
+# (The parser do not know how many columns the table is partitioned on)
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+31,32,33,34,35,36,37,38,39,40));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
+ PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM) */
+# Test with single column LIST COLUMNS too
+ALTER TABLE t1
+PARTITION BY LIST COLUMNS (a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN ((71),(72),(73),(74),(75),(76),(77),(78),(79),(80),
+(81),(82),(83),(84),(85),(86),(87),(88),(89),(90)));
+ERROR 42000: Row expressions in VALUES IN only allowed for multi-field column partitioning near '))' at line 3
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+31,32,33,34,35,36,37,38,39,40));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
+ PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM) */
+DROP TABLE t1;
+# Test with two columns in LIST COLUMNS partitioning
+CREATE TABLE t1
+(a INT,
+b CHAR(2))
+PARTITION BY LIST COLUMNS (a, b)
+(PARTITION p0_a VALUES IN
+((0, "a0"), (0, "a1"), (0, "a2"), (0, "a3"), (0, "a4"), (0, "a5"), (0, "a6"),
+(0, "a7"), (0, "a8"), (0, "a9"), (0, "aa"), (0, "ab"), (0, "ac"), (0, "ad"),
+(0, "ae"), (0, "af"), (0, "ag"), (0, "ah"), (0, "ai"), (0, "aj"), (0, "ak"),
+(0, "al")));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p1_a VALUES IN
+((1, "a0"), (1, "a1"), (1, "a2"), (1, "a3"), (1, "a4"), (1, "a5"), (1, "a6"),
+(1, "a7"), (1, "a8"), (1, "a9"), (1, "aa"), (1, "ab"), (1, "ac"), (1, "ad"),
+(1, "ae"), (1, "af"), (1, "ag"), (1, "ah"), (1, "ai"), (1, "aj"), (1, "ak"),
+(1, "al")));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM) */
+# Test of the parser for '('
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2_a VALUES IN
+(((1 + 1), "a0"), (2, "a1"), (2, "a2"), (2, "a3"), (2, "a4"), (2, "a5"),
+(2, "a6"), (2, "a7"), (2, "a8"), (2, "a9"), (2, "aa"), (2, "ab"), (2, "ac"),
+(2, "ad"), (2, "ae"), (2, "af"), (2, "ag"), (2, "ah"), (2, "ai"), (2, "aj"),
+(2, "ak"), (2, "al")));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM,
+ PARTITION p2_a VALUES IN ((2,'a0'),(2,'a1'),(2,'a2'),(2,'a3'),(2,'a4'),(2,'a5'),(2,'a6'),(2,'a7'),(2,'a8'),(2,'a9'),(2,'aa'),(2,'ab'),(2,'ac'),(2,'ad'),(2,'ae'),(2,'af'),(2,'ag'),(2,'ah'),(2,'ai'),(2,'aj'),(2,'ak'),(2,'al')) ENGINE = MyISAM) */
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1), "a0"));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"a0"))' at line 2
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN (1 + 1 + 1, "a0"));
+ERROR HY000: Inconsistency in usage of column lists for partitioning
+# Test with 3 columns when it only has 2.
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((3, "a1", 0), (3, "a2", 0)));
+ERROR HY000: Inconsistency in usage of column lists for partitioning
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1, "a0")));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM,
+ PARTITION p2_a VALUES IN ((2,'a0'),(2,'a1'),(2,'a2'),(2,'a3'),(2,'a4'),(2,'a5'),(2,'a6'),(2,'a7'),(2,'a8'),(2,'a9'),(2,'aa'),(2,'ab'),(2,'ac'),(2,'ad'),(2,'ae'),(2,'af'),(2,'ag'),(2,'ah'),(2,'ai'),(2,'aj'),(2,'ak'),(2,'al')) ENGINE = MyISAM,
+ PARTITION p3_a VALUES IN ((3,'a0')) ENGINE = MyISAM) */
+# Test with more than 16 columns (cause of regression)
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN ((21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+31 ,32, 33, 34, 35, 36, 37, 38, 39, 40),
+(41 ,42, 43, 44, 45, 46, 47, 48, 49, 50,
+51 ,52, 53, 54, 55, 56, 57, 58, 59, 60)));
+ERROR HY000: Inconsistency in usage of column lists for partitioning
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN (21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+31 ,32, 33, 34, 35, 36, 37, 38, 39, 40));
+ERROR HY000: Inconsistency in usage of column lists for partitioning
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM,
+ PARTITION p2_a VALUES IN ((2,'a0'),(2,'a1'),(2,'a2'),(2,'a3'),(2,'a4'),(2,'a5'),(2,'a6'),(2,'a7'),(2,'a8'),(2,'a9'),(2,'aa'),(2,'ab'),(2,'ac'),(2,'ad'),(2,'ae'),(2,'af'),(2,'ag'),(2,'ah'),(2,'ai'),(2,'aj'),(2,'ak'),(2,'al')) ENGINE = MyISAM,
+ PARTITION p3_a VALUES IN ((3,'a0')) ENGINE = MyISAM) */
+DROP TABLE t1;
 create table t1 (a int unsigned)
 partition by list (a)
 (partition p0 values in (0),

=== added file 'mysql-test/r/partition_locking_4.result'
--- a/mysql-test/r/partition_locking_4.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_locking_4.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,52 @@
+SET @old_autocommit = @@global.autocommit;
+SET @@global.autocommit = 0;
+SET @old_lock_wait_timeout= @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = 1;
+SET @old_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout = 1;
+USE test;
+CREATE USER 'mysqltest1'@'localhost';
+CREATE USER 'mysqltest2'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest1'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest2'@'localhost';
+CREATE TABLE t1 (a int PRIMARY KEY, b varchar(128), KEY (b))
+ENGINE = InnoDB
+PARTITION BY HASH (a) PARTITIONS 13;
+INSERT INTO t1 VALUES (11, 'First row, p11');
+INSERT INTO t1 VALUES (12, 'First row, p12');
+connect  test1,localhost,mysqltest1,,test;
+connect  test2,localhost,mysqltest2,,test;
+connection test1;
+INSERT INTO t1 VALUES (13+11, 'Second row, p11');
+INSERT INTO t1 VALUES (13+12, 'Second row, p12');
+SELECT * FROM t1 ORDER BY a;
+a	b
+11	First row, p11
+12	First row, p12
+24	Second row, p11
+25	Second row, p12
+connection test2;
+INSERT INTO t1 VALUES (13+11, 'Second row, p11');
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+INSERT INTO t1 VALUES (13+12, 'Second row, p12');
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT * FROM t1 ORDER BY a;
+a	b
+11	First row, p11
+12	First row, p12
+COMMIT;
+connection test1;
+SELECT * FROM t1 ORDER BY a;
+a	b
+11	First row, p11
+12	First row, p12
+24	Second row, p11
+25	Second row, p12
+COMMIT;
+connection default;
+DROP TABLE t1;
+DROP USER 'mysqltest1'@'localhost';
+DROP USER 'mysqltest2'@'localhost';
+SET @@global.autocommit = @old_autocommit;
+SET @@global.lock_wait_timeout= @old_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout= @old_innodb_lock_wait_timeout;

=== modified file 'mysql-test/r/partition_mgm.result'
--- a/mysql-test/r/partition_mgm.result	2009-04-17 20:00:53 +0000
+++ b/mysql-test/r/partition_mgm.result	2014-04-14 09:20:24 +0000
@@ -1,4 +1,70 @@
 DROP TABLE IF EXISTS t1;
+#
+# Bug#13357766: ASSERT IN HANDLER::HA_CREATE
+#
+CREATE TABLE t1
+(a INT)
+PARTITION BY KEY(a) PARTITIONS 3;
+ALTER TABLE t1 REPAIR PARTITION p2,p3,p1;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	error	Error in list of partitions to test.t1
+ALTER TABLE t1 ORDER BY a;
+DROP TABLE t1;
+#
+# Bug#11764110/bug#56909: REORGANIZE PARTITION is allowed on
+#                         HASH/KEY partitioned tables
+#
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE MYISAM
+PARTITION BY HASH (a)
+PARTITIONS 1;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
+INSERT INTO t1 VALUES (12), (13), (14), (15), (16), (17), (18), (19), (20);
+# This changes from auto partitioned to manual partitioned
+ALTER TABLE t1 REORGANIZE PARTITION p0 INTO (PARTITION pHidden);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (a)
+(PARTITION pHidden ENGINE = MyISAM) */
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+ALTER TABLE t1 ADD PARTITION
+(PARTITION pNamed1);
+ALTER TABLE t1 ADD PARTITION
+(PARTITION pNamed2);
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p5);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+ERROR HY000: Duplicate partition name p5
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (a)
+(PARTITION pHidden ENGINE = MyISAM,
+ PARTITION p1 ENGINE = MyISAM,
+ PARTITION pNamed1 ENGINE = MyISAM,
+ PARTITION pNamed2 ENGINE = MyISAM,
+ PARTITION p5 ENGINE = MyISAM) */
+ALTER TABLE t1 REBUILD PARTITION all;
+ALTER TABLE t1 REBUILD PARTITION pNamed1,p5;
+ALTER TABLE t1 COALESCE PARTITION 1;
+ALTER TABLE t1 COALESCE PARTITION 2;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY HASH (a)
+(PARTITION pHidden ENGINE = MyISAM,
+ PARTITION p1 ENGINE = MyISAM) */
+DROP TABLE t1;
 CREATE TABLE t1 (a INT PRIMARY KEY)
 ENGINE MYISAM
 PARTITION BY HASH (a)

=== modified file 'mysql-test/r/partition_myisam.result'
--- a/mysql-test/r/partition_myisam.result	2013-11-20 11:05:39 +0000
+++ b/mysql-test/r/partition_myisam.result	2014-04-14 09:20:24 +0000
@@ -1,5 +1,25 @@
 DROP TABLE IF EXISTS t1, t2;
 #
+# Bug#11763825/56590: PARTITIONS: FULLTEXT SEARCHES FAIL
+# (bad/confusing error message)
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+b VARCHAR(200),
+c TEXT)
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+CREATE FULLTEXT INDEX msg ON t1 (b, c);
+ERROR HY000: The storage engine partition doesn't support FULLTEXT indexes
+DROP TABLE t1;
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+b VARCHAR(200),
+c TEXT,
+FULLTEXT (b, c))
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+ERROR HY000: The storage engine partition doesn't support FULLTEXT indexes
+#
 # BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE
 #
 CREATE TABLE t1 (

=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/ps.result	2014-04-14 09:20:24 +0000
@@ -3916,6 +3916,46 @@ c1	c2	count(c3)
 DEALLOCATE PREPARE s1;
 #
 # End of 5.5 tests.
+#
+# Bug#12603141: JOIN::flatten_subqueries asrt/simplify_joins sig11/...
+# Bug#12603457: SEGFAULT IN REINIT_STMT_BEFORE_USE
+#
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(a INTEGER);
+PREPARE stmt FROM '
+SELECT (SELECT 1 FROM t2 WHERE ot.a) AS d
+FROM t1 AS ot
+GROUP BY d';
+EXECUTE stmt;
+d
+EXECUTE stmt;
+d
+INSERT INTO t1 VALUES (0),(1),(2);
+INSERT INTO t2 VALUES (1);
+EXECUTE stmt;
+d
+NULL
+1
+EXECUTE stmt;
+d
+NULL
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+#
+# Bug#12661349 assert in protocol::end_statement
+#
+# Note: This test case should be run with --ps-protocol
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (col1 INT);
+# Connection con1
+# Connection default
+KILL QUERY <con1_id>;
+# Connection con1
+SELECT * FROM t1;
+ERROR 70100: Query execution was interrupted
+# Connection default
+DROP TABLE t1;
 prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?";
 set @a='2010-11-11';
 execute stmt using @a;

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2013-11-20 11:05:39 +0000
+++ b/mysql-test/r/show_check.result	2014-04-14 09:20:24 +0000
@@ -1553,6 +1553,22 @@ RELEASE_LOCK('t')
 1
 SET NAMES latin1;
 #
+# Bug#58996 SHOW CREATE TRIGGER fails when subject table is shadowed by
+#           a temporary table.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
+SHOW CREATE TRIGGER t1_bi;
+Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
+t1_bi		CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW BEGIN END	latin1	latin1_swedish_ci	latin1_swedish_ci
+CREATE TEMPORARY TABLE t1 (b INT);
+SHOW CREATE TRIGGER t1_bi;
+Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
+t1_bi		CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW BEGIN END	latin1	latin1_swedish_ci	latin1_swedish_ci
+DROP TEMPORARY TABLE t1;
+DROP TABLE t1;
+#
 # WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS
 #
 SHOW AUTHORS;

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2013-11-20 11:05:39 +0000
+++ b/mysql-test/r/sp.result	2014-04-14 09:20:24 +0000
@@ -7652,6 +7652,48 @@ SELECT f1();
 f1()
 1
 DROP FUNCTION f1;
+#
+# Bug#12577230
+# RERUN OF STORED FUNCTION CAUSES SEGFAULT IN MAKE_JOIN_SELECT
+#
+CREATE TABLE t1 (a INT) ENGINE=myisam;
+INSERT INTO t1 VALUES (1);
+CREATE VIEW v1 AS SELECT a FROM t1;
+CREATE PROCEDURE p1()
+SELECT 1 FROM v1 JOIN t1 ON v1.a
+WHERE (SELECT 1 FROM t1 WHERE v1.a)
+;
+CALL p1();
+1
+1
+CALL p1();
+1
+1
+DROP PROCEDURE p1;
+DROP TABLE t1;
+DROP VIEW v1;
+#
+# WL#2111: Add non-reserved ROW_COUNT keyword.
+#
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE row_count INT DEFAULT 1;
+SELECT row_count;
+SELECT row_count();
+ROW_COUNT: WHILE row_count > 0 DO
+SET row_count = row_count - 1;
+END WHILE ROW_COUNT;
+SELECT ROW_COUNT;
+END|
+CALL p1();
+row_count
+1
+row_count()
+-1
+ROW_COUNT
+0
+DROP PROCEDURE p1;
 # ------------------------------------------------------------------
 # -- End of 5.1 tests
 # ------------------------------------------------------------------

=== modified file 'mysql-test/r/sp_notembedded.result'
--- a/mysql-test/r/sp_notembedded.result	2013-10-18 18:38:13 +0000
+++ b/mysql-test/r/sp_notembedded.result	2014-04-14 09:20:24 +0000
@@ -227,11 +227,13 @@ RELEASE_LOCK('Bug44521')
 DROP PROCEDURE p;
 CREATE TABLE t1(a int);
 INSERT INTO t1 VALUES (1);
-CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
+CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN GET_LOCK('Bug47736', 200);
 CREATE VIEW v1 AS SELECT f1('a') FROM t1;
+SELECT GET_LOCK('Bug47736', 0);
+GET_LOCK('Bug47736', 0)
+1
 SELECT * FROM v1;;
-SELECT * FROM v1;
-ERROR 70100: Query execution was interrupted
+KILL QUERY ID;
 ERROR 70100: Query execution was interrupted
 DROP VIEW v1;
 DROP TABLE t1;

=== modified file 'mysql-test/r/ssl.result'
--- a/mysql-test/r/ssl.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/ssl.result	2014-04-14 09:20:24 +0000
@@ -2166,3 +2166,13 @@ drop table t1;
 SHOW STATUS LIKE 'Ssl_cipher';
 Variable_name	Value
 Ssl_cipher	DHE-RSA-AES256-SHA
+#
+# Bug#54790: Use of non-blocking mode for sockets limits performance
+#
+# Open ssl_con and set a timeout.
+SET @@SESSION.wait_timeout = 2;
+# Wait for ssl_con to be disconnected.
+# Check that ssl_con has been disconnected.
+# CR_SERVER_LOST, CR_SERVER_GONE_ERROR
+SELECT 1;
+Got one of the listed errors

=== renamed file 'mysql-test/r/ssl_crl_clrpath.result' => 'mysql-test/r/ssl_crl_crlpath.result'
=== modified file 'mysql-test/r/subselect_notembedded.result'
--- a/mysql-test/r/subselect_notembedded.result	2011-12-12 22:58:40 +0000
+++ b/mysql-test/r/subselect_notembedded.result	2014-04-14 09:20:24 +0000
@@ -38,3 +38,9 @@ insert into t1(a,b) values (1,2),(2,1),(
 1
 drop table t1;
 End of 5.1 tests
+CREATE TABLE t1 (f1 INT NOT NULL);
+CREATE VIEW v1 (a) AS SELECT f1 IN (SELECT f1 FROM t1) FROM t1;
+SELECT * FROM v1;
+a
+drop view v1;
+drop table t1;

=== modified file 'mysql-test/r/sum_distinct.result'
--- a/mysql-test/r/sum_distinct.result	2011-12-29 02:47:01 +0000
+++ b/mysql-test/r/sum_distinct.result	2014-04-14 09:20:24 +0000
@@ -95,6 +95,31 @@ SELECT SUM(DISTINCT id % 11) FROM t1;
 SUM(DISTINCT id % 11)
 55
 DROP TABLE t1;
+
+BUG#37891: Column cannot be null error with aggregate in a subquery
+
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+int_key int(11) DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY int_key (int_key)
+);
+INSERT INTO t1 VALUES (1,10);
+CREATE TABLE t2 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+time_nokey time DEFAULT NULL,
+datetime_key time DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY datetime_key (datetime_key)
+);
+INSERT INTO t2 VALUES (1,'18:19:29',NOW());
+Warnings:
+Note	1265	Data truncated for column 'datetime_key' at row 1
+SELECT * FROM t1 WHERE int_key IN ( SELECT SUM(DISTINCT pk) FROM t2 WHERE time_nokey = datetime_key );
+pk	int_key
+SELECT * FROM t1 WHERE int_key IN ( SELECT AVG(DISTINCT pk) FROM t2 WHERE time_nokey = datetime_key );
+pk	int_key
+drop table t1,t2;
 #
 # Bug #777654: empty subselect in FROM clause returning  
 #              SUM(DISTINCT) over non-nullable field 

=== modified file 'mysql-test/r/trigger.result'
--- a/mysql-test/r/trigger.result	2013-11-03 15:31:52 +0000
+++ b/mysql-test/r/trigger.result	2014-04-14 09:20:24 +0000
@@ -2221,6 +2221,47 @@ DROP TABLE t1;
 
 End of 5.5 tests.
 #
+# Bug#34432 Wrong lock type passed to the engine if pre-locking +
+#           multi-update in a trigger
+#
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP TRIGGER IF EXISTS t2_ai;
+CREATE TABLE t2
+(
+value CHAR(30),
+domain_id INT,
+mailaccount_id INT,
+program CHAR(30),
+keey CHAR(30),
+PRIMARY KEY(domain_id)
+);
+CREATE TABLE t3
+(
+value CHAR(30),
+domain_id INT,
+mailaccount_id INT,
+program CHAR(30),
+keey CHAR(30),
+PRIMARY KEY(domain_id)
+);
+CREATE TABLE t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+CREATE TRIGGER t2_ai AFTER INSERT ON t2 FOR EACH ROW
+UPDATE t3 ms, t1 d SET ms.value='No'
+  WHERE ms.domain_id =
+(SELECT max(id) FROM t1 WHERE domain='example.com')
+AND ms.mailaccount_id IS NULL
+AND ms.program='spamfilter'
+  AND ms.keey='scan_incoming';
+|
+INSERT INTO t1 VALUES (1, 'example.com'),
+(2, 'mysql.com'),
+(3, 'earthmotherwear.com'),
+(4, 'yahoo.com'),
+(5, 'example.com');
+INSERT INTO t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+DROP TRIGGER t2_ai;
+DROP TABLE t1, t2, t3;
+#
 # BUG #910083: materialized subquery in a trigger
 #
 SET @save_optimizer_switch=@@optimizer_switch;

=== modified file 'mysql-test/r/type_date.result'
--- a/mysql-test/r/type_date.result	2014-02-03 14:22:39 +0000
+++ b/mysql-test/r/type_date.result	2014-04-14 09:20:24 +0000
@@ -289,6 +289,9 @@ DROP VIEW v1;
 #
 CREATE TABLE t1(a DATE, b YEAR, KEY(a));
 INSERT INTO t1 VALUES ('2011-01-01',2011);
+SELECT b = CONVERT(a, DATE) FROM t1;
+b = CONVERT(a, DATE)
+0
 SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1;
 b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a)
 0
@@ -394,3 +397,19 @@ id	select_type	table	type	possible_keys
 select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
 1
 drop table t1;
+#
+# Bug #13626019 DIFFERENCE IN OUTPUT BETWEEN 5.1 & 5.5 FOR A LAST_DAY IS
+# NULL SELECT QUERY
+#
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(b CHAR(19));
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES('0000-00-00 00:00:00');
+SELECT * FROM t1 WHERE LAST_DAY('0000-00-00 00:00:00') IS NULL;
+a
+1
+SELECT * FROM t1 WHERE
+LAST_DAY((SELECT b FROM t2 WHERE b = '0000-00-00 00:00:00')) IS NULL;
+a
+1
+DROP TABLE t1,t2;

=== modified file 'mysql-test/r/type_newdecimal.result'
--- a/mysql-test/r/type_newdecimal.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/type_newdecimal.result	2014-04-14 09:20:24 +0000
@@ -1988,3 +1988,27 @@ SELECT d1 * d2 FROM t1;
 d1 * d2
 0
 DROP TABLE t1;
+#
+# Start of 5.6 tests
+#
+#
+# Bug#13375823 - FSP(DECIMAL) RESULT DIFFERENCE WITH QUERY USING UNION ALL
+#
+CREATE TABLE t1 (a DECIMAL(20,3) NOT NULL);
+INSERT INTO t1 VALUES (20000716055804.035);
+INSERT INTO t1 VALUES (20080821000000.000);
+INSERT INTO t1 VALUES (0);
+SELECT GREATEST(a, 1323) FROM t1;
+GREATEST(a, 1323)
+20000716055804.035
+20080821000000.000
+1323.000
+(SELECT GREATEST(a, 1323) FROM t1) UNION ALL (SELECT GREATEST(a, 1323) FROM t1 LIMIT 0);
+GREATEST(a, 1323)
+20000716055804.035
+20080821000000.000
+1323.000
+DROP TABLE t1;
+#
+# End of 5.6 tests
+#

=== modified file 'mysql-test/r/udf.result'
--- a/mysql-test/r/udf.result	2011-12-12 22:58:40 +0000
+++ b/mysql-test/r/udf.result	2014-04-14 09:20:24 +0000
@@ -445,3 +445,34 @@ DROP FUNCTION myfunc_double;
 DROP TABLE t1;
 #
 End of 5.1 tests.
+#
+# Bug#53322 deadlock with FLUSH TABLES WITH READ LOCK and DROP FUNCTION
+#
+CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+# Connection con1
+FLUSH TABLES WITH READ LOCK;
+# Connection default
+# Sending:
+DROP FUNCTION metaphon;
+# Connection con1
+# Wait until DROP FUNCTION is blocked by GRL
+SELECT metaphon("foo");
+metaphon("foo")
+F
+UNLOCK TABLES;
+# Connection default
+# Reaping: DROP FUNCTION metaphon
+# Connection con1
+FLUSH TABLES WITH READ LOCK;
+# Connection default
+# Sending:
+CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+# Connection con1
+# Wait until CREATE FUNCTION is blocked by GRL
+SELECT reverse_lookup("127.0.0.1");
+UNLOCK TABLES;
+# Connection default
+# Reaping: CREATE FUNCTION metaphon ...
+DROP FUNCTION metaphon;
+DROP FUNCTION reverse_lookup;

=== modified file 'mysql-test/r/user_var.result'
--- a/mysql-test/r/user_var.result	2013-11-20 11:05:39 +0000
+++ b/mysql-test/r/user_var.result	2014-04-14 09:20:24 +0000
@@ -565,6 +565,37 @@ SELECT @a;
 1
 DROP TABLE t1;
 End of 5.5 tests
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (1), (3), (5), (7), (9);
+CREATE TABLE t3(a INT);
+INSERT INTO t3 VALUES (1), (4), (7), (10);
+SET @var1 = 6;
+explain SELECT t1.a, t2.a, t3.a, (@var1:= @var1+0) AS var
+FROM t1
+LEFT JOIN t2 ON t1.a=t2.a AND t2.a < @var1
+LEFT JOIN t3 ON t1.a=t3.a AND t3.a < @var1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	10	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	Using where; Using join buffer (flat, BNL join)
+1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	4	Using where; Using join buffer (incremental, BNL join)
+SELECT t1.a, t2.a, t3.a, (@var1:= @var1+0) AS var
+FROM t1
+LEFT JOIN t2 ON t1.a=t2.a AND t2.a < @var1
+LEFT JOIN t3 ON t1.a=t3.a AND t3.a < @var1;
+a	a	a	var
+1	1	1	6
+10	NULL	NULL	6
+2	NULL	NULL	6
+3	3	NULL	6
+4	NULL	4	6
+5	5	NULL	6
+6	NULL	NULL	6
+7	NULL	NULL	6
+8	NULL	NULL	6
+9	NULL	NULL	6
+DROP TABLE t1, t2, t3;
 #
 # Check that used memory extends if we set a variable
 #

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2013-12-27 11:00:14 +0000
+++ b/mysql-test/r/variables.result	2014-04-14 09:20:24 +0000
@@ -1478,6 +1478,16 @@ SELECT @@GLOBAL.server_id;
 @@GLOBAL.server_id
 0
 SET GLOBAL server_id = @old_server_id;
+SELECT @@GLOBAL.INIT_FILE, @@GLOBAL.INIT_FILE IS NULL;
+@@GLOBAL.INIT_FILE	@@GLOBAL.INIT_FILE IS NULL
+NULL	1
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ();
+SET @bug42778= @@sql_safe_updates;
+SET @@sql_safe_updates= 0;
+DELETE FROM t1 ORDER BY (@@GLOBAL.INIT_FILE) ASC LIMIT 10;
+SET @@sql_safe_updates= @bug42778;
+DROP TABLE t1;
 #
 # BUG#10206 - InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback
 #
@@ -1790,3 +1800,9 @@ ERROR 42000: Variable 'rand_seed1' doesn
 set autocommit = values(v);
 ERROR 42S22: Unknown column 'v' in 'field list'
 End of 5.5 tests
+#
+# Bug#57035 'ulonglong sql_mode' stored into ulong, is risky and causes
+#           compiler warning
+#
+SET @@sql_mode= 4294967296;
+ERROR 42000: Variable 'sql_mode' can't be set to the value of '4294967296'

=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2014-02-26 14:28:07 +0000
+++ b/mysql-test/r/view.result	2014-04-14 09:20:24 +0000
@@ -4656,13 +4656,102 @@ UNLOCK TABLES;
 DROP PROCEDURE p1;
 DROP TABLE t1;
 #
-# Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
-#               NON EXISTING DATABASE
+# Bug#11766440 59546: Assertion m_sp == __null fails in
+# Item_func_sp::init_result_field with functions
+#
+CREATE TABLE t1 (a INT);
+CREATE FUNCTION f1 () RETURNS INTEGER RETURN 1;
+CREATE FUNCTION f2 (i INTEGER) RETURNS INTEGER RETURN 1;
+CREATE VIEW v1 AS SELECT f1() AS a FROM t1;
+CREATE VIEW v2 AS SELECT f2(a) AS a FROM v1;
+DROP FUNCTION f1;
+SELECT f2(a) FROM v2;
+ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DROP VIEW v2;
+DROP VIEW v1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+#
+# Bug#13418197: ASSERTION `(*TABLES)->REGINFO.LOCK_TYPE >=
+#               TL_READ' FAILED | MYSQL_LOCK_TABLES
+#
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 (a INT);
+CREATE VIEW t1 AS SELECT 1;
+DROP VIEW t1;
+DROP TEMPORARY TABLE t1;
+#
+# Bug#13601606: FAILED VIEW CREATION ERROR MESSAGE (FOR DB NOT PRESENT) 
+#               NEEDS BIG IMPROVEMENT 
 #
 DROP DATABASE IF EXISTS nodb;
 CREATE VIEW nodb.a AS SELECT 1;
 ERROR 42000: Unknown database 'nodb'
 #
+# Bug#13633549 HANDLE_FATAL_SIGNAL IN 
+#              TEST_IF_SKIP_SORT_ORDER/CREATE_SORT_INDEX
+#
+CREATE TABLE t1 (
+pk        INT AUTO_INCREMENT,
+c_int_key INT,
+PRIMARY KEY (pk),
+KEY (c_int_key)
+);
+CREATE VIEW v_t1 AS SELECT * FROM t1;
+CREATE TABLE t2 (
+pk              INT auto_increment,
+c_varchar_600_x VARCHAR(600),
+c_int_key       INT,
+c_varchar_600_y VARCHAR(600),
+c_varchar_600_z VARCHAR(600),
+PRIMARY KEY (pk),
+KEY (c_int_key)
+);
+CREATE VIEW v_t2 AS SELECT * FROM t2;
+INSERT INTO t2 VALUES
+(
+NULL,
+repeat('x', 600),
+3,
+repeat('y', 600),
+repeat('z', 600)
+);
+SELECT a1.pk AS f1
+FROM v_t1 AS a1 LEFT JOIN v_t2 AS a2 ON a1.pk=a2.c_int_key
+WHERE 
+a1.pk > 8
+OR ((a1.pk BETWEEN 9 AND 13) AND a1.pk = 90)
+ORDER BY f1 ;
+f1
+DROP TABLE t1, t2;
+DROP VIEW v_t1, v_t2;
+#
+# Bug#13783777 CONSTANT PROPAGATION IS WRONG FOR
+#              DISJUNCTIVE PREDICATES IN VIEWS
+#
+CREATE TABLE t1 (
+pk INTEGER,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1), (2);
+CREATE VIEW v_t1 AS SELECT * FROM t1;
+SELECT pk
+FROM t1
+WHERE
+pk > 8
+OR ((pk BETWEEN 9 AND 13) AND pk = 90)
+;
+pk
+SELECT pk
+FROM v_t1
+WHERE
+pk > 8
+OR ((pk BETWEEN 9 AND 13) AND pk = 90)
+;
+pk
+DROP VIEW v_t1;
+DROP TABLE t1;
+#
 # lp:833600 Wrong result with view + outer join + uncorrelated subquery (non-semijoin) 
 #
 CREATE TABLE t1 ( a int, b int );

=== modified file 'mysql-test/r/wait_timeout.result'
--- a/mysql-test/r/wait_timeout.result	2009-01-23 17:19:09 +0000
+++ b/mysql-test/r/wait_timeout.result	2014-04-14 09:20:24 +0000
@@ -31,3 +31,26 @@ SELECT 3;
 3
 SET @@global.wait_timeout= <start_value>;
 disconnection con1;
+#
+# Bug#54790: Use of non-blocking mode for sockets limits performance
+#
+#
+# Test UNIX domain sockets timeout.
+#
+# Open con1 and set a timeout.
+SET @@SESSION.wait_timeout = 2;
+# Wait for con1 to be disconnected.
+# Check that con1 has been disconnected.
+# CR_SERVER_LOST, CR_SERVER_GONE_ERROR
+SELECT 1;
+Got one of the listed errors
+#
+# Test TCP/IP sockets timeout.
+#
+# Open con1 and set a timeout.
+SET @@SESSION.wait_timeout = 2;
+# Wait for con1 to be disconnected.
+# Check that con1 has been disconnected.
+# CR_SERVER_LOST, CR_SERVER_GONE_ERROR
+SELECT 1;
+Got one of the listed errors

=== modified file 'mysql-test/suite/archive/archive.result'
--- a/mysql-test/suite/archive/archive.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/suite/archive/archive.result	2014-04-14 09:20:24 +0000
@@ -12842,6 +12842,22 @@ Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
 #
+# BUG 11757503 - 49556: ERROR 1005 (HY000): CAN'T CREATE TABLE '#SQL-B7C_3' (ERRNO: -1)
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 decimal(19,14) NOT NULL) ENGINE=ARCHIVE;
+CALL mtr.add_suppression("Found wrong key definition in #sql.* Please do \"ALTER TABLE '#sql.*' FORCE \" to fix it!");
+CREATE INDEX i1 ON t1(c1);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+SHOW WARNINGS;
+Level	Code	Message
+Warning	1071	Specified key was too long; max key length is 8 bytes
+Warning	1194	Found wrong key definition in #sql-temporary; Please do "ALTER TABLE '#sql-temporary' FORCE" to fix it!
+Warning	1194	Found wrong key definition in #sql-temporary; Please do "ALTER TABLE '#sql-temporary' FORCE" to fix it!
+Error	1005	Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+Warning	1030	Got error 140 "Wrong create options" from storage engine ARCHIVE
+DROP TABLE t1;
+#
 # BUG#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS
 #                TESTS: CRASH, CORRUPTION, 4G MEMOR
 # (to be executed with valgrind)

=== modified file 'mysql-test/suite/archive/archive.test'
--- a/mysql-test/suite/archive/archive.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/suite/archive/archive.test	2014-04-14 09:20:24 +0000
@@ -1736,6 +1736,23 @@ CHECK TABLE t1;
 DROP TABLE t1;
 
 --echo #
+--echo # BUG 11757503 - 49556: ERROR 1005 (HY000): CAN'T CREATE TABLE '#SQL-B7C_3' (ERRNO: -1)
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (c1 decimal(19,14) NOT NULL) ENGINE=ARCHIVE;
+#Suppressing error message in server error log.
+CALL mtr.add_suppression("Found wrong key definition in #sql.* Please do \"ALTER TABLE '#sql.*' FORCE \" to fix it!");
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+CREATE INDEX i1 ON t1(c1);
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+SHOW WARNINGS;
+DROP TABLE t1;
+
+--echo #
 --echo # BUG#11758979 - 51252: ARCHIVE TABLES STILL FAIL UNDER STRESS
 --echo #                TESTS: CRASH, CORRUPTION, 4G MEMOR
 --echo # (to be executed with valgrind)

=== added file 'mysql-test/suite/archive/archive_no_symlink-master.opt'
--- a/mysql-test/suite/archive/archive_no_symlink-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/archive/archive_no_symlink-master.opt	2014-04-14 09:20:24 +0000
@@ -0,0 +1 @@
+--skip-symbolic-links

=== added file 'mysql-test/suite/archive/archive_no_symlink.result'
--- a/mysql-test/suite/archive/archive_no_symlink.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/archive/archive_no_symlink.result	2014-04-14 09:20:24 +0000
@@ -0,0 +1,26 @@
+#
+# This test shows that DATA DIRECTORY and INDEX DIRECTORY are
+# ignored where symbolic links are not supported such as Windows.
+#
+CREATE TABLE t1 (
+c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
+c2 varchar(30) NOT NULL,
+c3 smallint(5) unsigned DEFAULT NULL,
+PRIMARY KEY (c1))
+ENGINE = archive
+DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive';
+Warnings:
+Warning	1618	<DATA DIRECTORY> option ignored
+Warning	1618	<INDEX DIRECTORY> option ignored
+INSERT INTO t1 VALUES (NULL, "first", 1);
+INSERT INTO t1 VALUES (NULL, "second", 2);
+INSERT INTO t1 VALUES (NULL, "third", 3);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `c2` varchar(30) NOT NULL,
+  `c3` smallint(5) unsigned DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=ARCHIVE AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+DROP TABLE t1;

=== added file 'mysql-test/suite/archive/archive_no_symlink.test'
--- a/mysql-test/suite/archive/archive_no_symlink.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/archive/archive_no_symlink.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,26 @@
+# Test archive engine when symbolic links are not available.
+--source include/have_archive.inc
+
+--echo #
+--echo # This test shows that DATA DIRECTORY and INDEX DIRECTORY are
+--echo # ignored where symbolic links are not supported such as Windows.
+--echo #
+
+let $data_directory = DATA DIRECTORY = '$MYSQL_TMP_DIR/archive';
+let $index_directory = INDEX DIRECTORY = '$MYSQL_TMP_DIR/archive';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1 (
+  c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
+  c2 varchar(30) NOT NULL,
+  c3 smallint(5) unsigned DEFAULT NULL,
+  PRIMARY KEY (c1))
+ENGINE = archive
+$data_directory $index_directory;
+
+INSERT INTO t1 VALUES (NULL, "first", 1);
+INSERT INTO t1 VALUES (NULL, "second", 2);
+INSERT INTO t1 VALUES (NULL, "third", 3);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+

=== modified file 'mysql-test/suite/handler/interface.result'
--- a/mysql-test/suite/handler/interface.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/suite/handler/interface.result	2014-04-14 09:20:24 +0000
@@ -304,3 +304,96 @@ Note	1050	Table 'v' already exists
 handler v read next;
 ERROR 42S02: Unknown table 'v' in HANDLER
 drop view v;
+#
+# Bug#13008220 HANDLER SQL STATEMENT CAN MISS TO INITIALIZE
+#              FOR RANDOM READ
+#
+# A handler can only have one active 'cursor' at a time,
+# so switching between index and/or random should restart the cursor.
+CREATE TABLE t1(a INT, b INT, KEY b(b), KEY ab(a, b));
+INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30);
+HANDLER t1 OPEN;
+HANDLER t1 READ b FIRST;
+a	b
+1	10
+HANDLER t1 READ NEXT;
+a	b
+2	20
+HANDLER t1 READ NEXT;
+a	b
+1	10
+HANDLER t1 READ b FIRST;
+a	b
+1	10
+HANDLER t1 READ b NEXT;
+a	b
+2	20
+HANDLER t1 READ b NEXT;
+a	b
+3	30
+HANDLER t1 READ FIRST;
+a	b
+2	20
+HANDLER t1 READ b FIRST;
+a	b
+1	10
+HANDLER t1 READ NEXT;
+a	b
+2	20
+HANDLER t1 READ NEXT;
+a	b
+1	10
+HANDLER t1 READ NEXT;
+a	b
+4	40
+HANDLER t1 READ NEXT;
+a	b
+3	30
+HANDLER t1 READ NEXT;
+a	b
+HANDLER t1 READ b NEXT;
+a	b
+1	10
+HANDLER t1 READ b NEXT;
+a	b
+2	20
+HANDLER t1 READ b NEXT;
+a	b
+3	30
+HANDLER t1 READ b NEXT;
+a	b
+4	40
+HANDLER t1 READ b NEXT;
+a	b
+HANDLER t1 READ NEXT;
+a	b
+2	20
+HANDLER t1 READ b NEXT;
+a	b
+1	10
+HANDLER t1 READ FIRST;
+a	b
+2	20
+HANDLER t1 READ b PREV;
+a	b
+4	40
+HANDLER t1 READ b LAST;
+a	b
+4	40
+HANDLER t1 READ NEXT;
+a	b
+2	20
+HANDLER t1 READ ab FIRST;
+a	b
+1	10
+HANDLER t1 READ b NEXT;
+a	b
+1	10
+HANDLER t1 READ ab LAST;
+a	b
+4	40
+HANDLER t1 READ b PREV;
+a	b
+4	40
+HANDLER t1 CLOSE;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/handler/interface.test'
--- a/mysql-test/suite/handler/interface.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/suite/handler/interface.test	2014-04-14 09:20:24 +0000
@@ -390,3 +390,43 @@ execute stmt;
 handler v read next;
 drop view v;
 
+--echo #
+--echo # Bug#13008220 HANDLER SQL STATEMENT CAN MISS TO INITIALIZE
+--echo #              FOR RANDOM READ
+--echo #
+--echo # A handler can only have one active 'cursor' at a time,
+--echo # so switching between index and/or random should restart the cursor.
+
+CREATE TABLE t1(a INT, b INT, KEY b(b), KEY ab(a, b));
+INSERT INTO t1 VALUES (2, 20), (1, 10), (4, 40), (3, 30);
+HANDLER t1 OPEN;
+HANDLER t1 READ b FIRST;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ b FIRST;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ b FIRST;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ FIRST;
+HANDLER t1 READ b PREV;
+HANDLER t1 READ b LAST;
+HANDLER t1 READ NEXT;
+HANDLER t1 READ ab FIRST;
+HANDLER t1 READ b NEXT;
+HANDLER t1 READ ab LAST;
+HANDLER t1 READ b PREV;
+HANDLER t1 CLOSE;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/heap/heap.result'
--- a/mysql-test/suite/heap/heap.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/suite/heap/heap.result	2014-04-14 09:20:24 +0000
@@ -701,6 +701,9 @@ insert into t1 values ("abcdefghijklmnop
 insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
 ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 'PRIMARY'
 drop table t1;
+#
+# Bug 12796: Record doesn't show when selecting through index
+#
 CREATE TABLE t1 (a int, key(a)) engine=heap;
 insert into t1 values (0);
 delete from t1;
@@ -758,6 +761,20 @@ SELECT * from t1;
 id	color	ts
 7	GREEN	2
 DROP TABLE t1;
+CREATE TABLE t1 (
+c1 VARCHAR(10) NOT NULL,
+KEY i1 (c1(3))
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+SELECT * FROM t1 WHERE c1='bar2';
+c1
+bar2
+#should show one tuple!
+SELECT * FROM t1 IGNORE INDEX (i1) WHERE c1='bar2';
+c1
+bar2
+#should show one tuple!
+DROP TABLE t1;
 CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100;
 insert into t1 values(1);
 select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";

=== modified file 'mysql-test/suite/heap/heap.test'
--- a/mysql-test/suite/heap/heap.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/suite/heap/heap.test	2014-04-14 09:20:24 +0000
@@ -441,9 +441,9 @@ insert into t1 values ("abcdefghijklmnop
 insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
 drop table t1;
 
-#
-# Bug 12796: Record doesn't show when selecting through index
-#
+--echo #
+--echo # Bug 12796: Record doesn't show when selecting through index
+--echo #
 CREATE TABLE t1 (a int, key(a)) engine=heap;
 insert into t1 values (0);
 delete from t1;
@@ -510,6 +510,21 @@ DELETE FROM t1 WHERE ts = 1 AND color =
 SELECT * from t1;
 DROP TABLE t1;
 
+#
+# BUG 11755870 - 47704: HASH INDEX ON VARCHAR PREFIX NOT WORKING CORRECTLY.
+#
+CREATE TABLE t1 (
+    c1 VARCHAR(10) NOT NULL,
+    KEY i1 (c1(3))
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+
+SELECT * FROM t1 WHERE c1='bar2';
+--echo #should show one tuple!
+
+SELECT * FROM t1 IGNORE INDEX (i1) WHERE c1='bar2';
+--echo #should show one tuple!
+DROP TABLE t1;
 # End of 5.1 tests
 
 #

=== modified file 'mysql-test/suite/heap/heap_hash.result'
--- a/mysql-test/suite/heap/heap_hash.result	2012-11-22 09:19:31 +0000
+++ b/mysql-test/suite/heap/heap_hash.result	2014-04-14 09:20:24 +0000
@@ -466,4 +466,28 @@ SELECT * FROM t1 WHERE c1='bar2';
 c1
 bar2
 DROP TABLE t1;
+#
+# Bug #44771: Unique Hash index in memory engine will give wrong
+#             query result for NULL value.
+#
+CREATE TABLE t1
+(
+pk INT PRIMARY KEY,
+val INT,
+UNIQUE KEY USING HASH(val)
+) ENGINE=MEMORY;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, NULL);
+INSERT INTO t1 VALUES (3, NULL);
+INSERT INTO t1 VALUES (4, NULL);
+SELECT * FROM t1 WHERE val IS NULL;
+pk	val
+4	NULL
+3	NULL
+2	NULL
+1	NULL
+EXPLAIN SELECT * FROM t1 WHERE val IS NULL;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ref	val	val	5	const	1	Using where
+DROP TABLE t1;
 End of 5.5 tests

=== modified file 'mysql-test/suite/heap/heap_hash.test'
--- a/mysql-test/suite/heap/heap_hash.test	2012-11-22 09:19:31 +0000
+++ b/mysql-test/suite/heap/heap_hash.test	2014-04-14 09:20:24 +0000
@@ -346,4 +346,25 @@ explain SELECT * FROM t1 WHERE c1='bar2'
 SELECT * FROM t1 WHERE c1='bar2';
 DROP TABLE t1;
 
+--echo #
+--echo # Bug #44771: Unique Hash index in memory engine will give wrong
+--echo #             query result for NULL value.
+--echo #
+
+CREATE TABLE t1
+(
+   pk INT PRIMARY KEY,
+   val INT,
+   UNIQUE KEY USING HASH(val)
+) ENGINE=MEMORY;
+
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, NULL);
+INSERT INTO t1 VALUES (3, NULL);
+INSERT INTO t1 VALUES (4, NULL);
+
+SELECT * FROM t1 WHERE val IS NULL;
+EXPLAIN SELECT * FROM t1 WHERE val IS NULL;
+DROP TABLE t1;
+
 --echo End of 5.5 tests

=== added file 'mysql-test/t/bug12969156.test'
--- a/mysql-test/t/bug12969156.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug12969156.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,18 @@
+--source include/have_daemon_example_plugin.inc
+--source include/not_embedded.inc
+# TODO: the windows emulation of pthreads doesn't behave predictably
+--source include/not_windows.inc
+
+--echo #
+--echo # Bug #12969156 : SEGMENTATION FAULT ON UNINSTALLING
+--echo #  DAEMON_EXAMPLE PLUGIN
+--echo #
+
+let $counter= 0;
+while ($counter < 10)
+{
+--replace_result $LIBDAEMON_EXAMPLE_SO DAEMONEXAMPLE
+  eval INSTALL PLUGIN daemon_example SONAME '$LIBDAEMON_EXAMPLE_SO';
+  UNINSTALL PLUGIN daemon_example;
+  inc $counter;
+}

=== added file 'mysql-test/t/bug33509.test'
--- a/mysql-test/t/bug33509.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug33509.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,87 @@
+#
+# BUG#33509: Server crashes with number of recursive subqueries=61
+#  (the query may or may not fail with an error so we're using it with SP 
+#  
+create table t1 (a int not null);
+
+delimiter |;
+
+--disable_warnings
+drop procedure if exists p1|
+--enable_warnings
+CREATE PROCEDURE p1()
+BEGIN
+  DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
+  prepare s1 from '
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( select a from t1) 
+  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
+  execute s1;
+END;
+|
+delimiter ;|
+
+call p1();
+drop procedure p1;
+drop table t1;
+

=== added file 'mysql-test/t/bug46080-master.opt'
--- a/mysql-test/t/bug46080-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46080-master.opt	2014-04-14 09:20:24 +0000
@@ -0,0 +1 @@
+--loose-performance-schema=0 --skip-grant-tables --skip-name-resolve

=== added file 'mysql-test/t/bug46080.test'
--- a/mysql-test/t/bug46080.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46080.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,27 @@
+--echo #
+--echo # Bug #46080: group_concat(... order by) crashes server when
+--echo #  sort_buffer_size cannot allocate
+--echo #
+
+--source include/have_debug.inc
+
+call mtr.add_suppression("Out of memory at line .*, '.*my_alloc.c'");
+call mtr.add_suppression("needed .* byte (.*k)., memory in use: .* bytes (.*k)");
+
+CREATE TABLE t1(a CHAR(255));
+INSERT INTO t1 VALUES ('a');
+
+SET @@SESSION.sort_buffer_size=5*16*1000000;
+SET @@SESSION.max_heap_table_size=5*1000000;
+
+--echo # Must not crash.
+--disable_result_log
+--error 0,5
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
+--enable_result_log
+
+DROP TABLE t1;
+SET @@SESSION.sort_buffer_size=default;
+SET @@SESSION.max_heap_table_size=default;
+
+--echo End of 5.0 tests

=== added file 'mysql-test/t/debug_sync2.opt'
--- a/mysql-test/t/debug_sync2.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/debug_sync2.opt	2014-04-14 09:20:24 +0000
@@ -0,0 +1 @@
+--loose-debug-sync-timeout=1

=== added file 'mysql-test/t/debug_sync2.test'
--- a/mysql-test/t/debug_sync2.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/debug_sync2.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,26 @@
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+--echo #
+--echo # Bug#13688248 CRASH IN DIAGNOSTICS_AREA::SET_OK_STATUS WHEN USING DEBUG_SYNC
+--echo #
+
+SET SESSION DEBUG_SYNC= 'RESET';
+
+CREATE TABLE t1 (pk INT, PRIMARY KEY(pk));
+
+connect (con1,localhost,root,,);
+connection con1;
+SET SESSION sql_mode=TRADITIONAL;
+SET SESSION autocommit=1;
+
+INSERT INTO t1 VALUES(1);
+
+connection con1;
+SET SESSION debug_sync='write_row_replace SIGNAL go_ahead1 WAIT_FOR comes_never ';
+--send
+REPLACE INTO t1 ( pk ) VALUES ( 1 );
+--reap;
+
+DROP TABLE t1;
+SET DEBUG_SYNC='RESET';

=== modified file 'mysql-test/t/delayed.test'
--- a/mysql-test/t/delayed.test	2011-07-02 20:08:51 +0000
+++ b/mysql-test/t/delayed.test	2014-04-14 09:20:24 +0000
@@ -629,3 +629,19 @@ disconnect con1;
 --echo # Connection 'default'.
 connection default;
 drop tables tm, t1, t2;
+
+
+--echo #
+--echo # Bug#13259227 ASSERTION TABLES->TABLE->POS_IN_TABLE_LIST
+--echo #              == TABLES FAILED IN SQL_BASE.CC:4668
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TEMPORARY TABLE t1(a int);
+--error ER_NO_SUCH_TABLE
+INSERT DELAYED t1 VALUES (1); 
+
+DROP TEMPORARY TABLE t1;

=== added file 'mysql-test/t/delete_innodb.test'
--- a/mysql-test/t/delete_innodb.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/delete_innodb.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,30 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug#58709 assert in mysql_execute_command
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t2, t1;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT PRIMARY KEY) engine=InnoDB;
+CREATE TABLE t2 (i INT, FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION) engine=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+DELETE IGNORE FROM t1 WHERE i = 1;
+
+CREATE PROCEDURE p1() DELETE IGNORE FROM t1 WHERE i = 1;
+# This triggered the assert
+CALL p1();
+
+PREPARE stm FROM 'CALL p1()';
+# This also triggered the assert
+EXECUTE stm;
+DEALLOCATE PREPARE stm;
+
+DROP TABLE t2, t1;
+DROP PROCEDURE p1;

=== modified file 'mysql-test/t/distinct.test'
--- a/mysql-test/t/distinct.test	2014-02-17 10:00:51 +0000
+++ b/mysql-test/t/distinct.test	2014-04-14 09:20:24 +0000
@@ -789,3 +789,81 @@ drop table tb;
 SET @@tmp_table_size= @tmp_table_size_save;
 
 --echo End of 5.5 tests
+
+--echo #
+--echo # Bug#13335170 - ASSERT IN
+--echo # PLAN_CHANGE_WATCHDOG::~PLAN_CHANGE_WATCHDOG() ON SELECT DISTINCT 
+--echo #
+
+CREATE TABLE t1 (
+  col_int_key int(11) NOT NULL,
+  col_time_key time NOT NULL,
+  col_datetime_key datetime NOT NULL,
+  KEY col_int_key (col_int_key),
+  KEY col_time_key (col_time_key),
+  KEY col_datetime_key (col_datetime_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (7,'06:17:39','2003-08-21 00:00:00');
+
+SELECT DISTINCT col_int_key
+FROM t1
+WHERE col_int_key IN  ( 18, 6, 84, 4, 0, 2, 8, 3, 7, 9, 1 )  
+  AND col_datetime_key BETWEEN '2001-08-04' AND '2003-06-13'  
+ORDER BY col_time_key
+LIMIT 3;
+
+DROP TABLE t1;
+
+--echo #
+--echo # BUG#13540692: WRONG NULL HANDLING WITH RIGHT JOIN + 
+--echo #               DISTINCT OR ORDER BY
+--echo #
+
+CREATE TABLE t1 (
+  a INT,
+  b INT NOT NULL
+);
+INSERT INTO t1 VALUES (1,2), (3,3);
+
+let $query=
+SELECT DISTINCT subselect.b
+FROM t1 LEFT JOIN 
+     (SELECT it_b.* FROM t1 as it_a LEFT JOIN t1 as it_b ON true) AS subselect 
+     ON t1.a = subselect.b
+;
+
+--echo
+eval EXPLAIN $query;
+eval $query;
+
+DROP TABLE t1;
+
+--echo #
+--echo # BUG#13538387: WRONG RESULT ON SELECT DISTINCT + LEFT JOIN + 
+--echo #               LIMIT + MIX OF MYISAM AND INNODB
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (2),(3);
+
+CREATE TABLE t2 (b INT);
+
+CREATE TABLE t3 (
+  a INT,
+  b INT,
+  PRIMARY KEY (b)
+);
+INSERT INTO t3 VALUES (2001,1), (2007,2);
+
+let $query=
+SELECT DISTINCT t3.a AS t3_date
+FROM t1
+     LEFT JOIN t2 ON false
+     LEFT JOIN t3 ON t2.b = t3.b
+LIMIT 1;
+
+eval EXPLAIN $query;
+eval $query;
+
+DROP TABLE t1,t2,t3;

=== added file 'mysql-test/t/ds_mrr-big.test'
--- a/mysql-test/t/ds_mrr-big.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/ds_mrr-big.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,92 @@
+--source include/big_test.inc
+# As per discussion with Olav, skipping this test from valgrind runs
+--source include/not_valgrind.inc
+
+--echo #
+--echo # Bug 12365385 STRAIGHT_JOIN QUERY QUICKLY EXHAUSTS SYSTEM+VIRT. 
+--echo #              MEMORY LEADING TO SYSTEM CRASH
+--echo #
+
+# This test will cause the server to allocate many GBs of memory and most 
+# likely run out of memory if this bug gets re-introduced. 
+# A reduced version of this test is include in include/mrr_tests.inc
+
+CREATE TABLE ten (a INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+CREATE TABLE hundred (a INTEGER);
+INSERT INTO hundred
+SELECT a1.a + 10 * a2.a FROM ten a1, ten a2;
+
+CREATE TABLE thousand (a INTEGER);
+INSERT INTO thousand
+SELECT a1.a + 10 * a2.a + 100 * a3.a FROM ten a1, ten a2, ten a3;
+
+CREATE TABLE t1 (
+  pk INTEGER NOT NULL,
+  i1 INTEGER NOT NULL,
+  c1 VARCHAR(10) NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t1
+  SELECT a, 1, 'MySQL' FROM thousand;
+
+CREATE TABLE t2 (
+  pk INTEGER NOT NULL,
+  c1 VARCHAR(10) NOT NULL,
+  c2 varchar(10) NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t2
+  SELECT a, 'MySQL', 'MySQL' FROM ten;
+
+CREATE TABLE t3 (
+  pk INTEGER NOT NULL,
+  c1 VARCHAR(10) NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t3
+  SELECT a, 'MySQL' FROM hundred;
+
+CREATE TABLE t4 (
+  pk int(11) NOT NULL,
+  c1_key varchar(10) CHARACTER SET utf8 NOT NULL,
+  c2 varchar(10) NOT NULL,
+  c3 varchar(10) NOT NULL,
+  PRIMARY KEY (pk),
+  KEY k1 (c1_key)
+);
+
+# t4 is empty
+
+CREATE TABLE t5 (
+  pk INTEGER NOT NULL,
+  c1 VARCHAR(10) NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t5
+  SELECT a, 'MySQL' FROM ten;
+
+set optimizer_switch=`mrr=on,mrr_cost_based=off`;
+#set optimizer_switch='mrr=off';
+
+let query=
+SELECT STRAIGHT_JOIN *
+FROM 
+  (t1 LEFT JOIN 
+     (t2 LEFT JOIN
+       (t3 LEFT OUTER JOIN t4 ON t3.c1 <= t4.c1_key)
+      ON t2.c1 = t4.c3) 
+   ON t1.c1 = t4.c2)
+  RIGHT OUTER JOIN t5 ON t2.c2 <= t5.c1
+WHERE t1.i1 = 1;
+
+eval EXPLAIN $query;
+eval $query;
+
+DROP TABLE ten, hundred, thousand;
+DROP TABLE t1, t2, t3, t4, t5;

=== added file 'mysql-test/t/fulltext_plugin.test'
--- a/mysql-test/t/fulltext_plugin.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/fulltext_plugin.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,10 @@
+--source include/have_simple_parser.inc
+
+#
+# BUG#39746 - Debug flag breaks struct definition (server crash)
+#
+INSTALL PLUGIN simple_parser SONAME 'mypluglib';
+CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
+ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser;
+DROP TABLE t1;
+UNINSTALL PLUGIN simple_parser;

=== modified file 'mysql-test/t/func_analyse.test'
--- a/mysql-test/t/func_analyse.test	2011-04-14 09:10:11 +0000
+++ b/mysql-test/t/func_analyse.test	2014-04-14 09:20:24 +0000
@@ -157,3 +157,39 @@ SELECT * FROM t2 LIMIT 1 PROCEDURE ANALY
 DROP TABLE t1, t2;
 
 --echo End of 5.1 tests
+
+--echo #
+--echo # Bug #47338 assertion in handler::ha_external_lock
+--echo #
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TEMPORARY TABLE t1 (f2 INT, f1 INT, PRIMARY KEY (f1)) ENGINE = MyISAM;
+
+INSERT t1 ( f1 ) VALUES ( 5 );
+INSERT t1 ( f1 ) VALUES ( 6 );
+
+ALTER TABLE t1 ENGINE = MyISAM;
+ANALYZE TABLE t1;
+
+# Bug #48859 nor reproducible here (was in 6.0)
+# Keeping this test case anyways.
+
+SELECT f1,f2 FROM t1 A WHERE f1 BETWEEN 0 AND 1; 
+
+drop table t1;
+
+--echo #
+--echo # Bug #13358379   EXPLAIN SELECT ... PROCEDURE ANALYZE CRASHES THE SERVER
+--echo #
+
+CREATE TABLE t1 (i INT);
+--disable_result_log
+EXPLAIN SELECT * FROM t1 PROCEDURE ANALYSE();
+--enable_result_log
+DROP TABLE t1;
+
+--echo # End of 5.6 tests
+

=== modified file 'mysql-test/t/func_crypt.test'
--- a/mysql-test/t/func_crypt.test	2012-05-04 12:02:35 +0000
+++ b/mysql-test/t/func_crypt.test	2014-04-14 09:20:24 +0000
@@ -70,3 +70,20 @@ SELECT OLD_PASSWORD(c1), PASSWORD(c1) FR
 DROP TABLE t1;
 
 --echo End of 5.0 tests
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # Bug#13812875 ILLEGAL MIX OF COLLATIONS WITH FUNCTIONS THAT USED TO WORK
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a varchar(1));
+SELECT * FROM t1 WHERE a=password('a');
+DROP TABLE t1;
+SET NAMES latin1;
+
+--echo #
+--echo # End of 5.6 tests
+--echo #

=== modified file 'mysql-test/t/func_digest.test'
--- a/mysql-test/t/func_digest.test	2010-07-07 06:38:11 +0000
+++ b/mysql-test/t/func_digest.test	2014-04-14 09:20:24 +0000
@@ -494,3 +494,13 @@ SET NAMES latin1;
 SELECT sha2('1',224);
 --disable_metadata
 
+--echo #
+--echo # Bug#13812875 ILLEGAL MIX OF COLLATIONS WITH FUNCTIONS THAT USED TO WORK
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a varchar(1));
+SELECT * FROM t1 WHERE a=sha1('a');
+SELECT * FROM t1 WHERE a=sha2('a',224);
+DROP TABLE t1;
+SET NAMES latin1;
+

=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test	2014-02-26 14:28:07 +0000
+++ b/mysql-test/t/func_group.test	2014-04-14 09:20:24 +0000
@@ -1475,7 +1475,14 @@ SELECT AVG(DISTINCT outr.col_int_nokey)
 outr.col_int_nokey = outr2.col_int_nokey;
 DROP TABLE t1;
 --echo # End of the bug#57932
+--echo #
+--echo # BUG#12773464 - 61925: WRONG RESULT WITH AGGREGATE + NOT BETWEEN + KEY
+--echo #
+CREATE TABLE t1 (a int, KEY (a));
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
 
+DROP TABLE t1;
 
 --echo #
 --echo # MDEV-5257: MIN/MAX Optimization (Select tables optimized away) does not work for DateTime

=== modified file 'mysql-test/t/func_group_innodb.test'
--- a/mysql-test/t/func_group_innodb.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/t/func_group_innodb.test	2014-04-14 09:20:24 +0000
@@ -188,3 +188,21 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b
 DROP TABLE t1;
 
 --echo End of 5.5 tests
+
+--echo #
+--echo # Bug#13724099 1032 BYTE MEMORY LEAK NEW_CACHED_ITEM IN
+--echo #              SUBQUERY WITH GROUPING OF OUTER COLUMN
+--echo #
+
+CREATE TABLE t1 (
+  a BLOB,
+  b INT)
+engine=innodb;
+
+INSERT INTO t1 VALUES ('a', 0);
+
+SELECT 0 FROM t1
+WHERE 0 = (SELECT group_concat(b)
+           FROM t1 t GROUP BY t1.a)
+;
+DROP TABLE t1;

=== added file 'mysql-test/t/func_group_innodb_16k.test'
--- a/mysql-test/t/func_group_innodb_16k.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/func_group_innodb_16k.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,23 @@
+--source include/have_innodb.inc
+--source include/have_innodb_16k.inc
+
+--echo #
+--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+--echo #
+
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+                KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0),
+                               ('', 'a', null), ('', 'a', 0);
+
+-- disable_result_log
+ANALYZE TABLE t1;
+-- enable_result_log
+
+SELECT MIN(c) FROM t1 GROUP BY b;
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+
+DROP TABLE t1;
+
+
+--echo End of 5.6 tests

=== modified file 'mysql-test/t/func_if.test'
--- a/mysql-test/t/func_if.test	2012-05-21 18:54:41 +0000
+++ b/mysql-test/t/func_if.test	2014-04-14 09:20:24 +0000
@@ -183,6 +183,16 @@ SELECT IF(b, (SELECT a FROM t1 LIMIT 1),
 DROP TABLE t1;
 
 --echo #
+--echo # Bug#12620084
+--echo # ASSERTION WHEN CHECKING FIELD_TYPES[FIELD_POS] AND IT'S MYSQL_TYPE_NULL
+--echo #
+
+SELECT if(0, (SELECT min('hello')), NULL);
+SELECT if(1, (SELECT min('hello')), NULL);
+SELECT if(0, NULL, (SELECT min('hello')));
+SELECT if(1, NULL, (SELECT min('hello')));
+
+--echo #
 --echo # Bug#12532830 
 --echo # SIGFPE OR ASSERTION (PRECISION <= ((9 * 9) - 8*2)) && (DEC <= 30)
 --echo #

=== modified file 'mysql-test/t/func_misc.test'
--- a/mysql-test/t/func_misc.test	2014-02-26 14:28:07 +0000
+++ b/mysql-test/t/func_misc.test	2014-04-14 09:20:24 +0000
@@ -103,6 +103,194 @@ show create table t1;
 drop table t1;
 
 #
+# Bug#6760: Add SLEEP() function (feature request)
+#
+#   Logics of original test:
+#   Reveal that a query with SLEEP does not need less time than estimated.
+#
+# Bug#12689: SLEEP() gets incorrectly cached/optimized-away
+#
+#   Description from bug report (slightly modified)
+#
+#   Bug 1 (happened all time):
+#      SELECT * FROM t1 WHERE SLEEP(1) will only result in a sleep of 1
+#      second, regardless of the number of rows in t1.
+#   Bug 2 (happened all time):
+#      Such a query will also get cached by the query cache, but should not.
+#
+# Notes (mleich, 2008-05)
+# =======================
+#
+# Experiments around
+#    Bug#36345 Test 'func_misc' fails on RHAS3 x86_64
+# showed that the tests for both bugs could produce in case of parallel
+# artificial system time (like via ntpd)
+# - decreases false alarm
+# - increases false success
+#
+# We try here to circumvent these issues by reimplementation of the tests
+# and sophisticated scripting, although the cause of the problems is a massive
+# error within the setup of the testing environment.
+# Tests relying on or checking derivates of the system time must never meet
+# parallel manipulations of system time.
+#
+# Results of experiments with/without manipulation of system time,
+# information_schema.processlist content, high load on testing box
+# ----------------------------------------------------------------
+# Definition: Predicted_cumulative_sleep_time =
+#                #_of_result_rows * sleep_time_per_result_row
+#
+# 1. Total (real sleep time) ~= predicted_cumulative_sleep_time !!
+# 2. The state of a session within the PROCESSLIST changes to 'User sleep'
+#    if the sessions runs a statement containing the sleep function and the
+#    processing of the statement is just within the phase where the sleep
+#    is done. (*)
+# 3. NOW() and processlist.time behave "synchronous" to system time and
+#    show also the "jumps" caused by system time manipulations. (*)
+# 4. processlist.time is unsigned, the "next" value below 0 is ~ 4G (*)
+# 5. Current processlist.time ~= current real sleep time if the system time
+#    was not manipulated. (*)
+# 6. High system load can cause delays of <= 2 seconds.
+# 7. Thanks to Davi for excellent hints and ideas.
+#
+#    (*)
+#    - information_schema.processlist is not available before MySQL 5.1.
+#    - Observation of processlist content requires a
+#      - "worker" session sending the query with "send" and pulling results
+#        with "reap"
+#      - session observing the processlist parallel to the worker session
+#      "send" and "reap" do not work in case of an embedded server.
+#    Conclusion: Tests based on processlist have too many restrictions.
+#
+# Solutions for subtests based on TIMEDIFF of values filled via NOW()
+# -------------------------------------------------------------------
+# Run the following sequence three times
+#    1. SELECT <start_time>
+#    2. Query with SLEEP
+#    3. SELECT <end_time>
+# If TIMEDIFF(<end_time>,<start_time>) is at least two times within a
+# reasonable range assume that we did not met errors we were looking for.
+#
+# It is extreme unlikely that we have two system time changes within the
+# < 30 seconds runtime. Even if the unlikely happens, there are so
+# frequent runs of this test on this or another testing box which will
+# catch the problem.
+#
+
+--echo #------------------------------------------------------------------------
+--echo # Tests for Bug#6760 and Bug#12689
+# Number of rows within the intended result set.
+SET @row_count = 4;
+# Parameter within SLEEP function
+SET @sleep_time_per_result_row = 1;
+# Maximum acceptable delay caused by high load on testing box
+SET @max_acceptable_delay = 2;
+# TIMEDIFF = time for query with sleep (mostly the time caused by SLEEP)
+#            + time for delays caused by high load on testing box
+# Ensure that at least a reasonable fraction of TIMEDIFF belongs to the SLEEP
+# by appropriate setting of variables.
+# Ensure that any "judging" has a base of minimum three attempts.
+# (Test 2 uses all attempts except the first one.)
+if (!` SELECT (@sleep_time_per_result_row * @row_count - @max_acceptable_delay >
+              @sleep_time_per_result_row) AND (@row_count - 1 >= 3)`)
+{
+   --echo # Have to abort because of error in plausibility check
+   --echo ######################################################
+   --vertical_results
+   SELECT @sleep_time_per_result_row * @row_count - @max_acceptable_delay >
+               @sleep_time_per_result_row AS must_be_1,
+               @row_count - 1 >= 3 AS must_be_also_1,
+               @sleep_time_per_result_row, @row_count, @max_acceptable_delay;
+   exit;
+}
+SET @@global.query_cache_size = 1024 * 64;
+--disable_warnings
+DROP TEMPORARY TABLE IF EXISTS t_history;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
+start_ts DATETIME, end_ts DATETIME,
+start_cached INTEGER, end_cached INTEGER);
+CREATE TABLE t1 (f1 BIGINT);
+let $num = `SELECT @row_count`;
+while ($num)
+{
+   INSERT INTO t1 VALUES (1);
+   dec $num;
+}
+
+let $loops = 4;
+let $num = $loops;
+while ($num)
+{
+   let $Qcache_queries_in_cache =
+       query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1);
+   eval
+   INSERT INTO t_history
+   SET attempt = $loops - $num + 1, start_ts = NOW(),
+       start_cached = $Qcache_queries_in_cache;
+   SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
+   #
+   # Do not determine Qcache_queries_in_cache before updating end_ts. The SHOW
+   # might cost too much time on an overloaded box.
+   eval
+   UPDATE t_history SET end_ts = NOW()
+   WHERE attempt = $loops - $num + 1;
+   let $Qcache_queries_in_cache =
+          query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1);
+   eval
+   UPDATE t_history SET end_cached = $Qcache_queries_in_cache
+   WHERE attempt = $loops - $num + 1;
+   # DEBUG eval SELECT * FROM t_history WHERE attempt = $loops - $num + 1;
+   dec $num;
+}
+
+# 1. The majority of queries with SLEEP must need a reasonable time
+#    -> SLEEP has an impact on runtime
+#       = Replacement for original Bug#6760 test
+#    -> total runtime is clear more needed than for one result row needed
+#       = Replacement for one of the original Bug#12689 tests
+--echo # Test 1: Does the query with SLEEP need a reasonable time?
+eval SELECT COUNT(*) >= $loops - 1 INTO @aux1 FROM t_history
+WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
+      BETWEEN 0 AND @max_acceptable_delay;
+SELECT @aux1 AS "Expect 1";
+#
+# 2. The majority of queries (the first one must be ignored) with SLEEP must
+#    need a reasonable time
+#    -> If we assume that the result of a cached query will be sent back
+#       immediate, without any sleep, than the query with SLEEP cannot be cached
+#       (current and intended behaviour for queries with SLEEP).
+#    -> It could be also not excluded that the query was cached but the server
+#       honoured somehow the SLEEP. Such a behaviour would be also acceptable.
+#    = Replacement for one of the original Bug#12689 tests
+--echo # Test 2: Does the query with SLEEP need a reasonable time even in case
+--echo #         of the non first execution?
+eval SELECT COUNT(*) >= $loops - 1 - 1 INTO @aux2 FROM t_history
+WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
+      BETWEEN 0 AND @max_acceptable_delay
+      AND attempt > 1;
+SELECT @aux2 AS "Expect 1";
+#
+# 3. The query with SLEEP should be not cached.
+#    -> SHOW STATUS Qcache_queries_in_cache must be not incremented after
+#       the execution of the query with SLEEP
+--echo # Test 3: The query with SLEEP must be not cached.
+eval SELECT COUNT(*) = $loops INTO @aux3 FROM t_history
+WHERE end_cached = start_cached;
+SELECT @aux3 AS "Expect 1";
+#
+# Dump the content of t_history if one of the tests failed.
+if (`SELECT @aux1 + @aux2 + @aux3 <> 3`)
+{
+   --echo # Some tests failed, dumping the content of t_history
+   SELECT * FROM t_history;
+}
+DROP TABLE t1;
+DROP TEMPORARY TABLE t_history;
+SET @@global.query_cache_size = default;
+
+#
 # Bug #21466: INET_ATON() returns signed, not unsigned
 #
 

=== modified file 'mysql-test/t/func_set.test'
--- a/mysql-test/t/func_set.test	2013-08-20 11:48:29 +0000
+++ b/mysql-test/t/func_set.test	2014-04-14 09:20:24 +0000
@@ -136,6 +136,49 @@ SELECT * FROM t1 WHERE FIND_IN_SET(NULL,
 
 --echo
 DROP TABLE t1;
+
+--echo #
+--echo # BUG#12211480: GROUP BY MAKE_SET WITH EMPTY SET VALUES CRASH IN MY_HASH_SORT_SIMPLE
+--echo #
+
+CREATE TABLE t1 (a INT, b CHAR NOT NULL);
+INSERT INTO t1 VALUES (NULL,'1'),(NULL,'1');
+SELECT COUNT(*) FROM t1 GROUP BY MAKE_SET(a,b);
+
+DROP TABLE t1;
+
+--echo # End of test BUG#12211480
+
+--echo #
+--echo # Bug#12677197 MAKE_SET() AND MY_EMPTY_STRING BUGS CAUSE CRASHING
+--echo #
+
+do
+nullif( ( rtrim( make_set((cast(('%S') as unsigned)),
+                          (point((0xaf),(''))))
+               )
+        ), (''))
+;
+
+do
+dayofmonth( ( not( trim( trailing( convert((''), binary(4)))
+                   from( make_set( ('>>'), ('`'))))
+                 )))
+;
+
+do quote(make_set((''), (cast(('-2147483649.1') as binary(513)))));
+
+do
+trim( both(-8388607)
+      from( make_set( ( extract( minute_second from
+                                 ( str_to_date((rpad(1.0,4,1)), ('')))
+                               )
+                       ),
+                       ( char((connection_id()) using macce)))
+          )
+    )
+;
+
 --echo #
 --echo # Start of 5.3 tests
 --echo #

=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test	2013-11-20 11:05:39 +0000
+++ b/mysql-test/t/func_str.test	2014-04-14 09:20:24 +0000
@@ -1674,3 +1674,18 @@ SELECT FROM_BASE64(TO_BASE64(t1)) FROM t
 SELECT FROM_BASE64(TO_BASE64(d1)) FROM t1;
 SELECT FROM_BASE64(TO_BASE64(dt1)) FROM t1;
 DROP TABLE t1;
+
+--echo #
+--echo # Bug#13812875 ILLEGAL MIX OF COLLATIONS WITH FUNCTIONS THAT USED TO WORK
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (a varchar(1));
+SELECT * FROM t1 WHERE a=md5('a');
+SELECT * FROM t1 WHERE a=hex('a');
+SELECT * FROM t1 WHERE a=to_base64('a');
+DROP TABLE t1;
+SET NAMES latin1;
+
+--echo #
+--echo # End of 5.6 tests
+--echo #

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2014-02-04 09:49:44 +0000
+++ b/mysql-test/t/func_time.test	2014-04-14 09:20:24 +0000
@@ -930,6 +930,12 @@ SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERV
 DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
 
 --echo #
+--echo # Bug #13098726 MY_TIME.C:786: CALC_DAYNR: ASSERTION `DELSUM+(INT)
+--echo # Y/4-TEMP > 0' FAILED
+SELECT SUBTIME('0000-01-00 00:00','00:00');
+SELECT LEAST(TIMESTAMP('0000-01-00','0'),'2011-10-24') > 0;
+
+--echo #
 --echo # BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
 --echo # SIMILAR TO '2009-10-00' 
 --echo #
@@ -993,6 +999,25 @@ query_vertical SELECT
 --echo End of 5.1 tests
 
 --echo #
+--echo # BUG#43578 "MyISAM&Maria gives wrong rows with range access
+--echo # ORDER BY DESC on date index"
+--echo #
+
+CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY, c2 DATE NULL, c3 INT,
+INDEX idx2(c2));
+SET TIMESTAMP=1235553613; #'2009-02-25'
+INSERT INTO t1 VALUES(NOW(),NOW(),3),
+(ADDTIME(NOW(),'1 01:01:01'),ADDTIME(NOW(),'1 01:01:01'),4),
+(ADDTIME(NOW(),'2 01:01:01'),ADDTIME(NOW(),'2 01:01:01'),5),
+(ADDTIME(NOW(),'3 01:01:01'),ADDTIME(NOW(),'3 01:01:01'),6);
+SELECT * FROM t1;
+
+# bug was that 3 rows were returned
+SELECT * FROM t1 WHERE c1 > ADDTIME(NOW(),'1 01:01:01') ORDER BY c1 DESC;
+
+drop table t1;
+
+--echo #
 --echo # Bug#57039: constant subtime expression returns incorrect result.
 --echo #
 CREATE TABLE t1 (`date_date` datetime NOT NULL);
@@ -1041,6 +1066,72 @@ insert into t1 values ('00:00:00'),('00:
 select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
 drop table t1;
 
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # BUG#13545236 - ASSERT IN SEC_SINCE_EPOCH
+--echo #
+CREATE TABLE t1 (a TIME NOT NULL);
+INSERT INTO t1 VALUES ('04:39:24');
+INSERT INTO t1 VALUES ('00:20:09');
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR , a, TIMESTAMP('0000-00-00')),
+                 '+00:00','+00:00');
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR, a, DATE('0000-00-00')),
+                 '+00:00','+00:00');
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00');
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP('0000-00-01')) IS NULL;
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP'0000-00-01 00:00:00') IS NULL;
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE('0000-00-01')) IS NULL;
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE'0000-00-01') IS NULL;
+DROP TABLE t1;
+
+--echo #
+--echo # BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP 
+--echo # Part2 (5.6)
+CREATE TABLE t1 (a VARCHAR(32) NOT NULL);
+INSERT INTO t1 VALUES ('a');
+SELECT 1 FROM t1 GROUP BY @a:=UNIX_TIMESTAMP(a);
+SELECT a, UNIX_TIMESTAMP(a), UNIX_TIMESTAMP('a') FROM t1;
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('5000-01-01 00:00:00');
+SELECT a, UNIX_TIMESTAMP(a), UNIX_TIMESTAMP('5000-01-01 00:00:00') FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#13988413 CRASH/ASSERTION AFTER INVALID MEMORY READ 
+--echo #              IN MY_USECONDS_TO_STR
+--echo #
+
+DO contains(1, if(0, coalesce(NULL), now()));
+
+CREATE TABLE t1 AS SELECT IF(0, coalesce(NULL), now(0)) + 0;
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#13982125 BUFFER OVERFLOW OF VARIABLE BUF IN
+--echo #              ITEM_FUNC_MAKETIME::GET_TIME
+--echo #
+
+DO maketime(~0, 49, 0.123456789);
+
+--echo #
+--echo # Bug#14042545 ASSERTION FAILED: DEC <= 6 IN MY_USECONDS_TO_STR()
+--echo #
+
+DO is_used_lock(ifnull(now(), CASE 1 WHEN 1 THEN NULL END));
+
 select time('10:10:10') > 10;
 select time('10:10:10') > 1010;
 select time('10:10:09') > 101010;

=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test	2014-02-26 14:28:07 +0000
+++ b/mysql-test/t/gis.test	2014-04-14 09:20:24 +0000
@@ -541,6 +541,18 @@ insert into t1 values(default);
 drop table t1;
 
 #
+# Bug #27300: create view with geometry functions lost columns types
+#
+CREATE TABLE t1 (a GEOMETRY);
+CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
+CREATE VIEW v2 AS SELECT a FROM t1;
+DESCRIBE v1;
+DESCRIBE v2;
+
+DROP VIEW v1,v2;
+DROP TABLE t1;
+
+#
 # Bug#24563: MBROverlaps does not seem to function propertly
 # Bug#54888: MBROverlaps missing in 5.1?
 #
@@ -1461,3 +1473,9 @@ insert into t1 values(Geomfromtext('POLY
 drop table t1;
 
 --echo End of 5.5 tests
+
+--echo #
+--echo # Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE
+--echo #
+
+SELECT ST_Union('', ''), md5(1);

=== modified file 'mysql-test/t/having.test'
--- a/mysql-test/t/having.test	2013-11-12 06:21:39 +0000
+++ b/mysql-test/t/having.test	2014-04-14 09:20:24 +0000
@@ -659,6 +659,104 @@ drop table t1,t2,t3;
 --echo End of 5.2 tests
 
 --echo #
+--echo # BUG#46077 "wrong result: HAVING + ORDER BY + MyISAM + ICP
+--echo # returns extra rows"
+--echo #
+
+CREATE TABLE `t1` (
+  `pk` int(11) NOT NULL AUTO_INCREMENT,
+  `int_key` int(11) NOT NULL,
+  PRIMARY KEY (`pk`),
+  KEY `int_key` (`int_key`)
+) AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+
+INSERT INTO `t1` VALUES (1,7),(2,9);
+
+SELECT `pk`, `int_key` field1
+FROM t1 WHERE  `pk`  <  3
+HAVING  field1  <  8
+ORDER  BY field1;
+
+drop table `t1`;
+
+--echo End of 5.5 tests
+
+--echo #
+--echo # Bug#12402590 ASSERT AT PROTOCOL::END_STATEMENT ON MYSQL-TRUNK
+--echo #              RUNNING RQG_OPT_SUBQUERY TEST
+--echo #
+
+CREATE TABLE t2 (
+  f1 INT,
+  PRIMARY KEY (f1)
+);
+INSERT INTO t2 VALUES (1), (2);
+
+CREATE TABLE t1 (
+  f1 INT,
+  f2 VARCHAR(1),
+  f3 VARCHAR(1),
+  PRIMARY KEY (f1),
+  KEY (f2, f1)
+);
+INSERT INTO t1 VALUES (8, 'g', 'g'), (11, 'a', 'a');
+
+SELECT t1.f1 FROM t1 JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f3 AND t1.f2 IN ('f')
+HAVING (1 ,6) IN (SELECT 3, 6)
+ORDER BY t1.f1;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#13406172: HAVING CLAUSE ON AGGREGATED COLUMN RETURNS
+--echo #               WRONG RESULT WITH MYISAM
+--echo #
+
+CREATE TABLE ot (i int) ENGINE=MyISAM;
+INSERT INTO ot VALUES (1);
+
+CREATE TABLE it (i int) ENGINE=MyISAM;
+INSERT INTO it VALUES (7), (8);
+
+SELECT COUNT(i) AS x
+FROM ot
+WHERE (i) IN (SELECT i FROM it WHERE it.i <= 4) OR i IS NULL
+HAVING x > 1;
+
+CREATE FUNCTION f(a INTEGER) RETURNS INTEGER DETERMINISTIC RETURN a*a;
+SELECT BIT_AND(i) AS x
+FROM ot
+WHERE f(2) < 2
+HAVING x < 2;
+
+DROP TABLE it,ot;
+DROP FUNCTION f;
+
+--echo #
+--echo # Bug#11760517: MIN/MAX FAILS TO EVALUATE HAVING CONDITION,
+--echo #               RETURNS INCORRECT NULL RESULT
+--echo #
+CREATE TABLE t1 (pk INT PRIMARY KEY, i4 INT);
+INSERT INTO t1 VALUES (2,7), (4,7), (6,2), (17,0);
+
+--echo
+SELECT MIN(table1.i4), MIN(table2.pk) as min_pk
+FROM t1 as table1, t1 as table2
+WHERE table1.pk = 1;
+
+--echo
+SELECT MIN(table1.i4), MIN(table2.pk) as min_pk
+FROM t1 as table1, t1 as table2
+WHERE table1.pk = 1
+HAVING min_pk <= 10;
+
+--echo
+DROP TABLE t1;
+
+--echo End of 5.6 tests
+
+--echo #
 --echo # Bug mdev-5160: two-way join with HAVING over the second table
 --echo #
 

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2013-08-30 09:25:49 +0000
+++ b/mysql-test/t/information_schema.test	2014-04-14 09:20:24 +0000
@@ -1458,6 +1458,24 @@ drop user mysqltest_1 at localhost;
 
 --echo End of 5.1 tests.
 
+#
+# WL#2003 INFORMATION_SCHEMA: PARAMETERS view
+# WL#2822 INFORMATION_SCHEMA.ROUTINES: Add missing columns
+#
+create function f1 (p1 int, p2 datetime, p3 decimal(10,2))
+returns char(10) return null;
+create procedure p1 (p1 float(8,5), p2 char(32), p3 varchar(10)) begin end;
+create procedure p2 (p1 enum('c', 's'), p2 blob, p3 text) begin end;
+select * from information_schema.parameters where specific_schema='test';
+select data_type, character_maximum_length,
+       character_octet_length, numeric_precision,
+       numeric_scale, character_set_name,
+       collation_name, dtd_identifier
+from information_schema.routines where routine_schema='test';
+drop procedure p1;
+drop procedure p2;
+drop function f1;
+
 --echo #
 --echo # Additional test for WL#3726 "DDL locking for all metadata objects"
 --echo # To avoid possible deadlocks process of filling of I_S tables should
@@ -1554,6 +1572,17 @@ DROP TABLE t1, information_schema.tables
 LOCK TABLES t1 READ, information_schema.tables READ;
 DROP TABLE t1;
 
+#
+# Bug#38916 Select from I_S.ROUTINES results in "No database selected" error
+#
+create function f1() returns int return 1;
+--connect (con7,localhost,root,,*NO-ONE*)
+select routine_name, routine_type from information_schema.routines
+where routine_schema = 'test';
+connection default;
+drop function f1;
+disconnect con7;
+
 
 #
 # Bug #43834    Assertion in Natural_join_column::db_name() on an I_S query
@@ -1789,6 +1818,28 @@ disconnect con12828477_1;
 disconnect con12828477_2;
 disconnect con12828477_3;
 
+--echo #
+--echo # Test case to test DATETIME_PRECISION of information_schema.columns table
+--echo # 
+--disable_warnings
+drop database if exists mysqltest;
+--enable_warnings
+create database mysqltest;
+use mysqltest;
+create table mysqltest.t(a int, b date, c time, d datetime, e timestamp);
+create table mysqltest.t0(a int, b date, c time(0), d datetime(0), e timestamp(0));
+create table mysqltest.t1(a int, b date, c time(1), d datetime(1), e timestamp(1));
+create table mysqltest.t2(a int, b date, c time(2), d datetime(2), e timestamp(2));
+create table mysqltest.t3(a int, b date, c time(3), d datetime(3), e timestamp(3));
+create table mysqltest.t4(a int, b date, c time(4), d datetime(4), e timestamp(4));
+create table mysqltest.t5(a int, b date, c time(5), d datetime(5), e timestamp(5));
+create table mysqltest.t6(a int, b date, c time(6), d datetime(6), e timestamp(6));
+select TABLE_NAME,COLUMN_NAME,DATA_TYPE,DATETIME_PRECISION from information_schema.columns where TABLE_SCHEMA='mysqltest';
+
+--echo #
+--echo # Clean-up.
+drop database mysqltest;
+use test;
 
 --echo #
 --echo # MDEV-3818: Query against view over IS tables worse than equivalent query without view
@@ -1808,12 +1859,22 @@ where (information_schema.columns.table_
 drop view v1;
 
 --echo #
---echo # Clean-up.
-drop database mysqltest;
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # Bug #13966514 : CRASH IN GET_SCHEMA_TABLES_RESULT WITH MIN/MAX,
+--echo #   LEFT/RIGHT JOIN ON I_S TABLE
+--echo #
 
+CREATE TABLE t1(a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+--echo # must not crash
+SELECT MAX(a) FROM information_schema.engines RIGHT JOIN t1 ON 1;
+DROP TABLE t1;
 
 --echo #
---echo # End of 5.5 tests
+--echo # End of 5.6 tests
 --echo #
 
 # Wait till all disconnects are completed

=== modified file 'mysql-test/t/information_schema_parameters.test'
--- a/mysql-test/t/information_schema_parameters.test	2011-10-19 19:45:18 +0000
+++ b/mysql-test/t/information_schema_parameters.test	2014-04-14 09:20:24 +0000
@@ -247,5 +247,42 @@ RETURN CONCAT('XYZ, ' ,s);
 SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
 WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
 
+###############################################################################
+# Testcase parameters.13: Test case to test DATETIME_PRECISION in 
+# information_schema.parameters table.
+###############################################################################
+-- echo # ========== parameters.13 ==========
+--disable_warnings
+DROP DATABASE IF EXISTS i_s_parameters_test;
+--enable_warnings
+
+CREATE DATABASE i_s_parameters_test;
+USE i_s_parameters_test;
+
+delimiter \\;
+CREATE PROCEDURE test_proc (OUT p_p1 datetime,OUT p_p2 time,OUT p_p3 timestamp) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc0 (OUT p_p1 datetime(0),OUT p_p2 time(0),OUT p_p3 timestamp(0)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc1 (OUT p_p1 datetime(1),OUT p_p2 time(1),OUT p_p3 timestamp(1)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc2 (OUT p_p1 datetime(2),OUT p_p2 time(2),OUT p_p3 timestamp(2)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc3 (OUT p_p1 datetime(3),OUT p_p2 time(3),OUT p_p3 timestamp(3)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc4 (OUT p_p1 datetime(4),OUT p_p2 time(4),OUT p_p3 timestamp(4)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc5 (OUT p_p1 datetime(5),OUT p_p2 time(5),OUT p_p3 timestamp(5)) BEGIN SELECT 1 ; END; \\
+CREATE PROCEDURE test_proc6 (OUT p_p1 datetime(6),OUT p_p2 time(6),OUT p_p3 timestamp(6)) BEGIN SELECT 1 ; END; \\
+delimiter ;\\
+
+CREATE FUNCTION test_func (f_p1 DATETIME, f_p2 TIMESTAMP) RETURNS TIME RETURN NULL;
+CREATE FUNCTION test_func0 (f_p1 DATETIME(0), f_p2 TIMESTAMP(0)) RETURNS TIME(0) RETURN NULL;
+CREATE FUNCTION test_func1 (f_p1 DATETIME(1), f_p2 TIMESTAMP(1)) RETURNS TIME(1) RETURN NULL;
+CREATE FUNCTION test_func2 (f_p1 DATETIME(2), f_p2 TIMESTAMP(2)) RETURNS TIME(2) RETURN NULL;
+CREATE FUNCTION test_func3 (f_p1 DATETIME(3), f_p2 TIMESTAMP(3)) RETURNS TIME(3) RETURN NULL;
+CREATE FUNCTION test_func4 (f_p1 DATETIME(4), f_p2 TIMESTAMP(4)) RETURNS TIME(4) RETURN NULL;
+CREATE FUNCTION test_func5 (f_p1 DATETIME(5), f_p2 TIMESTAMP(5)) RETURNS TIME(5) RETURN NULL;
+CREATE FUNCTION test_func6 (f_p1 DATETIME(6), f_p2 TIMESTAMP(6)) RETURNS TIME(6) RETURN NULL;
+
+SELECT SPECIFIC_SCHEMA, SPECIFIC_NAME, PARAMETER_NAME, DATA_TYPE, 
+DATETIME_PRECISION from INFORMATION_SCHEMA.PARAMETERS WHERE 
+SPECIFIC_SCHEMA='i_s_parameters_test';
+
+
 # Cleanup
 DROP DATABASE i_s_parameters_test;

=== modified file 'mysql-test/t/information_schema_routines.test'
--- a/mysql-test/t/information_schema_routines.test	2011-10-19 19:45:18 +0000
+++ b/mysql-test/t/information_schema_routines.test	2014-04-14 09:20:24 +0000
@@ -243,5 +243,60 @@ RETURN CONCAT('XYZ, ' ,s);
 SELECT * FROM INFORMATION_SCHEMA.ROUTINES
 WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5';
 
+###############################################################################
+# Testcase Routine.10: Test case to test DATETIME_PRECISION in 
+# information_schema.routines table.
+###############################################################################
+-- echo # ========== routines.10 ==========
+--disable_warnings
+DROP DATABASE IF EXISTS i_s_routines_test;
+--enable_warnings
+
+CREATE DATABASE i_s_routines_test;
+USE i_s_routines_test;
+
+delimiter \\;
+CREATE PROCEDURE test_proc1 (OUT p_p1 timestamp) BEGIN SELECT 1 ; END; \\
+delimiter ;\\
+
+CREATE FUNCTION test_func_t (f_p1 DATETIME) RETURNS TIME RETURN NULL;
+CREATE FUNCTION test_func_dt (f_p1 DATETIME) RETURNS DATETIME RETURN NULL;
+CREATE FUNCTION test_func_ts (f_p1 DATETIME) RETURNS TIMESTAMP RETURN NULL;
+
+CREATE FUNCTION test_func_t0 (f_p1 DATETIME) RETURNS TIME(0) RETURN NULL;
+CREATE FUNCTION test_func_dt0 (f_p1 DATETIME) RETURNS DATETIME(0) RETURN NULL;
+CREATE FUNCTION test_func_ts0 (f_p1 DATETIME) RETURNS TIMESTAMP(0) RETURN NULL;
+
+CREATE FUNCTION test_func_t1 (f_p1 DATETIME) RETURNS TIME(1) RETURN NULL;
+CREATE FUNCTION test_func_dt1 (f_p1 DATETIME) RETURNS DATETIME(1) RETURN NULL;
+CREATE FUNCTION test_func_ts1 (f_p1 DATETIME) RETURNS TIMESTAMP(1) RETURN NULL;
+
+CREATE FUNCTION test_func_t2 (f_p1 DATETIME) RETURNS TIME(2) RETURN NULL;
+CREATE FUNCTION test_func_dt2 (f_p1 DATETIME) RETURNS DATETIME(2) RETURN NULL;
+CREATE FUNCTION test_func_ts2 (f_p1 DATETIME) RETURNS TIMESTAMP(2) RETURN NULL;
+
+CREATE FUNCTION test_func_t3 (f_p1 DATETIME) RETURNS TIME(3) RETURN NULL;
+CREATE FUNCTION test_func_dt3 (f_p1 DATETIME) RETURNS DATETIME(3) RETURN NULL;
+CREATE FUNCTION test_func_ts3 (f_p1 DATETIME) RETURNS TIMESTAMP(3) RETURN NULL;
+
+CREATE FUNCTION test_func_t4 (f_p1 DATETIME) RETURNS TIME(4) RETURN NULL;
+CREATE FUNCTION test_func_dt4 (f_p1 DATETIME) RETURNS DATETIME(4) RETURN NULL;
+CREATE FUNCTION test_func_ts4 (f_p1 DATETIME) RETURNS TIMESTAMP(4) RETURN NULL;
+
+CREATE FUNCTION test_func_t5 (f_p1 DATETIME) RETURNS TIME(5) RETURN NULL;
+CREATE FUNCTION test_func_dt5 (f_p1 DATETIME) RETURNS DATETIME(5) RETURN NULL;
+CREATE FUNCTION test_func_ts5 (f_p1 DATETIME) RETURNS TIMESTAMP(5) RETURN NULL;
+
+CREATE FUNCTION test_func_t6 (f_p1 DATETIME) RETURNS TIME(6) RETURN NULL;
+CREATE FUNCTION test_func_dt6 (f_p1 DATETIME) RETURNS DATETIME(6) RETURN NULL;
+CREATE FUNCTION test_func_ts6 (f_p1 DATETIME) RETURNS TIMESTAMP(6) RETURN NULL;
+
+# Here return type for test_proc1 is not defined so DATETIME_PRECISION for this
+# would be NULL. But return type for test_func1 is TIME, so DATETIME_PRECISION
+# would be 0.
+SELECT ROUTINE_NAME, ROUTINE_TYPE, DATA_TYPE, DATETIME_PRECISION from 
+INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='i_s_routines_test';
+
+
 # final clean up
 DROP DATABASE i_s_routines_test;

=== added file 'mysql-test/t/innodb_log_file_size_functionality.test'
--- a/mysql-test/t/innodb_log_file_size_functionality.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_log_file_size_functionality.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,124 @@
+###############################################################################
+#                                                                             #
+# Variable Name: innodb_log_file_size                                         #
+# Scope: Global                                                               #
+# Access Type: Static                                                         #
+# Data Type: numeric                                                          #
+#                                                                             #
+#                                                                             #
+# Creation Date: 2012-08-20                                                   #
+# Author : Tanjot Singh Uppal                                                 #
+#                                                                             #
+#                                                                             #
+# Description:Test Cases of Static System Variable innodb_log_file_size       #
+#             that checks the behavior of this variable in the following ways #
+#              * Value Check                                                  #
+#              * Scope Check                                                  #
+#              * Functionality Check                                          #
+#              * Accessability Check                                          #
+#                                                                             #               
+# This test does not perform the crash recovery on this variable              # 
+# For crash recovery test on default change please run the ibtest             #
+###############################################################################
+
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+-- source include/have_innodb_16k.inc
+
+echo '#________________________VAR_09_INNODB_LOG_FILE_SIZE__________________#'
+echo '##'
+--echo '#---------------------WL6372_VAR_9_01----------------------#'
+####################################################################
+#   Checking default value                                         #
+####################################################################
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+SELECT @@GLOBAL.innodb_log_file_size;
+--echo 5242880 Expected
+
+
+
+--echo '#---------------------WL6372_VAR_9_02----------------------#'
+####################################################################
+#   Checking Value can be set - Static                             #
+####################################################################
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@local.innodb_log_file_size=1;
+--echo Expected error 'Read only variable'
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.innodb_log_file_size=1;
+--echo Expected error 'Read only variable'
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_log_file_size=1;
+--echo Expected error 'Read only variable'
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_log_file_size=DEFAULT;
+--echo Expected error 'Read only variable'
+
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+
+
+--echo '#---------------------WL6372_VAR_9_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable  #
+#################################################################
+SELECT @@GLOBAL.innodb_log_file_size = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_log_file_size';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='innodb_log_file_size';
+--echo 1 Expected
+
+
+
+--echo '#---------------------WL6372_VAR_9_04----------------------#'
+################################################################################
+#  Checking Variable Scope                                                     #
+################################################################################
+SELECT @@innodb_log_file_size = @@GLOBAL.innodb_log_file_size;
+--echo 1 Expected
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.innodb_log_file_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.innodb_log_file_size);
+--echo Expected error 'Variable is a GLOBAL variable'
+
+SELECT COUNT(@@GLOBAL.innodb_log_file_size);
+--echo 1 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT innodb_log_file_size = @@SESSION.innodb_log_file_size;
+--echo Expected error 'Unknown column innodb_log_file_size in field list'
+
+
+
+--echo '#---------------------WL6372_VAR_9_05----------------------#'
+###############################################################################
+# Checking the /Var  directory size                                           #
+###############################################################################
+-- source include/vardir_size_check.inc
+--echo TRUE Expected
+
+--echo '#---------------------WL6372_VAR_9_06----------------------#'
+#################################################################################
+# Checking the size of ib_logfile                                               #
+#################################################################################
+let MYSQLD_DATADIR=`SELECT @@datadir`;
+--source include/ib_logfile_size_check.inc
+--echo 5242880 expected
+

=== modified file 'mysql-test/t/innodb_mysql_lock.test'
--- a/mysql-test/t/innodb_mysql_lock.test	2012-10-30 10:41:41 +0000
+++ b/mysql-test/t/innodb_mysql_lock.test	2014-04-14 09:20:24 +0000
@@ -319,6 +319,53 @@ DROP TABLE t1;
 disconnect con1;
 
 
+--echo #
+--echo # Bug#11747690 33650: MYSQL_ALTER_TABLE() UNNECESSARILY DOES
+--echo #              FULL TABLE COPY 
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT, b VARCHAR(250), PRIMARY KEY(a,b))
+  engine=innodb default charset=utf8;
+INSERT INTO t1 VALUES (1, 'a'), (2, 'b');
+
+# Check that 0 rows are affected
+--enable_info
+CREATE INDEX t1ba ON t1(b,a);
+--disable_info
+
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#11750045 - 40344: ALTER IGNORE TABLE T ADD INDEX DOES NOT IGNORE
+--echo #                IN FAST INDEX CREATION
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT NOT NULL, b INT) engine = innodb;
+INSERT INTO t1 VALUES (1,1), (2,1), (3,1);
+
+--echo # Should give error
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD UNIQUE INDEX (b);
+
+--echo # Should not give error
+--echo # Also check that copy algorithm is used
+--enable_info
+ALTER IGNORE TABLE t1 ADD UNIQUE INDEX (b);
+--disable_info
+SHOW WARNINGS;
+
+DROP TABLE t1;
+
+
 # Check that all connections opened by test cases in this file are really
 # gone so execution of other tests won't be affected by their presence.
 --source include/wait_until_count_sessions.inc

=== modified file 'mysql-test/t/join.test'
--- a/mysql-test/t/join.test	2013-11-20 11:05:39 +0000
+++ b/mysql-test/t/join.test	2014-04-14 09:20:24 +0000
@@ -963,6 +963,46 @@ DROP TABLE t1, t2;
 --echo End of 5.1 tests
 
 --echo #
+--echo # Bug 13102033 - CRASH IN COPY_FUNCS IN SQL_SELECT.CC ON JOIN +
+--echo #                GROUP BY + ORDER BY
+--echo #
+
+CREATE TABLE t1 (
+  pk INTEGER NOT NULL,
+  i1 INTEGER NOT NULL,
+  i2 INTEGER NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t1 VALUES (7,8,1), (8,2,2);
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+let query=
+SELECT t1.pk
+FROM v1, t1
+WHERE v1.i2 = 211
+  AND v1.i2 > 7
+  OR t1.i1 < 3
+GROUP BY t1.pk
+ORDER BY v1.i2;
+
+eval EXPLAIN $query;
+eval $query;
+
+let query=
+SELECT t1.pk
+FROM v1, t1
+WHERE (v1.i2 = 211 AND v1.i2 > 7)
+   OR (t1.i1 < 3 AND v1.i2 < 10);
+
+eval EXPLAIN $query;
+eval $query;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo #
 --echo # Bug #43368: STRAIGHT_JOIN DOESN'T WORK FOR NESTED JOINS 
 --echo #
 

=== modified file 'mysql-test/t/lock.test'
--- a/mysql-test/t/lock.test	2011-10-19 19:45:18 +0000
+++ b/mysql-test/t/lock.test	2014-04-14 09:20:24 +0000
@@ -576,6 +576,25 @@ UNLOCK TABLES;
 DROP TABLE t1, t2;
 disconnect con2;
 
+--echo #
+--echo # Additional test coverage for WL#5534 - Online ALTER phase 1.
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, m1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+CREATE TABLE m1(a INT) engine=merge union(t1);
+
+LOCK TABLES m1 WRITE;
+ALTER TABLE m1 COMMENT 'test';
+--echo # This triggered an assert in MDL_ticket::downgrade_lock
+FLUSH TABLE m1;
+
+UNLOCK TABLES;
+DROP TABLE m1, t1;
+
 
 --echo #
 --echo # End of 6.0 tests.

=== modified file 'mysql-test/t/merge.test'
--- a/mysql-test/t/merge.test	2013-12-16 12:02:21 +0000
+++ b/mysql-test/t/merge.test	2014-04-14 09:20:24 +0000
@@ -622,6 +622,14 @@ SHOW CREATE TABLE m1;
 DROP TABLE t1, m1;
 
 #
+# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
+#             key accessed
+#
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+DROP TABLE t1;
+
+#
 # BUG#32047 - 'Spurious' errors while opening MERGE tables
 #
 CREATE TABLE t1(a INT);
@@ -2961,6 +2969,26 @@ DROP TRIGGER trg1;
 DROP TABLE t1;
 DROP TABLE m1;
 
+--echo #
+--echo # Test for bug #11764786 - 57657: TEMPORARY MERGE TABLE WITH TEMPORARY
+--echo #                                 UNDERLYING TABLE, IS BROKEN BY ALTER.
+--echo #
+--disable_warnings
+DROP TABLES IF EXISTS t1, t2, t3, t4;
+--enable_warnings
+CREATE TEMPORARY TABLE t1(i INT) ENGINE= MyISAM;
+CREATE TEMPORARY TABLE t2(i INT) ENGINE= MERGE UNION= (t1) INSERT_METHOD= LAST;
+ALTER TABLE t2 INSERT_METHOD= FIRST;
+CHECK TABLE t2;
+
+CREATE TABLE t3(i INT) ENGINE= MyISAM;
+CREATE TABLE t4(i int) ENGINE= MERGE UNION= (t3) INSERT_METHOD= LAST;
+ALTER TABLE t4 INSERT_METHOD= FIRST;
+CHECK TABLE t4;
+--echo # Clean-up
+DROP TABLES t1, t2, t3, t4;
+--echo # End of bug #11764786 - 57657
+
 --disable_result_log
 --disable_query_log
 eval set global storage_engine=$default;

=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/t/myisam.test	2014-04-14 09:20:24 +0000
@@ -1751,6 +1751,15 @@ CHECK TABLE t1;
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#14093521 SIMPLE SELECT..WHERE QUERY ON YEAR GIVES DIFFERENT ORDER BY TRANSFORMED RESULT
+--echo #
+
+CREATE TABLE t1 (f1 year(4), key k1(f1)) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(0000),(0000);
+SELECT * FROM t1 FORCE INDEX(k1) WHERE f1 = 'lhsi';
+DROP TABLE t1;
+
 #
 # Check some variables
 #

=== added file 'mysql-test/t/myisam_row_rpl-master.opt'
--- a/mysql-test/t/myisam_row_rpl-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/myisam_row_rpl-master.opt	2014-04-14 09:20:24 +0000
@@ -0,0 +1 @@
+--binlog-format=row --binlog-row-event-max-size=1024

=== added file 'mysql-test/t/myisam_row_rpl-slave.opt'
--- a/mysql-test/t/myisam_row_rpl-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/myisam_row_rpl-slave.opt	2014-04-14 09:20:24 +0000
@@ -0,0 +1 @@
+--binlog-format=row --binlog-row-event-max-size=1024

=== added file 'mysql-test/t/myisam_row_rpl.test'
--- a/mysql-test/t/myisam_row_rpl.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/myisam_row_rpl.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,67 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # Bug#11940249: RBR: MYISAM TABLE CORRUPTION AFTER FIRST LARGE INSERT
+--echo #               ON SLAVE
+--echo #
+
+--echo # Must have > 100 rows in the first rpl event (to trigger bulk_insert
+--echo # optimization for insert into an empty table, by disable all non-unique
+--echo # indexes and recreate them afterwards.)
+--echo # and then it must be a second rpl event for the same insert (i.e.
+--echo # during the same lock).
+--echo # Note that --binlog-row-event-max-size=1024 is set in the .opt files
+--echo # to enforce the default size.
+
+CREATE TABLE tmp (a VARCHAR(10), b INT) ENGINE=Memory;
+INSERT INTO tmp VALUES ('aZa', 1), ('zAz', 2), ('M', 3);
+# 6 rows
+INSERT INTO tmp SELECT * FROM tmp;
+# 12 rows
+INSERT INTO tmp SELECT * FROM tmp;
+# 24
+INSERT INTO tmp SELECT * FROM tmp;
+# 48
+INSERT INTO tmp SELECT * FROM tmp;
+# 96
+INSERT INTO tmp SELECT * FROM tmp;
+# 192 rows
+INSERT INTO tmp SELECT * FROM tmp;
+
+CREATE TABLE t
+(a VARCHAR(10),
+ b INT,
+ KEY a (a))
+ENGINE = MyISAM;
+
+--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
+--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
+INSERT INTO t SELECT * FROM tmp;
+
+--sync_slave_with_master
+--connection slave
+--echo # on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+--connection master
+--echo # on master:
+--source include/show_binlog_events.inc
+
+RENAME TABLE t to t_2;
+RENAME TABLE t_2 to t;
+
+--sync_slave_with_master
+--connection slave
+--echo # on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+CHECK TABLE t;
+REPAIR TABLE t;
+SELECT COUNT(*) FROM t WHERE b > -1;
+--let $diff_tables= master:t, slave:t
+--source include/diff_tables.inc
+
+--connection master
+DROP TABLE t, tmp;
+--sync_slave_with_master
+
+--source include/rpl_end.inc

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2012-07-16 02:14:53 +0000
+++ b/mysql-test/t/mysqltest.test	2014-04-14 09:20:24 +0000
@@ -2884,6 +2884,11 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
 
 cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt;
 
+# Test replace_result and that it does not affect next SQL stmt
+replace_result file prefix;
+list_files $MYSQLTEST_VARDIR/tmp/testdir;
+SELECT "bla bla file" as x;
+
 list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file11.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt;
 remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file?.txt;
 list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt;

=== modified file 'mysql-test/t/olap.test'
--- a/mysql-test/t/olap.test	2010-02-26 13:16:46 +0000
+++ b/mysql-test/t/olap.test	2014-04-14 09:20:24 +0000
@@ -404,3 +404,33 @@ SELECT DISTINCT b FROM t1, t2 GROUP BY a
 DROP TABLE t1, t2;
 
 --echo End of 5.0 tests
+
+--echo #
+--echo # Bug#13011553 CRASH IN SORTCMP OR CACHED_ITEM_STR::CMP IF GROUP BY SUBQUERY WITH ROLLUP
+--echo #
+
+CREATE TABLE t1 (f1 DATETIME) ENGINE = MyISAM;
+INSERT INTO  t1 VALUES ('2012-12-20 00:00:00'), (NULL);
+
+SELECT f1 FROM t1 GROUP BY
+(SELECT f1 FROM t1 HAVING f1 < '2012-12-21 00:00:00') WITH ROLLUP;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (f1 DATE) ENGINE = MyISAM;
+INSERT INTO  t1 VALUES ('2012-12-20'), (NULL);
+
+SELECT f1 FROM t1 GROUP BY
+(SELECT f1 FROM t1 HAVING f1 < '2012-12-21') WITH ROLLUP;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (f1 TIME) ENGINE = MyISAM;
+INSERT INTO  t1 VALUES ('11:11:11'), (NULL);
+
+SELECT f1 FROM t1 GROUP BY
+(SELECT f1 FROM t1 HAVING f1 < '12:12:12') WITH ROLLUP;
+
+DROP TABLE t1;
+
+--echo End of 5.5 tests

=== modified file 'mysql-test/t/parser.test'
--- a/mysql-test/t/parser.test	2012-09-27 23:06:56 +0000
+++ b/mysql-test/t/parser.test	2014-04-14 09:20:24 +0000
@@ -733,3 +733,9 @@ DROP TABLE t1, t2, t3;
 --echo # End of 5.1 tests
 --echo #
 
+--echo #
+--echo # Bug#13819132 BROKEN SYNTAX ACCEPTED FOR START TRANSACTION
+--echo #
+
+--error ER_PARSE_ERROR
+START TRANSACTION ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ;

=== modified file 'mysql-test/t/partition_cache.test'
--- a/mysql-test/t/partition_cache.test	2012-02-20 21:59:11 +0000
+++ b/mysql-test/t/partition_cache.test	2014-04-14 09:20:24 +0000
@@ -19,3 +19,35 @@ let $partitions_s1= `SELECT ' PARTITION
 let $test_foreign_keys= 0;
 
 --source include/query_cache.inc
+
+SET @old_query_cache_size = @@global.query_cache_size;
+SET GLOBAL query_cache_size=1355776;
+CREATE TABLE t1
+(`NUM` varchar(4) NOT NULL,
+ `UPDATE_TIME` datetime NOT NULL,
+ PRIMARY KEY (`NUM`,`UPDATE_TIME`))
+PARTITION BY RANGE (month(UPDATE_TIME))
+(PARTITION p2 VALUES LESS THAN (3) ENGINE = InnoDB,
+ PARTITION p3 VALUES LESS THAN (4) ENGINE = InnoDB);
+
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+
+INSERT INTO t1 VALUES ('AAA', '2010-03-11 00:00:00');
+
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+
+ALTER TABLE t1 TRUNCATE PARTITION p3;
+
+COMMIT;
+
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+
+SELECT SQL_NO_CACHE * FROM t1 WHERE MONTH(update_time)=3;
+
+ALTER TABLE t1 DROP PARTITION p3;
+
+SELECT * FROM t1 WHERE MONTH(update_time)=3;
+
+DROP TABLE t1;
+
+SET @@global.query_cache_size = @old_query_cache_size;

=== modified file 'mysql-test/t/partition_disabled.test'
--- a/mysql-test/t/partition_disabled.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/t/partition_disabled.test	2014-04-14 09:20:24 +0000
@@ -85,3 +85,18 @@ create table t1 (a varchar(10) charset l
 insert into t1 values (''),(' '),('a'),('a '),('a  ');
 explain partitions select * from t1 where a='a ' OR a='a';
 drop table t1;
+--echo #
+--echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
+--echo #                                 TABLE CORRUPTS MYISAM
+--disable_warnings
+DROP TABLE if exists `t1`;
+--enable_warnings
+CREATE TABLE  `t1`(`a` INT)ENGINE=myisam;
+ALTER TABLE `t1` ADD COLUMN `b` INT;
+CREATE UNIQUE INDEX `i1` ON `t1`(`b`);
+CREATE UNIQUE INDEX `i2` ON `t1`(`a`);
+ALTER TABLE `t1` ADD PRIMARY KEY  (`a`);
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+ALTER TABLE `t1` REMOVE PARTITIONING;
+CHECK TABLE `t1` EXTENDED;
+DROP TABLE t1;

=== modified file 'mysql-test/t/partition_error.test'
--- a/mysql-test/t/partition_error.test	2013-09-27 12:58:49 +0000
+++ b/mysql-test/t/partition_error.test	2014-04-14 09:20:24 +0000
@@ -922,6 +922,23 @@ partitions 3
  partition x3 tablespace ts3);
 
 #
+# Partition by range columns, invalid field in field list
+#
+--error ER_FIELD_NOT_FOUND_PART_ERROR
+CREATE TABLE t1 (
+a int not null,
+b int not null,
+c int not null,
+primary key(a,b))
+partition by range columns (a,d)
+(partition x1 VALUES LESS THAN (1,1),
+ partition x2 VALUES LESS THAN (2,2),
+ partition x3 VALUES LESS THAN (3,3));
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+
+#
 # Partition by key, invalid field in field list
 #
 --error ER_FIELD_NOT_FOUND_PART_ERROR

=== modified file 'mysql-test/t/partition_hash.test'
--- a/mysql-test/t/partition_hash.test	2008-06-03 11:25:41 +0000
+++ b/mysql-test/t/partition_hash.test	2014-04-14 09:20:24 +0000
@@ -9,6 +9,44 @@
 drop table if exists t1;
 --enable_warnings
 
+--echo #
+--echo # Bug#12725206/Bug#61765: WRONG QUERY RESULTS ON SUBPARTITIONS BASED
+--echo #                         ON USIGNED BIGINT
+--echo #
+CREATE TABLE t1 (
+ a int(11) NOT NULL,
+ b bigint(20) UNSIGNED NOT NULL
+)
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (b)
+SUBPARTITIONS 3
+(PARTITION p1 VALUES LESS THAN (1308614400),
+ PARTITION p2 VALUES LESS THAN (1308700800),
+ PARTITION p3 VALUES LESS THAN (1308787200),
+ PARTITION p4 VALUES LESS THAN (1308873600),
+ PARTITION p5 VALUES LESS THAN (1308960000)
+);
+
+INSERT INTO t1 VALUES
+(1308614400,18446744073709551615),
+(1308700800,0xFFFFFFFFFFFFFFFE),
+(1308787200,18446744073709551613),
+(1308873600,18446744073709551612),
+(1308873600, 12531568256096620965),
+(1308873600, 12531568256096),
+(1308873600, 9223372036854775808);
+SELECT a,b,HEX(b) FROM t1 ORDER BY a, b;
+
+--echo # The following queries returned nothing
+
+SELECT * FROM t1 WHERE b = 9223372036854775808;
+SELECT * FROM t1 WHERE b = 18446744073709551612;
+SELECT * FROM t1 WHERE b = 18446744073709551615;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 9223372036854775808;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 18446744073709551612;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 18446744073709551615;
+DROP TABLE t1;
+
 #
 # Bug#30822: crash when COALESCE
 #

=== modified file 'mysql-test/t/partition_list.test'
--- a/mysql-test/t/partition_list.test	2009-10-21 18:04:34 +0000
+++ b/mysql-test/t/partition_list.test	2014-04-14 09:20:24 +0000
@@ -9,6 +9,102 @@
 drop table if exists t1;
 --enable_warnings
 
+--echo #
+--echo # Bug#62505: ALTER TABLE ADD PARTITION fails for LIST partitions with
+--echo #            more than 16 items
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+--echo # SUCCESS with 20 items because this is initial partitioning action
+--echo # (The parser already knows that it is only on column)
+ALTER TABLE t1
+PARTITION BY LIST(a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,
+                         11,12,13,14,15,16,17,18,19,20));
+
+--echo # BUG: FAILED, because number of items > 16 during partition add
+--echo # (The parser do not know how many columns the table is partitioned on)
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+                         31,32,33,34,35,36,37,38,39,40));
+
+
+SHOW CREATE TABLE t1;
+
+--echo # Test with single column LIST COLUMNS too
+ALTER TABLE t1
+PARTITION BY LIST COLUMNS (a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20));
+
+--error ER_PARSE_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN ((71),(72),(73),(74),(75),(76),(77),(78),(79),(80),
+                         (81),(82),(83),(84),(85),(86),(87),(88),(89),(90)));
+
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+                         31,32,33,34,35,36,37,38,39,40));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo # Test with two columns in LIST COLUMNS partitioning
+CREATE TABLE t1
+(a INT,
+ b CHAR(2))
+PARTITION BY LIST COLUMNS (a, b)
+(PARTITION p0_a VALUES IN
+((0, "a0"), (0, "a1"), (0, "a2"), (0, "a3"), (0, "a4"), (0, "a5"), (0, "a6"),
+ (0, "a7"), (0, "a8"), (0, "a9"), (0, "aa"), (0, "ab"), (0, "ac"), (0, "ad"),
+ (0, "ae"), (0, "af"), (0, "ag"), (0, "ah"), (0, "ai"), (0, "aj"), (0, "ak"),
+ (0, "al")));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p1_a VALUES IN
+((1, "a0"), (1, "a1"), (1, "a2"), (1, "a3"), (1, "a4"), (1, "a5"), (1, "a6"),
+ (1, "a7"), (1, "a8"), (1, "a9"), (1, "aa"), (1, "ab"), (1, "ac"), (1, "ad"),
+ (1, "ae"), (1, "af"), (1, "ag"), (1, "ah"), (1, "ai"), (1, "aj"), (1, "ak"),
+ (1, "al")));
+SHOW CREATE TABLE t1;
+
+--echo # Test of the parser for '('
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2_a VALUES IN
+(((1 + 1), "a0"), (2, "a1"), (2, "a2"), (2, "a3"), (2, "a4"), (2, "a5"),
+ (2, "a6"), (2, "a7"), (2, "a8"), (2, "a9"), (2, "aa"), (2, "ab"), (2, "ac"),
+ (2, "ad"), (2, "ae"), (2, "af"), (2, "ag"), (2, "ah"), (2, "ai"), (2, "aj"),
+ (2, "ak"), (2, "al")));
+
+SHOW CREATE TABLE t1;
+
+--error ER_PARSE_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1), "a0"));
+--error ER_PARTITION_COLUMN_LIST_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN (1 + 1 + 1, "a0"));
+
+--echo # Test with 3 columns when it only has 2.
+--error ER_PARTITION_COLUMN_LIST_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((3, "a1", 0), (3, "a2", 0)));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1, "a0")));
+SHOW CREATE TABLE t1;
+--echo # Test with more than 16 columns (cause of regression)
+#--error ER_PARSE_ERROR
+--error ER_PARTITION_COLUMN_LIST_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN ((21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+                              31 ,32, 33, 34, 35, 36, 37, 38, 39, 40),
+                             (41 ,42, 43, 44, 45, 46, 47, 48, 49, 50,
+                              51 ,52, 53, 54, 55, 56, 57, 58, 59, 60)));
+--error ER_PARTITION_COLUMN_LIST_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN (21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+                             31 ,32, 33, 34, 35, 36, 37, 38, 39, 40));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
 #
 # Bug 20733: Zerofill columns gives wrong result with partitioned tables
 #

=== added file 'mysql-test/t/partition_locking_4.test'
--- a/mysql-test/t/partition_locking_4.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_locking_4.test	2014-04-14 09:20:24 +0000
@@ -0,0 +1,52 @@
+--source include/have_partition.inc
+--source include/have_innodb.inc
+
+SET @old_autocommit = @@global.autocommit;
+SET @@global.autocommit = 0;
+SET @old_lock_wait_timeout= @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = 1;
+SET @old_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout = 1;
+
+USE test;
+
+CREATE USER 'mysqltest1'@'localhost';
+CREATE USER 'mysqltest2'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest1'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest2'@'localhost';
+
+CREATE TABLE t1 (a int PRIMARY KEY, b varchar(128), KEY (b))
+ENGINE = InnoDB
+PARTITION BY HASH (a) PARTITIONS 13;
+
+INSERT INTO t1 VALUES (11, 'First row, p11');
+INSERT INTO t1 VALUES (12, 'First row, p12');
+
+--enable_connect_log
+connect (test1,localhost,mysqltest1,,test);
+connect (test2,localhost,mysqltest2,,test);
+
+connection test1;
+INSERT INTO t1 VALUES (13+11, 'Second row, p11');
+INSERT INTO t1 VALUES (13+12, 'Second row, p12');
+SELECT * FROM t1 ORDER BY a;
+
+connection test2;
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES (13+11, 'Second row, p11');
+--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES (13+12, 'Second row, p12');
+SELECT * FROM t1 ORDER BY a;
+COMMIT;
+
+connection test1;
+SELECT * FROM t1 ORDER BY a;
+COMMIT;
+
+connection default;
+DROP TABLE t1;
+DROP USER 'mysqltest1'@'localhost';
+DROP USER 'mysqltest2'@'localhost';
+SET @@global.autocommit = @old_autocommit;
+SET @@global.lock_wait_timeout= @old_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout= @old_innodb_lock_wait_timeout;

=== modified file 'mysql-test/t/partition_mgm.test'
--- a/mysql-test/t/partition_mgm.test	2009-04-17 20:00:53 +0000
+++ b/mysql-test/t/partition_mgm.test	2014-04-14 09:20:24 +0000
@@ -3,6 +3,46 @@
 DROP TABLE IF EXISTS t1;
 --enable_warnings
 
+--echo #
+--echo # Bug#13357766: ASSERT IN HANDLER::HA_CREATE
+--echo #
+CREATE TABLE t1
+(a INT)
+PARTITION BY KEY(a) PARTITIONS 3;
+ALTER TABLE t1 REPAIR PARTITION p2,p3,p1;
+ALTER TABLE t1 ORDER BY a; 
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#11764110/bug#56909: REORGANIZE PARTITION is allowed on
+--echo #                         HASH/KEY partitioned tables
+--echo #
+CREATE TABLE t1 (a INT PRIMARY KEY)
+ENGINE MYISAM
+PARTITION BY HASH (a)
+PARTITIONS 1;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
+INSERT INTO t1 VALUES (12), (13), (14), (15), (16), (17), (18), (19), (20);
+--echo # This changes from auto partitioned to manual partitioned
+ALTER TABLE t1 REORGANIZE PARTITION p0 INTO (PARTITION pHidden);
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+ALTER TABLE t1 ADD PARTITION
+(PARTITION pNamed1);
+ALTER TABLE t1 ADD PARTITION
+(PARTITION pNamed2);
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p5);
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 REBUILD PARTITION all;
+ALTER TABLE t1 REBUILD PARTITION pNamed1,p5;
+ALTER TABLE t1 COALESCE PARTITION 1;
+ALTER TABLE t1 COALESCE PARTITION 2;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
 #
 # Bug 40389: REORGANIZE PARTITION crashes when only using one partition
 #

=== modified file 'mysql-test/t/partition_myisam.test'
--- a/mysql-test/t/partition_myisam.test	2013-11-20 11:05:39 +0000
+++ b/mysql-test/t/partition_myisam.test	2014-04-14 09:20:24 +0000
@@ -10,6 +10,27 @@ DROP TABLE IF EXISTS t1, t2;
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
 --echo #
+--echo # Bug#11763825/56590: PARTITIONS: FULLTEXT SEARCHES FAIL
+--echo # (bad/confusing error message)
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ b VARCHAR(200),
+ c TEXT)
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+--error ER_TABLE_CANT_HANDLE_FT
+CREATE FULLTEXT INDEX msg ON t1 (b, c);
+DROP TABLE t1;
+--error ER_TABLE_CANT_HANDLE_FT
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ b VARCHAR(200),
+ c TEXT,
+ FULLTEXT (b, c))
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+
+--echo #
 --echo # BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE
 --echo #
 CREATE TABLE t1 (

=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test	2014-02-12 15:07:05 +0000
+++ b/mysql-test/t/ps.test	2014-04-14 09:20:24 +0000
@@ -3534,7 +3534,66 @@ DEALLOCATE PREPARE s1;
 --echo #
 --echo # End of 5.5 tests.
 
+--echo #
+--echo # Bug#12603141: JOIN::flatten_subqueries asrt/simplify_joins sig11/...
+--echo # Bug#12603457: SEGFAULT IN REINIT_STMT_BEFORE_USE
+--echo #
+
+CREATE TABLE t1(a INTEGER);
+CREATE TABLE t2(a INTEGER);
+
+PREPARE stmt FROM '
+SELECT (SELECT 1 FROM t2 WHERE ot.a) AS d
+FROM t1 AS ot
+GROUP BY d';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+INSERT INTO t1 VALUES (0),(1),(2);
+INSERT INTO t2 VALUES (1);
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+
 ###########################################################################
+
+
+--echo #
+--echo # Bug#12661349 assert in protocol::end_statement
+--echo #
+
+--echo # Note: This test case should be run with --ps-protocol
+
+--disable_warnings ONCE
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1 (col1 INT);
+
+--echo # Connection con1
+connect(con1, localhost, root);
+let $con1_id= `SELECT CONNECTION_ID()`;
+
+--echo # Connection default
+connection default;
+--replace_result $con1_id <con1_id>
+eval KILL QUERY $con1_id;
+
+--echo # Connection con1
+connection con1;
+# Here the server asserts when running with "--ps-protocol"
+--error ER_QUERY_INTERRUPTED
+SELECT * FROM t1;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+DROP TABLE t1;
+
 #
 # restoring of the Item tree in BETWEEN with dates
 #

=== modified file 'mysql-test/t/show_check.test'
--- a/mysql-test/t/show_check.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/t/show_check.test	2014-04-14 09:20:24 +0000
@@ -1375,6 +1375,27 @@ SET NAMES latin1;
 
 
 --echo #
+--echo # Bug#58996 SHOW CREATE TRIGGER fails when subject table is shadowed by
+--echo #           a temporary table.
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
+SHOW CREATE TRIGGER t1_bi;
+
+CREATE TEMPORARY TABLE t1 (b INT);
+# Should still work
+SHOW CREATE TRIGGER t1_bi;
+
+DROP TEMPORARY TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
 --echo # WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS
 --echo #
 

=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test	2013-11-20 11:05:39 +0000
+++ b/mysql-test/t/sp.test	2014-04-14 09:20:24 +0000
@@ -9106,6 +9106,54 @@ SELECT f1();
 
 DROP FUNCTION f1;
 
+--echo #
+--echo # Bug#12577230
+--echo # RERUN OF STORED FUNCTION CAUSES SEGFAULT IN MAKE_JOIN_SELECT
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=myisam;
+INSERT INTO t1 VALUES (1);
+CREATE VIEW v1 AS SELECT a FROM t1;
+
+CREATE PROCEDURE p1()
+SELECT 1 FROM v1 JOIN t1 ON v1.a
+WHERE (SELECT 1 FROM t1 WHERE v1.a)
+;
+
+CALL p1();
+CALL p1();
+DROP PROCEDURE p1;
+
+DROP TABLE t1;
+DROP VIEW v1;
+
+--echo #
+--echo # WL#2111: Add non-reserved ROW_COUNT keyword.
+--echo #
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+DELIMITER |;
+
+CREATE PROCEDURE p1()
+BEGIN
+  DECLARE row_count INT DEFAULT 1;
+  SELECT row_count;
+  SELECT row_count();
+  ROW_COUNT: WHILE row_count > 0 DO
+    SET row_count = row_count - 1;
+  END WHILE ROW_COUNT;
+  SELECT ROW_COUNT;
+END|
+
+DELIMITER ;|
+
+CALL p1();
+
+DROP PROCEDURE p1;
+
 --echo # ------------------------------------------------------------------
 --echo # -- End of 5.1 tests
 --echo # ------------------------------------------------------------------

=== modified file 'mysql-test/t/sp_notembedded.test'
--- a/mysql-test/t/sp_notembedded.test	2013-09-13 16:14:56 +0000
+++ b/mysql-test/t/sp_notembedded.test	2014-04-14 09:20:24 +0000
@@ -362,36 +362,32 @@ DROP PROCEDURE p;
 #
 CREATE TABLE t1(a int);
 INSERT INTO t1 VALUES (1);
-CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
+CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN GET_LOCK('Bug47736', 200);
 CREATE VIEW v1 AS SELECT f1('a') FROM t1;
 
+SELECT GET_LOCK('Bug47736', 0);
+
 --connect (con1, localhost, root,,)
 --let $ID_1= `SELECT connection_id()`
 --send SELECT * FROM v1;
 
---connect (con2, localhost, root,,)
---let $ID_2= `SELECT connection_id()`
---send SELECT * FROM v1
-
 --connection default
---disable_query_log
---eval KILL QUERY $ID_2
+let $wait_condition=
+  SELECT count(*) = 1 FROM information_schema.processlist
+  WHERE state = "User lock" AND info = "SELECT * FROM v1";
+--source include/wait_condition.inc
+--replace_result $ID_1 ID
 --eval KILL QUERY $ID_1
---enable_query_log
 
 --connection con1
 --error ER_QUERY_INTERRUPTED
 --reap
---connection con2
---error ER_QUERY_INTERRUPTED
---reap
 
 --connection default
 DROP VIEW v1;
 DROP TABLE t1;
 DROP FUNCTION f1;
 --disconnect con1
---disconnect con2
 
 --echo # ------------------------------------------------------------------
 --echo # -- End of 5.1 tests

=== modified file 'mysql-test/t/ssl.test'
--- a/mysql-test/t/ssl.test	2012-08-14 14:23:34 +0000
+++ b/mysql-test/t/ssl.test	2014-04-14 09:20:24 +0000
@@ -26,6 +26,32 @@ SHOW STATUS LIKE 'Ssl_cipher';
 connection default;
 disconnect ssl_con;
 
+--echo #
+--echo # Bug#54790: Use of non-blocking mode for sockets limits performance
+--echo #
+
+--echo # Open ssl_con and set a timeout.
+connect (ssl_con,localhost,root,,,,,SSL);
+
+LET $ID= `SELECT connection_id()`;
+SET @@SESSION.wait_timeout = 2;
+
+--echo # Wait for ssl_con to be disconnected.
+connection default;
+let $wait_condition=
+  SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST
+  WHERE ID = $ID;
+--source include/wait_condition.inc
+
+--echo # Check that ssl_con has been disconnected.
+connection ssl_con;
+--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR
+--error 2006,2013
+SELECT 1;
+
+connection default;
+disconnect ssl_con;
+
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 

=== renamed file 'mysql-test/t/ssl_crl_clrpath-master.opt' => 'mysql-test/t/ssl_crl_crlpath-master.opt'
=== renamed file 'mysql-test/t/ssl_crl_clrpath.test' => 'mysql-test/t/ssl_crl_crlpath.test'
=== modified file 'mysql-test/t/subselect_notembedded.test'
--- a/mysql-test/t/subselect_notembedded.test	2010-03-20 12:01:47 +0000
+++ b/mysql-test/t/subselect_notembedded.test	2014-04-14 09:20:24 +0000
@@ -60,3 +60,16 @@ while ($nesting)
 drop table t1;
 
 --echo End of 5.1 tests
+
+#
+# BUG#33245 "Crash on VIEW referencing FROM table in an IN clause"
+# (this is a second copy of testcase that uses disconnect/connect commands
+#  which increase probability of crash)
+--disconnect default
+--connect (default,localhost,root,,test)
+CREATE TABLE t1 (f1 INT NOT NULL);
+CREATE VIEW v1 (a) AS SELECT f1 IN (SELECT f1 FROM t1) FROM t1;
+SELECT * FROM v1;
+drop view v1;
+drop table t1;
+

=== modified file 'mysql-test/t/sum_distinct.test'
--- a/mysql-test/t/sum_distinct.test	2011-12-29 02:47:01 +0000
+++ b/mysql-test/t/sum_distinct.test	2014-04-14 09:20:24 +0000
@@ -94,6 +94,30 @@ SELECT SUM(DISTINCT id % 11) FROM t1;
 
 DROP TABLE t1;
 
+--echo 
+--echo BUG#37891: Column cannot be null error with aggregate in a subquery
+--echo
+CREATE TABLE t1 (
+  pk int(11) NOT NULL AUTO_INCREMENT,
+  int_key int(11) DEFAULT NULL,
+  PRIMARY KEY (pk),
+  KEY int_key (int_key)
+);
+INSERT INTO t1 VALUES (1,10);
+
+CREATE TABLE t2 (
+  pk int(11) NOT NULL AUTO_INCREMENT,
+  time_nokey time DEFAULT NULL,
+  datetime_key time DEFAULT NULL,
+  PRIMARY KEY (pk),
+  KEY datetime_key (datetime_key)
+);
+INSERT INTO t2 VALUES (1,'18:19:29',NOW());
+
+SELECT * FROM t1 WHERE int_key IN ( SELECT SUM(DISTINCT pk) FROM t2 WHERE time_nokey = datetime_key );
+SELECT * FROM t1 WHERE int_key IN ( SELECT AVG(DISTINCT pk) FROM t2 WHERE time_nokey = datetime_key );
+drop table t1,t2;
+
 --echo #
 --echo # Bug #777654: empty subselect in FROM clause returning  
 --echo #              SUM(DISTINCT) over non-nullable field 

=== modified file 'mysql-test/t/trigger.test'
--- a/mysql-test/t/trigger.test	2013-11-03 15:31:52 +0000
+++ b/mysql-test/t/trigger.test	2014-04-14 09:20:24 +0000
@@ -2573,6 +2573,54 @@ DROP TABLE t1;
 --echo End of 5.5 tests.
 
 --echo #
+--echo # Bug#34432 Wrong lock type passed to the engine if pre-locking +
+--echo #           multi-update in a trigger
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3;
+DROP TRIGGER IF EXISTS t2_ai;
+--enable_warnings
+CREATE TABLE t2
+       (
+         value CHAR(30),
+         domain_id INT,
+         mailaccount_id INT,
+         program CHAR(30),
+         keey CHAR(30),
+         PRIMARY KEY(domain_id)
+       );
+CREATE TABLE t3
+       (
+         value CHAR(30),
+         domain_id INT,
+         mailaccount_id INT,
+         program CHAR(30),
+         keey CHAR(30),
+         PRIMARY KEY(domain_id)
+       );
+CREATE TABLE t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
+
+delimiter |;
+CREATE TRIGGER t2_ai AFTER INSERT ON t2 FOR EACH ROW
+  UPDATE t3 ms, t1 d SET ms.value='No'
+  WHERE ms.domain_id =
+    (SELECT max(id) FROM t1 WHERE domain='example.com')
+  AND ms.mailaccount_id IS NULL
+  AND ms.program='spamfilter'
+  AND ms.keey='scan_incoming';
+|
+delimiter ;|
+
+INSERT INTO t1 VALUES (1, 'example.com'),
+                      (2, 'mysql.com'),
+                      (3, 'earthmotherwear.com'),
+                      (4, 'yahoo.com'),
+                      (5, 'example.com');
+INSERT INTO t2 VALUES ('Yes', 1, NULL, 'spamfilter','scan_incoming');
+DROP TRIGGER t2_ai;
+DROP TABLE t1, t2, t3;
+
+--echo #
 --echo # BUG #910083: materialized subquery in a trigger
 --echo #
 

=== modified file 'mysql-test/t/type_date.test'
--- a/mysql-test/t/type_date.test	2013-11-20 11:05:39 +0000
+++ b/mysql-test/t/type_date.test	2014-04-14 09:20:24 +0000
@@ -280,6 +280,7 @@ DROP VIEW v1;
 CREATE TABLE t1(a DATE, b YEAR, KEY(a));
 INSERT INTO t1 VALUES ('2011-01-01',2011);
 
+SELECT b = CONVERT(a, DATE) FROM t1;
 SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1;
 SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1;
 
@@ -358,3 +359,16 @@ select 1 from t1 as t1_0 inner join t1 a
 select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
 drop table t1;
 
+--echo #
+--echo # Bug #13626019 DIFFERENCE IN OUTPUT BETWEEN 5.1 & 5.5 FOR A LAST_DAY IS
+--echo # NULL SELECT QUERY
+--echo #
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(b CHAR(19));
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES('0000-00-00 00:00:00');
+SELECT * FROM t1 WHERE LAST_DAY('0000-00-00 00:00:00') IS NULL;
+SELECT * FROM t1 WHERE
+LAST_DAY((SELECT b FROM t2 WHERE b = '0000-00-00 00:00:00')) IS NULL;
+DROP TABLE t1,t2;

=== modified file 'mysql-test/t/type_newdecimal.test'
--- a/mysql-test/t/type_newdecimal.test	2012-01-16 19:16:35 +0000
+++ b/mysql-test/t/type_newdecimal.test	2014-04-14 09:20:24 +0000
@@ -1570,3 +1570,22 @@ SELECT d1 * d2 FROM t1;
 
 DROP TABLE t1;
 
+
+--echo #
+--echo # Start of 5.6 tests
+--echo #
+
+--echo #
+--echo # Bug#13375823 - FSP(DECIMAL) RESULT DIFFERENCE WITH QUERY USING UNION ALL
+--echo #
+CREATE TABLE t1 (a DECIMAL(20,3) NOT NULL);
+INSERT INTO t1 VALUES (20000716055804.035);
+INSERT INTO t1 VALUES (20080821000000.000);
+INSERT INTO t1 VALUES (0);
+SELECT GREATEST(a, 1323) FROM t1;
+(SELECT GREATEST(a, 1323) FROM t1) UNION ALL (SELECT GREATEST(a, 1323) FROM t1 LIMIT 0);
+DROP TABLE t1;
+
+--echo #
+--echo # End of 5.6 tests
+--echo #

=== modified file 'mysql-test/t/udf.test'
--- a/mysql-test/t/udf.test	2011-10-19 19:45:18 +0000
+++ b/mysql-test/t/udf.test	2014-04-14 09:20:24 +0000
@@ -512,3 +512,70 @@ DROP TABLE t1;
 --echo #
 --echo End of 5.1 tests.
 
+
+--echo #
+--echo # Bug#53322 deadlock with FLUSH TABLES WITH READ LOCK and DROP FUNCTION
+--echo #
+
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
+
+--echo # Connection con1
+connect(con1, localhost, root);
+FLUSH TABLES WITH READ LOCK;
+
+--echo # Connection default
+connection default;
+--echo # Sending:
+--send DROP FUNCTION metaphon
+
+--echo # Connection con1
+connection con1;
+--echo # Wait until DROP FUNCTION is blocked by GRL
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM information_schema.processlist
+  WHERE state = "Waiting for global read lock" AND
+        info = "DROP FUNCTION metaphon";
+--source include/wait_condition.inc
+SELECT metaphon("foo");
+UNLOCK TABLES;
+
+--echo # Connection default
+connection default;
+--echo # Reaping: DROP FUNCTION metaphon
+--reap
+
+--echo # Connection con1
+connection con1;
+FLUSH TABLES WITH READ LOCK;
+
+--echo # Connection default
+connection default;
+--echo # Sending:
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+--send
+eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
+
+--echo # Connection con1
+connection con1;
+--echo # Wait until CREATE FUNCTION is blocked by GRL
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM information_schema.processlist
+  WHERE state = "Waiting for global read lock";
+--source include/wait_condition.inc
+# Can return different results depending on platform
+--disable_result_log
+SELECT reverse_lookup("127.0.0.1");
+--enable_result_log
+UNLOCK TABLES;
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+--echo # Reaping: CREATE FUNCTION metaphon ...
+--reap
+DROP FUNCTION metaphon;
+DROP FUNCTION reverse_lookup;

=== modified file 'mysql-test/t/user_var.test'
--- a/mysql-test/t/user_var.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/t/user_var.test	2014-04-14 09:20:24 +0000
@@ -487,6 +487,34 @@ DROP TABLE t1;
 
 --echo End of 5.5 tests
 
+#
+# Bug#14058892: Extra rows returned when variable is used in subquery in
+#               ON clause of RIGHT JOIN
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (1), (3), (5), (7), (9);
+
+CREATE TABLE t3(a INT);
+INSERT INTO t3 VALUES (1), (4), (7), (10);
+
+SET @var1 = 6;
+
+let $query=
+SELECT t1.a, t2.a, t3.a, (@var1:= @var1+0) AS var
+FROM t1
+     LEFT JOIN t2 ON t1.a=t2.a AND t2.a < @var1
+     LEFT JOIN t3 ON t1.a=t3.a AND t3.a < @var1;
+
+eval explain $query;
+
+--sorted_result
+eval $query;
+
+DROP TABLE t1, t2, t3;
+
 --echo #
 --echo # Check that used memory extends if we set a variable
 --echo #

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/t/variables.test	2014-04-14 09:20:24 +0000
@@ -1196,6 +1196,22 @@ SET GLOBAL server_id = -1;
 SELECT @@GLOBAL.server_id;
 SET GLOBAL server_id = @old_server_id;
 
+#
+# Bug #42778: delete order by null global variable causes
+#             assertion .\filesort.cc, line 797
+#
+
+SELECT @@GLOBAL.INIT_FILE, @@GLOBAL.INIT_FILE IS NULL;
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ();
+SET @bug42778= @@sql_safe_updates;
+SET @@sql_safe_updates= 0;
+DELETE FROM t1 ORDER BY (@@GLOBAL.INIT_FILE) ASC LIMIT 10;
+SET @@sql_safe_updates= @bug42778;
+
+DROP TABLE t1;
+
 --echo #
 --echo # BUG#10206 - InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback
 --echo #
@@ -1528,3 +1544,23 @@ set session rand_seed1=DEFAULT;
 set autocommit = values(v);
 
 --echo End of 5.5 tests
+
+
+--echo #
+--echo # Bug#57035 'ulonglong sql_mode' stored into ulong, is risky and causes
+--echo #           compiler warning
+--echo #
+
+# Several tests currently use "@@sql_mode= cast(pow(2,32)-1"
+# to activate all SQL modes. This will stop working once
+# someone adds a new flag. The test below is designed to break
+# once this happens to indicate that other tests will have to
+# be updated.
+#
+# The test does this by trying to set sql_mode to the next
+# currently unused flag value and check that this currently fails.
+# Once a new flag is added, this value will become valid and
+# the statement below will succeed.
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@sql_mode= 4294967296;

=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test	2014-02-05 17:23:11 +0000
+++ b/mysql-test/t/view.test	2014-04-14 09:20:24 +0000
@@ -4563,8 +4563,43 @@ disconnect con3;
 
 
 --echo #
---echo # Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
---echo #               NON EXISTING DATABASE
+--echo # Bug#11766440 59546: Assertion m_sp == __null fails in
+--echo # Item_func_sp::init_result_field with functions
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE FUNCTION f1 () RETURNS INTEGER RETURN 1;
+CREATE FUNCTION f2 (i INTEGER) RETURNS INTEGER RETURN 1;
+CREATE VIEW v1 AS SELECT f1() AS a FROM t1;
+CREATE VIEW v2 AS SELECT f2(a) AS a FROM v1;
+DROP FUNCTION f1;
+--error ER_VIEW_INVALID
+SELECT f2(a) FROM v2;
+DROP VIEW v2;
+DROP VIEW v1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#13418197: ASSERTION `(*TABLES)->REGINFO.LOCK_TYPE >=
+--echo #               TL_READ' FAILED | MYSQL_LOCK_TABLES
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TEMPORARY TABLE t1 (a INT);
+CREATE VIEW t1 AS SELECT 1;
+
+DROP VIEW t1;
+DROP TEMPORARY TABLE t1;
+
+
+--echo #
+--echo # Bug#13601606: FAILED VIEW CREATION ERROR MESSAGE (FOR DB NOT PRESENT) 
+--echo #               NEEDS BIG IMPROVEMENT 
 --echo #
 
 --disable_warnings
@@ -4573,6 +4608,84 @@ DROP DATABASE IF EXISTS nodb;
 --error ER_BAD_DB_ERROR
 CREATE VIEW nodb.a AS SELECT 1;
 
+--echo #
+--echo # Bug#13633549 HANDLE_FATAL_SIGNAL IN 
+--echo #              TEST_IF_SKIP_SORT_ORDER/CREATE_SORT_INDEX
+--echo #
+
+CREATE TABLE t1 (
+  pk        INT AUTO_INCREMENT,
+  c_int_key INT,
+  PRIMARY KEY (pk),
+  KEY (c_int_key)
+);
+
+CREATE VIEW v_t1 AS SELECT * FROM t1;
+
+CREATE TABLE t2 (
+  pk              INT auto_increment,
+  c_varchar_600_x VARCHAR(600),
+  c_int_key       INT,
+  c_varchar_600_y VARCHAR(600),
+  c_varchar_600_z VARCHAR(600),
+  PRIMARY KEY (pk),
+  KEY (c_int_key)
+);
+
+CREATE VIEW v_t2 AS SELECT * FROM t2;
+INSERT INTO t2 VALUES
+(
+  NULL,
+  repeat('x', 600),
+  3,
+  repeat('y', 600),
+  repeat('z', 600)
+);
+
+SELECT a1.pk AS f1
+FROM v_t1 AS a1 LEFT JOIN v_t2 AS a2 ON a1.pk=a2.c_int_key
+WHERE 
+  a1.pk > 8
+  OR ((a1.pk BETWEEN 9 AND 13) AND a1.pk = 90)
+ORDER BY f1 ;
+
+DROP TABLE t1, t2;
+DROP VIEW v_t1, v_t2;
+
+--echo #
+--echo # Bug#13783777 CONSTANT PROPAGATION IS WRONG FOR
+--echo #              DISJUNCTIVE PREDICATES IN VIEWS
+--echo #
+
+CREATE TABLE t1 (
+  pk INTEGER,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t1 VALUES (1), (2);
+
+CREATE VIEW v_t1 AS SELECT * FROM t1;
+
+# Query directly against the table (correct result)
+SELECT pk
+FROM t1
+WHERE
+  pk > 8
+  OR ((pk BETWEEN 9 AND 13) AND pk = 90)
+;
+
+# Query against a view (wrong result)
+SELECT pk
+FROM v_t1
+WHERE
+  pk > 8
+  OR ((pk BETWEEN 9 AND 13) AND pk = 90)
+;
+
+DROP VIEW v_t1;
+DROP TABLE t1;
+
+
 # Check that all connections opened by test cases in this file are really
 # gone so execution of other tests won't be affected by their presence.
 --source include/wait_until_count_sessions.inc

=== modified file 'mysql-test/t/wait_timeout.test'
--- a/mysql-test/t/wait_timeout.test	2011-12-08 18:17:49 +0000
+++ b/mysql-test/t/wait_timeout.test	2014-04-14 09:20:24 +0000
@@ -137,6 +137,62 @@ disconnect con1;
 # The last connect is to keep tools checking the current test happy.
 connect (default,localhost,root,,test,,);
 
+--echo #
+--echo # Bug#54790: Use of non-blocking mode for sockets limits performance
+--echo #
+
+--echo #
+--echo # Test UNIX domain sockets timeout.
+--echo #
+
+--echo # Open con1 and set a timeout.
+connect(con1,localhost,root,,);
+
+LET $ID= `SELECT connection_id()`;
+SET @@SESSION.wait_timeout = 2;
+
+--echo # Wait for con1 to be disconnected.
+connection default;
+let $wait_condition=
+  SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST
+  WHERE ID = $ID;
+--source include/wait_condition.inc
+
+--echo # Check that con1 has been disconnected.
+connection con1;
+--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR
+--error 2006,2013
+SELECT 1;
+
+disconnect con1;
+connection default;
+
+--echo #
+--echo # Test TCP/IP sockets timeout.
+--echo #
+
+--echo # Open con1 and set a timeout.
+connect(con1,127.0.0.1,root,,);
+
+LET $ID= `SELECT connection_id()`;
+SET @@SESSION.wait_timeout = 2;
+
+--echo # Wait for con1 to be disconnected.
+connection default;
+let $wait_condition=
+  SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST
+  WHERE ID = $ID;
+--source include/wait_condition.inc
+
+--echo # Check that con1 has been disconnected.
+connection con1;
+--echo # CR_SERVER_LOST, CR_SERVER_GONE_ERROR
+--error 2006,2013
+SELECT 1;
+
+disconnect con1;
+connection default;
+
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 



More information about the commits mailing list