List:Commits« Previous MessageNext Message »
From:Marc Alff Date:April 7 2011 11:03pm
Subject:bzr commit into mysql-trunk branch (marc.alff:3335)
View as plain text  
#At file:///Users/malff/BZR_TREE/mysql-trunk-wl5378/ based on revid:marc.alff@strippedzbs5gu

 3335 Marc Alff	2011-04-08 [merge]
      Merge myql-trunk --> myql-trunk-wl5378

    modified:
      mysql-test/extra/rpl_tests/rpl_extra_col_master.test
      mysql-test/include/mix1.inc
      mysql-test/include/mtr_warnings.sql
      mysql-test/include/order_by.inc
      mysql-test/include/subquery_mat.inc
      mysql-test/lib/mtr_misc.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/innodb_mysql_lock.result
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/lowercase_table2.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/order_by_all.result
      mysql-test/r/order_by_icp_mrr.result
      mysql-test/r/order_by_none.result
      mysql-test/r/plugin_auth.result
      mysql-test/r/show_check.result
      mysql-test/r/sp-destruct.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_mat.result
      mysql-test/r/subquery_mat_all.result
      mysql-test/r/subquery_mat_none.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
      mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
      mysql-test/t/innodb_mysql_lock.test
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/lowercase_table2.test
      mysql-test/t/plugin_auth.test
      mysql-test/t/show_check.test
      mysql-test/t/sp-destruct.test
      scripts/mysql_system_tables_fix.sql
      sql/item.cc
      sql/opt_range.cc
      sql/sql_join_cache.cc
      sql/sql_select.cc
      sql/sql_show.cc
      sql/sql_update.cc
      storage/innobase/handler/ha_innodb.cc
=== modified file 'mysql-test/extra/rpl_tests/rpl_extra_col_master.test'
--- a/mysql-test/extra/rpl_tests/rpl_extra_col_master.test	2011-02-23 20:01:27 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test	2011-03-31 13:52:53 +0000
@@ -122,11 +122,13 @@ SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
 
 #connection slave;
 
+--disable_query_log
 call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
-call mtr.add_suppression("Slave SQL.*Error .Can.t DROP .c7.; check that column.key exists. on query.* 1091");
-call mtr.add_suppression("Slave SQL.*Error .Unknown column .c7. in .t15.. on query.* 1054");
-call mtr.add_suppression("Slave SQL.*Error .Key column .c6. doesn.t exist in table. on query.* 1072");
+call mtr.add_suppression("Slave.*Can.t DROP .c7.; check that column.key exists.* Error_code: 1091");
+call mtr.add_suppression("Slave.*Unknown column .c7. in .t15.* Error_code: 1054");
+call mtr.add_suppression("Slave.*Key column .c6. doesn.t exist in table.* Error_code: 1072");
 call mtr.add_suppression("Slave SQL.*Column 2 of table .test.t1.. cannot be converted from type.* Error_code: 1677");
+--enable_query_log
 
 sync_slave_with_master;
 --echo

=== modified file 'mysql-test/include/mix1.inc'
--- a/mysql-test/include/mix1.inc	2010-12-10 09:27:55 +0000
+++ b/mysql-test/include/mix1.inc	2011-03-30 13:33:29 +0000
@@ -634,6 +634,10 @@ drop table t1;
 drop table bug29807;
 create table bug29807 (a int);
 drop table bug29807;
+--disable_query_log
+call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal");
+call mtr.add_suppression("Cannot find or open table test\/bug29807 from");
+--enable_query_log
 
 
 #

=== modified file 'mysql-test/include/mtr_warnings.sql'
--- a/mysql-test/include/mtr_warnings.sql	2011-04-05 16:46:24 +0000
+++ b/mysql-test/include/mtr_warnings.sql	2011-04-06 10:36:10 +0000
@@ -71,7 +71,7 @@ SET @@collation_connection = @collation_
 -- Insert patterns that should always be suppressed
 --
 INSERT INTO global_suppressions VALUES
- ("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"),
+ (".SELECT UNIX_TIMESTAMP... failed on master"),
  ("Aborted connection"),
  ("Client requested master to start replication from impossible position"),
  ("Could not find first log file name in binary log"),
@@ -128,7 +128,6 @@ INSERT INTO global_suppressions VALUES
  ("Sort aborted"),
  ("Time-out in NDB"),
  ("Warning:\s+One can only use the --user.*root"),
- ("Warning:\s+Setting lower_case_table_names=2"),
  ("Warning:\s+Table:.* on (delete|rename)"),
  ("You have an error in your SQL syntax"),
  ("deprecated"),
@@ -141,59 +140,25 @@ INSERT INTO global_suppressions VALUES
  ("slave SQL thread aborted"),
  ("Slave: .*Duplicate entry"),
 
- /*
-   Special case, made as specific as possible, for:
-   Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
-   server coredump
- */
-
- ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
-
  ("Statement may not be safe to log in statement format"),
 
- /* test case for Bug#bug29807 copies a stray frm into database */
- ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
- ("Cannot find or open table test\/bug29807 from"),
-
  /* innodb foreign key tests that fail in ALTER or RENAME produce this */
  ("InnoDB: Error: in ALTER TABLE `test`.`t[123]`"),
  ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
  ("InnoDB: Error: table `test`.`t[123]` does not exist in the InnoDB internal"),
 
- /* Test case for Bug#14233 produces the following warnings: */
- ("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"),
- ("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"),
- ("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"),
-
  /*
    BUG#32080 - Excessive warnings on Solaris: setrlimit could not
    change the size of core files
   */
  ("setrlimit could not change the size of core files to 'infinity'"),
 
- /*
-   rpl_extrColmaster_*.test, the slave thread produces warnings
-   when it get updates to a table that has more columns on the
-   master
-  */
- ("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
- ("Slave: Can't DROP 'c7'.* 1091"),
- ("Slave: Key column 'c6'.* 1072"),
  ("The slave I.O thread stops because a fatal error is encountered when it tries to get the value of SERVER_UUID variable from master.*"),
  ("The initialization command '.*' failed with the following error.*"),
- ("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
- (".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"),
 
  /*It will print a warning if a new UUID of server is generated.*/
  ("No existing UUID has been found, so we assume that this is the first time that this server has been started.*"),
 
- /* Special case for Bug #26402 in show_check.test
-    - Question marks are not valid file name parts on Windows. Ignore
-      this error message.
-  */
- ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"),
- ("Slave: Unknown table 'test.t1' Error_code: 1051"),
-
  /* Added 2009-08-XX after fixing Bug #42408 */
 
  ("Although a path was specified for the .* option, log tables are used"),

=== modified file 'mysql-test/include/order_by.inc'
--- a/mysql-test/include/order_by.inc	2011-02-07 09:46:53 +0000
+++ b/mysql-test/include/order_by.inc	2011-03-30 13:33:29 +0000
@@ -847,8 +847,7 @@ CALL mtr.add_suppression("Out of sort me
 --error ER_OUT_OF_SORTMEMORY
 select * from t1 order by b;
 drop table t1;
-
-
+call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
 --echo #
 --echo # Bug #39844: Query Crash Mysql Server 5.0.67
 --echo #

=== modified file 'mysql-test/include/subquery_mat.inc'
--- a/mysql-test/include/subquery_mat.inc	2011-02-14 11:21:26 +0000
+++ b/mysql-test/include/subquery_mat.inc	2011-04-01 11:06:48 +0000
@@ -847,3 +847,38 @@ eval $query;
 DROP TABLE t1, t2;
 
 --echo # End Bug#59833
+
+--echo #
+--echo # Bug#11852644 - CRASH IN ITEM_REF::SAVE_IN_FIELD ON SELECT DISTINCT
+--echo #
+
+CREATE TABLE t1 (
+  col_varchar_key varchar(1) DEFAULT NULL,
+  col_varchar_nokey varchar(1) DEFAULT NULL,
+  KEY col_varchar_key (col_varchar_key)) 
+;
+
+INSERT INTO t1 VALUES
+('v','v'),('r','r');
+
+CREATE TABLE t2 (
+  col_varchar_key varchar(1) DEFAULT NULL,
+  col_varchar_nokey varchar(1) DEFAULT NULL,
+  KEY col_varchar_key(col_varchar_key)) 
+;
+
+INSERT INTO t2 VALUES
+('r','r'),('c','c');
+
+CREATE VIEW v3 AS SELECT * FROM t2;
+
+SELECT DISTINCT alias2.col_varchar_key 
+FROM t1 AS alias1 JOIN v3 AS alias2 
+ON alias2.col_varchar_key = alias1.col_varchar_key
+HAVING col_varchar_key IN (SELECT col_varchar_nokey FROM t2)
+;
+
+DROP TABLE t1, t2;
+DROP VIEW v3;
+
+--echo # End Bug#11852644

=== modified file 'mysql-test/lib/mtr_misc.pl'
--- a/mysql-test/lib/mtr_misc.pl	2011-01-18 11:09:49 +0000
+++ b/mysql-test/lib/mtr_misc.pl	2011-04-07 08:39:10 +0000
@@ -1,5 +1,5 @@
 # -*- cperl -*-
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Library General Public
@@ -36,6 +36,7 @@ sub start_timer($);
 sub has_expired($);
 sub init_timers();
 sub mark_time_used($);
+sub mark_time_idle();
 sub add_total_times($);
 sub print_times_used($$);
 sub print_total_times($);
@@ -224,6 +225,7 @@ my %time_used= (
   'ch-warn' => 0,
   'test'    => 0,
   'init'    => 0,
+  'admin'   => 0,
 );
 
 my %time_text= (
@@ -232,7 +234,8 @@ my %time_text= (
  'check'   => "Check-testcase",
  'ch-warn' => "Check for warnings",
  'test'    => "Test execution",
- 'init'    => "Initialization etc.",
+ 'init'    => "Initialization/cleanup",
+ 'admin'   => "Test administration",
 );
 
 # Counts number of reports from workers
@@ -255,6 +258,10 @@ sub mark_time_used($) {
   $last_timer_set= $curr_time;
 }
 
+sub mark_time_idle() {
+  $last_timer_set= gettimeofday() if $opt_report_times;
+}
+
 sub add_total_times($) {
   my ($dummy, $num, @line)= split (" ", $_[0]);
 

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-03-23 11:37:04 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-04-07 08:39:10 +0000
@@ -220,9 +220,12 @@ our %gprof_dirs;
 our $glob_debugger= 0;
 our $opt_gdb;
 our $opt_client_gdb;
+our $opt_dbx;
+our $opt_client_dbx;
 our $opt_ddd;
 our $opt_client_ddd;
 our $opt_manual_gdb;
+our $opt_manual_dbx;
 our $opt_manual_ddd;
 our $opt_manual_debug;
 our $opt_debugger;
@@ -547,7 +550,9 @@ sub run_test_server ($$$) {
   my $s= IO::Select->new();
   $s->add($server);
   while (1) {
+    mark_time_used('admin');
     my @ready = $s->can_read(1); # Wake up once every second
+    mark_time_idle();
     foreach my $sock (@ready) {
       if ($sock == $server) {
 	# New client connected
@@ -889,7 +894,7 @@ sub run_worker ($) {
       if ( $opt_gprof ) {
 	gprof_collect (find_mysqld($basedir), keys %gprof_dirs);
       }
-      mark_time_used('init');
+      mark_time_used('admin');
       print_times_used($server, $thread_num);
       exit($valgrind_reports);
     }
@@ -1003,6 +1008,9 @@ sub command_line_setup {
              'ddd'                      => \$opt_ddd,
              'client-ddd'               => \$opt_client_ddd,
              'manual-ddd'               => \$opt_manual_ddd,
+             'dbx'                      => \$opt_dbx,
+	     'client-dbx'               => \$opt_client_dbx,
+	     'manual-dbx'               => \$opt_manual_dbx,
 	     'debugger=s'               => \$opt_debugger,
 	     'client-debugger=s'        => \$opt_client_debugger,
              'strace-client:s'          => \$opt_strace_client,
@@ -1428,6 +1436,12 @@ sub command_line_setup {
       $opt_ddd= undef;
     }
 
+    if ($opt_dbx) {
+      mtr_warning("Silently converting --dbx to --client-dbx in embedded mode");
+      $opt_client_dbx= $opt_dbx;
+      $opt_dbx= undef;
+    }
+
     if ($opt_debugger)
     {
       mtr_warning("Silently converting --debugger to --client-debugger in embedded mode");
@@ -1436,7 +1450,7 @@ sub command_line_setup {
     }
 
     if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_ddd ||
-	 $opt_manual_debug || $opt_debugger )
+	 $opt_manual_debug || $opt_debugger || $opt_dbx || $opt_manual_dbx)
     {
       mtr_error("You need to use the client debug options for the",
 		"embedded server. Ex: --client-gdb");
@@ -1464,6 +1478,7 @@ sub command_line_setup {
   # --------------------------------------------------------------------------
   if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
        $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
+       $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
        $opt_debugger || $opt_client_debugger )
   {
     # Indicate that we are using debugger
@@ -3764,7 +3779,7 @@ sub run_testcase ($) {
 
   do_before_run_mysqltest($tinfo);
 
-  mark_time_used('init');
+  mark_time_used('admin');
 
   if ( $opt_check_testcases and check_testcase($tinfo, "before") ){
     # Failed to record state of server or server crashed
@@ -4706,6 +4721,9 @@ sub mysqld_start ($$) {
   {
     ddd_arguments(\$args, \$exe, $mysqld->name());
   }
+  if ( $opt_dbx || $opt_manual_dbx ) {
+    dbx_arguments(\$args, \$exe, $mysqld->name());
+  }
   elsif ( $opt_debugger )
   {
     debugger_arguments(\$args, \$exe, $mysqld->name());
@@ -5257,7 +5275,7 @@ sub start_mysqltest ($) {
   my $exe= $exe_mysqltest;
   my $args;
 
-  mark_time_used('init');
+  mark_time_used('admin');
 
   mtr_init_args(\$args);
 
@@ -5404,6 +5422,9 @@ sub start_mysqltest ($) {
   {
     ddd_arguments(\$args, \$exe, "client");
   }
+  if ( $opt_client_dbx ) {
+    dbx_arguments(\$args, \$exe, "client");
+  }
   elsif ( $opt_client_debugger )
   {
     debugger_arguments(\$args, \$exe, "client");
@@ -5438,23 +5459,11 @@ sub gdb_arguments {
   # Remove the old gdbinit file
   unlink($gdb_init_file);
 
-  if ( $type eq "client" )
-  {
-    # write init file for client
-    mtr_tofile($gdb_init_file,
-	       "set args $str\n" .
-	       "break main\n");
-  }
-  else
-  {
-    # write init file for mysqld
-    mtr_tofile($gdb_init_file,
-	       "set args $str\n" .
-	       "break mysql_parse\n" .
-	       "commands 1\n" .
-	       "disable 1\n" .
-	       "end\n");
-  }
+  # write init file for mysqld or client
+  mtr_tofile($gdb_init_file,
+	     "set args $str\n" .
+	     "break main\n" .
+	     "run");
 
   if ( $opt_manual_gdb )
   {
@@ -5501,24 +5510,12 @@ sub ddd_arguments {
   # Remove the old gdbinit file
   unlink($gdb_init_file);
 
-  if ( $type eq "client" )
-  {
-    # write init file for client
-    mtr_tofile($gdb_init_file,
-	       "set args $str\n" .
-	       "break main\n");
-  }
-  else
-  {
-    # write init file for mysqld
-    mtr_tofile($gdb_init_file,
-	       "file ../sql/mysqld\n" .
-	       "set args $str\n" .
-	       "break mysql_parse\n" .
-	       "commands 1\n" .
-	       "disable 1\n" .
-	       "end");
-  }
+  # write init file for mysqld or client
+  mtr_tofile($gdb_init_file,
+	     "file $$exe\n" .
+	     "set args $str\n" .
+	     "break main\n" .
+	     "run");
 
   if ( $opt_manual_ddd )
   {
@@ -5548,6 +5545,46 @@ sub ddd_arguments {
 
 
 #
+# Modify the exe and args so that program is run in dbx in xterm
+#
+sub dbx_arguments {
+  my $args= shift;
+  my $exe=  shift;
+  my $type= shift;
+
+  # Put $args into a single string
+  my $str= join " ", @$$args;
+
+  if ( $opt_manual_dbx ) {
+    print "\nTo start dbx for $type, type in another window:\n";
+    print "cd $glob_mysql_test_dir; dbx -c \"stop in main; " .
+          "run $str\" $$exe\n";
+
+    # Indicate the exe should not be started
+    $$exe= undef;
+    return;
+  }
+
+  $$args= [];
+  mtr_add_arg($$args, "-title");
+  mtr_add_arg($$args, "$type");
+  mtr_add_arg($$args, "-e");
+
+  if ( $exe_libtool ) {
+    mtr_add_arg($$args, $exe_libtool);
+    mtr_add_arg($$args, "--mode=execute");
+  }
+
+  mtr_add_arg($$args, "dbx");
+  mtr_add_arg($$args, "-c");
+  mtr_add_arg($$args, "stop in main; run $str");
+  mtr_add_arg($$args, "$$exe");
+
+  $$exe= "xterm";
+}
+
+
+#
 # Modify the exe and args so that program is run in the selected debugger
 #
 sub debugger_arguments {
@@ -5578,18 +5615,6 @@ sub debugger_arguments {
     $$exe= $debugger;
 
   }
-  elsif ( $debugger eq "dbx" )
-  {
-    # xterm -e dbx -r exe arg1 .. argn
-
-    unshift(@$$args, $$exe);
-    unshift(@$$args, "-r");
-    unshift(@$$args, $debugger);
-    unshift(@$$args, "-e");
-
-    $$exe= "xterm";
-
-  }
   else
   {
     mtr_error("Unknown argument \"$debugger\" passed to --debugger");
@@ -5891,6 +5916,7 @@ Options for debugging the product
   client-ddd            Start mysqltest client in ddd
   client-debugger=NAME  Start mysqltest in the selected debugger
   client-gdb            Start mysqltest client in gdb
+  client-dbx            Start mysqltest client in dbx
   ddd                   Start mysqld in ddd
   debug                 Dump trace output for all servers and client programs
   debug-common          Same as debug, but sets 'd' debug flags to
@@ -5899,12 +5925,15 @@ Options for debugging the product
                         tracing
   debugger=NAME         Start mysqld in the selected debugger
   gdb                   Start the mysqld(s) in gdb
+  dbx                   Start the mysqld(s) in dbx
   manual-debug          Let user manually start mysqld in debugger, before
                         running test(s)
   manual-gdb            Let user manually start mysqld in gdb, before running
                         test(s)
   manual-ddd            Let user manually start mysqld in ddd, before running
                         test(s)
+  manual-dbx            Let user manually start mysqld in dbx, before running
+                        test(s)
   strace-client[=path]  Create strace output for mysqltest client, optionally
                         specifying name and path to the trace program to use.
                         Example: $0 --strace-client=ktrace

=== modified file 'mysql-test/r/innodb_icp_all.result'
--- a/mysql-test/r/innodb_icp_all.result	2011-03-21 07:13:12 +0000
+++ b/mysql-test/r/innodb_icp_all.result	2011-03-29 08:10:26 +0000
@@ -776,5 +776,100 @@ Warning	1364	Field 'COL1000' doesn't hav
 SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003 <=> sysdate();
 col999
 DROP TABLE t1;
+#
+# Bug#11873324 "WRONG RESULT WITH ICP AND STRAIGHT_JOIN"
+#
+CREATE TABLE t1 (  
+pk INTEGER NOT NULL,
+i1 INTEGER,
+PRIMARY KEY (pk),
+KEY col_int_key (i1)
+);
+INSERT INTO t1 VALUES (14,NULL), (18,133);
+CREATE TABLE t2 (  
+pk INTEGER NOT NULL,
+i1 INTEGER,
+c1 VARCHAR(1),
+PRIMARY KEY (pk),
+KEY col_int_key (i1)
+);
+INSERT INTO t2 VALUES (1,7,'f');
+EXPLAIN SELECT t1.i1
+FROM t1
+WHERE t1.i1 NOT IN
+( SELECT STRAIGHT_JOIN SUBQUERY_t1.pk
+FROM t1 AS SUBQUERY_t1
+JOIN t2 AS SUBQUERY_t2
+ON SUBQUERY_t2.i1 = SUBQUERY_t1.pk
+WHERE SUBQUERY_t1.i1 > 0
+OR SUBQUERY_t2.c1 = 'a'
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	NULL	col_int_key	5	NULL	2	Using where; Using index
+2	DEPENDENT SUBQUERY	SUBQUERY_t1	eq_ref	PRIMARY,col_int_key	PRIMARY	4	func	1	Using where; Full scan on NULL key
+2	DEPENDENT SUBQUERY	SUBQUERY_t2	ref	col_int_key	col_int_key	5	func	1	Using where; Full scan on NULL key
+SELECT t1.i1
+FROM t1
+WHERE t1.i1 NOT IN
+( SELECT STRAIGHT_JOIN SUBQUERY_t1.pk
+FROM t1 AS SUBQUERY_t1
+JOIN t2 AS SUBQUERY_t2
+ON SUBQUERY_t2.i1 = SUBQUERY_t1.pk
+WHERE SUBQUERY_t1.i1 > 0
+OR SUBQUERY_t2.c1 = 'a'
+);
+i1
+NULL
+133
+DROP TABLE t1,t2;
+#
+# Bug#11876420 "MISSING ROW IN RESULT WITH SUBQUERY + IN + XOR + 
+#               NULL VALUES AND ICP ENABLED"
+# 
+CREATE TABLE t1 (  
+i1 INTEGER,
+c1 VARCHAR(1),
+KEY col_varchar_key (c1)
+);
+INSERT INTO t1 VALUES (1,'j'), (0,'e'), (210,'f'), (8,'v'), (7,'x'),
+(5,'m'), (NULL,'c');
+CREATE TABLE t2 (  
+i1 INTEGER,
+c1 VARCHAR(1),
+KEY col_varchar_key (c1)
+);
+INSERT INTO t2 VALUES (8,NULL);
+CREATE TABLE t3 (  
+i1 INTEGER,
+c1 VARCHAR(1),
+KEY col_varchar_key (c1)
+) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (NULL,'w'), (1,NULL), (2,'d');
+EXPLAIN SELECT i1
+FROM t3
+WHERE c1 IN
+( SELECT t1.c1
+FROM t2 JOIN t1
+ON t2.i1 >= t1.i1
+WHERE t1.c1 > t2.c1
+)
+XOR i1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where
+2	DEPENDENT SUBQUERY	t2	ALL	col_varchar_key	NULL	NULL	NULL	1	
+2	DEPENDENT SUBQUERY	t1	ref_or_null	col_varchar_key	col_varchar_key	4	func	2	Using where; Full scan on NULL key
+SELECT i1
+FROM t3
+WHERE c1 IN
+( SELECT t1.c1
+FROM t2 JOIN t1
+ON t2.i1 >= t1.i1
+WHERE t1.c1 > t2.c1
+)
+XOR i1;
+i1
+1
+2
+DROP TABLE t1, t2, t3;
 set default_storage_engine= @save_storage_engine;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/innodb_mysql_lock.result'
--- a/mysql-test/r/innodb_mysql_lock.result	2010-06-26 20:23:28 +0000
+++ b/mysql-test/r/innodb_mysql_lock.result	2011-03-09 15:06:13 +0000
@@ -148,3 +148,25 @@ COMMIT;
 # Connection default
 DROP TABLE t1, t2;
 DROP VIEW v1;
+#
+# Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
+#              KEY NO 0 FOR TABLE IN ERROR LOG 
+#
+DROP TABLE IF EXISTS t1;
+# Connection default
+CREATE TABLE t1 (id INT PRIMARY KEY, value INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1, 12345);
+START TRANSACTION;
+SELECT * FROM t1;
+id	value
+1	12345
+# Connection con1
+SET lock_wait_timeout=1;
+ALTER TABLE t1 ADD INDEX idx(value);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection default
+SELECT * FROM t1;
+id	value
+1	12345
+COMMIT;
+DROP TABLE t1;

=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result	2011-03-07 13:30:49 +0000
+++ b/mysql-test/r/innodb_mysql_sync.result	2011-04-07 09:41:20 +0000
@@ -94,74 +94,6 @@ SET DEBUG_SYNC= 'RESET';
 # Bug#42230 during add index, cannot do queries on storage engines
 #           that implement add_index
 #
-DROP DATABASE IF EXISTS db1;
-DROP TABLE IF EXISTS t1;
-# Test 1: Secondary index, should not block reads (original test case).
-# Connection default
-CREATE DATABASE db1;
-CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
-INSERT INTO db1.t1(value) VALUES (1), (2);
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
-# Sending:
-ALTER TABLE db1.t1 ADD INDEX(value);
-# Connection con1
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-USE db1;
-SELECT * FROM t1;
-id	value
-1	1
-2	2
-SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
-# Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
-DROP DATABASE db1;
-# Test 2: Primary index (implicit), should block reads.
-CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
-# Sending:
-ALTER TABLE t1 ADD UNIQUE INDEX(a);
-# Connection con1
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-USE test;
-# Sending:
-SELECT * FROM t1;
-# Connection con2
-# Waiting for SELECT to be blocked by the metadata lock on t1
-SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
-# Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
-# Connection con1
-# Reaping: SELECT * FROM t1
-a	b
-# Test 3: Primary index (explicit), should block reads.
-# Connection default
-ALTER TABLE t1 DROP INDEX a;
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
-# Sending:
-ALTER TABLE t1 ADD PRIMARY KEY (a);
-# Connection con1
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-# Sending:
-SELECT * FROM t1;
-# Connection con2
-# Waiting for SELECT to be blocked by the metadata lock on t1
-SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
-# Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
-# Connection con1
-# Reaping: SELECT * FROM t1
-a	b
-# Test 4: Secondary unique index, should not block reads.
-# Connection default
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
-# Sending:
-ALTER TABLE t1 ADD UNIQUE (b);
-# Connection con1
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-SELECT * FROM t1;
-a	b
-SET DEBUG_SYNC= "now SIGNAL query";
-# Connection default
-# Reaping: ALTER TABLE t1 ADD UNIQUE (b)
-SET DEBUG_SYNC= "RESET";
-DROP TABLE t1;
+#
+# DISABLED due to Bug#11815600
+#

=== modified file 'mysql-test/r/lowercase_table2.result'
--- a/mysql-test/r/lowercase_table2.result	2010-07-21 15:20:29 +0000
+++ b/mysql-test/r/lowercase_table2.result	2011-04-06 15:11:43 +0000
@@ -175,6 +175,35 @@ TABLE_SCHEMA	TABLE_NAME
 mysqltest_lc2	myUC
 use test;
 drop database mysqltest_LC2;
+#
+# Bug #11758687: 50924: object names not resolved correctly 
+#   on lctn2 systems
+#
+CREATE DATABASE BUP_XPFM_COMPAT_DB2;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.TABLE2 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.table1 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE bup_xpfm_compat_db2.table3 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.trigger1 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.table1 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TRIGGER2 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.TABLE2 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TrigGer3 AFTER INSERT
+ON BUP_XPFM_COMPAT_DB2.TaBle3 FOR EACH ROW
+update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+SELECT trigger_schema, trigger_name, event_object_table FROM
+INFORMATION_SCHEMA.TRIGGERS
+WHERE trigger_schema COLLATE utf8_bin = 'BUP_XPFM_COMPAT_DB2'
+  ORDER BY trigger_schema, trigger_name;
+trigger_schema	trigger_name	event_object_table
+BUP_XPFM_COMPAT_DB2	trigger1	table1
+BUP_XPFM_COMPAT_DB2	TRIGGER2	TABLE2
+BUP_XPFM_COMPAT_DB2	TrigGer3	table3
+DROP DATABASE BUP_XPFM_COMPAT_DB2;
 # End of 5.1 tests
 #
 # Test for bug #44738 "fill_schema_table_from_frm() opens tables without

=== modified file 'mysql-test/r/myisam_icp_all.result'
--- a/mysql-test/r/myisam_icp_all.result	2011-03-21 07:13:12 +0000
+++ b/mysql-test/r/myisam_icp_all.result	2011-03-29 08:10:26 +0000
@@ -774,4 +774,98 @@ Warning	1364	Field 'COL1000' doesn't hav
 SELECT col999 FROM t1 WHERE col1000 = "3" AND col1003 <=> sysdate();
 col999
 DROP TABLE t1;
+#
+# Bug#11873324 "WRONG RESULT WITH ICP AND STRAIGHT_JOIN"
+#
+CREATE TABLE t1 (  
+pk INTEGER NOT NULL,
+i1 INTEGER,
+PRIMARY KEY (pk),
+KEY col_int_key (i1)
+);
+INSERT INTO t1 VALUES (14,NULL), (18,133);
+CREATE TABLE t2 (  
+pk INTEGER NOT NULL,
+i1 INTEGER,
+c1 VARCHAR(1),
+PRIMARY KEY (pk),
+KEY col_int_key (i1)
+);
+INSERT INTO t2 VALUES (1,7,'f');
+EXPLAIN SELECT t1.i1
+FROM t1
+WHERE t1.i1 NOT IN
+( SELECT STRAIGHT_JOIN SUBQUERY_t1.pk
+FROM t1 AS SUBQUERY_t1
+JOIN t2 AS SUBQUERY_t2
+ON SUBQUERY_t2.i1 = SUBQUERY_t1.pk
+WHERE SUBQUERY_t1.i1 > 0
+OR SUBQUERY_t2.c1 = 'a'
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	NULL	col_int_key	5	NULL	2	Using where; Using index
+2	DEPENDENT SUBQUERY	SUBQUERY_t1	eq_ref	PRIMARY,col_int_key	PRIMARY	4	func	1	Using where; Full scan on NULL key
+2	DEPENDENT SUBQUERY	SUBQUERY_t2	ALL	col_int_key	NULL	NULL	NULL	1	Using where; Using join buffer (BNL, incremental buffers)
+SELECT t1.i1
+FROM t1
+WHERE t1.i1 NOT IN
+( SELECT STRAIGHT_JOIN SUBQUERY_t1.pk
+FROM t1 AS SUBQUERY_t1
+JOIN t2 AS SUBQUERY_t2
+ON SUBQUERY_t2.i1 = SUBQUERY_t1.pk
+WHERE SUBQUERY_t1.i1 > 0
+OR SUBQUERY_t2.c1 = 'a'
+);
+i1
+NULL
+133
+DROP TABLE t1,t2;
+#
+# Bug#11876420 "MISSING ROW IN RESULT WITH SUBQUERY + IN + XOR + 
+#               NULL VALUES AND ICP ENABLED"
+# 
+CREATE TABLE t1 (  
+i1 INTEGER,
+c1 VARCHAR(1),
+KEY col_varchar_key (c1)
+);
+INSERT INTO t1 VALUES (1,'j'), (0,'e'), (210,'f'), (8,'v'), (7,'x'),
+(5,'m'), (NULL,'c');
+CREATE TABLE t2 (  
+i1 INTEGER,
+c1 VARCHAR(1),
+KEY col_varchar_key (c1)
+);
+INSERT INTO t2 VALUES (8,NULL);
+CREATE TABLE t3 (  
+i1 INTEGER,
+c1 VARCHAR(1),
+KEY col_varchar_key (c1)
+) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (NULL,'w'), (1,NULL), (2,'d');
+EXPLAIN SELECT i1
+FROM t3
+WHERE c1 IN
+( SELECT t1.c1
+FROM t2 JOIN t1
+ON t2.i1 >= t1.i1
+WHERE t1.c1 > t2.c1
+)
+XOR i1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where
+2	DEPENDENT SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT i1
+FROM t3
+WHERE c1 IN
+( SELECT t1.c1
+FROM t2 JOIN t1
+ON t2.i1 >= t1.i1
+WHERE t1.c1 > t2.c1
+)
+XOR i1;
+i1
+1
+2
+DROP TABLE t1, t2, t3;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/order_by_all.result'
--- a/mysql-test/r/order_by_all.result	2011-02-07 09:46:53 +0000
+++ b/mysql-test/r/order_by_all.result	2011-03-30 13:33:29 +0000
@@ -1430,6 +1430,7 @@ CALL mtr.add_suppression("Out of sort me
 select * from t1 order by b;
 ERROR HY001: Out of sort memory, consider increasing server sort buffer size
 drop table t1;
+call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
 #
 # Bug #39844: Query Crash Mysql Server 5.0.67
 #

=== modified file 'mysql-test/r/order_by_icp_mrr.result'
--- a/mysql-test/r/order_by_icp_mrr.result	2011-04-01 14:04:52 +0000
+++ b/mysql-test/r/order_by_icp_mrr.result	2011-04-05 13:28:34 +0000
@@ -1430,6 +1430,7 @@ CALL mtr.add_suppression("Out of sort me
 select * from t1 order by b;
 ERROR HY001: Out of sort memory, consider increasing server sort buffer size
 drop table t1;
+call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
 #
 # Bug #39844: Query Crash Mysql Server 5.0.67
 #

=== modified file 'mysql-test/r/order_by_none.result'
--- a/mysql-test/r/order_by_none.result	2011-04-01 14:04:52 +0000
+++ b/mysql-test/r/order_by_none.result	2011-04-05 13:28:34 +0000
@@ -1429,6 +1429,7 @@ CALL mtr.add_suppression("Out of sort me
 select * from t1 order by b;
 ERROR HY001: Out of sort memory, consider increasing server sort buffer size
 drop table t1;
+call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
 #
 # Bug #39844: Query Crash Mysql Server 5.0.67
 #

=== modified file 'mysql-test/r/plugin_auth.result'
--- a/mysql-test/r/plugin_auth.result	2011-03-18 14:58:27 +0000
+++ b/mysql-test/r/plugin_auth.result	2011-04-07 09:55:09 +0000
@@ -403,4 +403,53 @@ ORDER BY COLUMN_NAME;
 IS_NULLABLE	COLUMN_NAME
 YES	authentication_string
 YES	plugin
+#
+# Bug #11936829: diff. between mysql.user (authentication_string) 
+#   in fresh and upgraded 5.5.11
+#
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
+WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
+COLUMN_NAME IN ('plugin', 'authentication_string')
+ORDER BY COLUMN_NAME;
+IS_NULLABLE	COLUMN_NAME
+YES	authentication_string
+YES	plugin
+ALTER TABLE mysql.user MODIFY plugin char(64) DEFAULT '' NOT NULL;
+ALTER TABLE mysql.user MODIFY authentication_string TEXT NOT NULL;
+Run mysql_upgrade on a 5.5.10 external authentication column layout
+mtr.global_suppressions                            OK
+mtr.test_suppressions                              OK
+mysql.columns_priv                                 OK
+mysql.db                                           OK
+mysql.event                                        OK
+mysql.func                                         OK
+mysql.general_log                                  OK
+mysql.help_category                                OK
+mysql.help_keyword                                 OK
+mysql.help_relation                                OK
+mysql.help_topic                                   OK
+mysql.host                                         OK
+mysql.ndb_binlog_index                             OK
+mysql.plugin                                       OK
+mysql.proc                                         OK
+mysql.procs_priv                                   OK
+mysql.proxies_priv                                 OK
+mysql.servers                                      OK
+mysql.slave_master_info                            OK
+mysql.slave_relay_log_info                         OK
+mysql.slow_log                                     OK
+mysql.tables_priv                                  OK
+mysql.time_zone                                    OK
+mysql.time_zone_leap_second                        OK
+mysql.time_zone_name                               OK
+mysql.time_zone_transition                         OK
+mysql.time_zone_transition_type                    OK
+mysql.user                                         OK
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
+WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
+COLUMN_NAME IN ('plugin', 'authentication_string')
+ORDER BY COLUMN_NAME;
+IS_NULLABLE	COLUMN_NAME
+YES	authentication_string
+YES	plugin
 End of 5.5 tests

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2011-01-18 13:09:35 +0000
+++ b/mysql-test/r/show_check.result	2011-03-30 13:33:29 +0000
@@ -1338,6 +1338,7 @@ Name	Engine	Version	Row_format	Rows	Avg_
 DROP DATABASE `�
 show columns from `#mysql50#????????`;
 Got one of the listed errors
+call mtr.add_suppression("Can.t find file: '.\\\\test\\\\\\?{8}.frm'");
 DROP TABLE IF EXISTS t1;
 DROP PROCEDURE IF EXISTS p1;
 CREATE TABLE t1(c1 INT);

=== modified file 'mysql-test/r/sp-destruct.result'
--- a/mysql-test/r/sp-destruct.result	2010-12-16 18:18:20 +0000
+++ b/mysql-test/r/sp-destruct.result	2011-03-30 13:33:29 +0000
@@ -1,4 +1,5 @@
 call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted");
+call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc");
 use test;
 drop procedure if exists bug14233;
 drop function if exists bug14233;

=== modified file 'mysql-test/r/subquery_all.result'
--- a/mysql-test/r/subquery_all.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/subquery_all.result	2011-03-29 08:10:26 +0000
@@ -4923,7 +4923,7 @@ WHERE t3.name='xxx' AND t2.id=t3.id);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	4	Using where
 2	DEPENDENT SUBQUERY	t2	eq_ref	PRIMARY	PRIMARY	4	func	1	Using where; Using index; Full scan on NULL key
-2	DEPENDENT SUBQUERY	t3	eq_ref	PRIMARY	PRIMARY	4	func	1	Using index condition; Using where; Full scan on NULL key
+2	DEPENDENT SUBQUERY	t3	eq_ref	PRIMARY	PRIMARY	4	func	1	Using where; Full scan on NULL key
 SELECT * FROM t1
 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 
 WHERE t3.name='xxx' AND t2.id=t3.id);

=== modified file 'mysql-test/r/subquery_all_jcl6.result'
--- a/mysql-test/r/subquery_all_jcl6.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/subquery_all_jcl6.result	2011-03-29 08:10:26 +0000
@@ -4927,7 +4927,7 @@ WHERE t3.name='xxx' AND t2.id=t3.id);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	4	Using where
 2	DEPENDENT SUBQUERY	t2	eq_ref	PRIMARY	PRIMARY	4	func	1	Using where; Using index; Full scan on NULL key
-2	DEPENDENT SUBQUERY	t3	eq_ref	PRIMARY	PRIMARY	4	func	1	Using index condition; Using where; Full scan on NULL key; Using join buffer (BKA, incremental buffers)
+2	DEPENDENT SUBQUERY	t3	eq_ref	PRIMARY	PRIMARY	4	func	1	Using where; Full scan on NULL key; Using join buffer (BKA, incremental buffers)
 SELECT * FROM t1
 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 
 WHERE t3.name='xxx' AND t2.id=t3.id);

=== modified file 'mysql-test/r/subquery_mat.result'
--- a/mysql-test/r/subquery_mat.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/subquery_mat.result	2011-04-01 11:06:48 +0000
@@ -1124,4 +1124,32 @@ WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORD
 f1	pk	pk
 DROP TABLE t1, t2;
 # End Bug#59833
+#
+# Bug#11852644 - CRASH IN ITEM_REF::SAVE_IN_FIELD ON SELECT DISTINCT
+#
+CREATE TABLE t1 (
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_varchar_key (col_varchar_key)) 
+;
+INSERT INTO t1 VALUES
+('v','v'),('r','r');
+CREATE TABLE t2 (
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_varchar_key(col_varchar_key)) 
+;
+INSERT INTO t2 VALUES
+('r','r'),('c','c');
+CREATE VIEW v3 AS SELECT * FROM t2;
+SELECT DISTINCT alias2.col_varchar_key 
+FROM t1 AS alias1 JOIN v3 AS alias2 
+ON alias2.col_varchar_key = alias1.col_varchar_key
+HAVING col_varchar_key IN (SELECT col_varchar_nokey FROM t2)
+;
+col_varchar_key
+r
+DROP TABLE t1, t2;
+DROP VIEW v3;
+# End Bug#11852644
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_mat_all.result'
--- a/mysql-test/r/subquery_mat_all.result	2011-03-17 11:23:06 +0000
+++ b/mysql-test/r/subquery_mat_all.result	2011-04-01 11:06:48 +0000
@@ -1123,4 +1123,32 @@ WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORD
 f1	pk	pk
 DROP TABLE t1, t2;
 # End Bug#59833
+#
+# Bug#11852644 - CRASH IN ITEM_REF::SAVE_IN_FIELD ON SELECT DISTINCT
+#
+CREATE TABLE t1 (
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_varchar_key (col_varchar_key)) 
+;
+INSERT INTO t1 VALUES
+('v','v'),('r','r');
+CREATE TABLE t2 (
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_varchar_key(col_varchar_key)) 
+;
+INSERT INTO t2 VALUES
+('r','r'),('c','c');
+CREATE VIEW v3 AS SELECT * FROM t2;
+SELECT DISTINCT alias2.col_varchar_key 
+FROM t1 AS alias1 JOIN v3 AS alias2 
+ON alias2.col_varchar_key = alias1.col_varchar_key
+HAVING col_varchar_key IN (SELECT col_varchar_nokey FROM t2)
+;
+col_varchar_key
+r
+DROP TABLE t1, t2;
+DROP VIEW v3;
+# End Bug#11852644
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_mat_none.result'
--- a/mysql-test/r/subquery_mat_none.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/subquery_mat_none.result	2011-04-01 11:06:48 +0000
@@ -1122,4 +1122,32 @@ WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORD
 f1	pk	pk
 DROP TABLE t1, t2;
 # End Bug#59833
+#
+# Bug#11852644 - CRASH IN ITEM_REF::SAVE_IN_FIELD ON SELECT DISTINCT
+#
+CREATE TABLE t1 (
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_varchar_key (col_varchar_key)) 
+;
+INSERT INTO t1 VALUES
+('v','v'),('r','r');
+CREATE TABLE t2 (
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+KEY col_varchar_key(col_varchar_key)) 
+;
+INSERT INTO t2 VALUES
+('r','r'),('c','c');
+CREATE VIEW v3 AS SELECT * FROM t2;
+SELECT DISTINCT alias2.col_varchar_key 
+FROM t1 AS alias1 JOIN v3 AS alias2 
+ON alias2.col_varchar_key = alias1.col_varchar_key
+HAVING col_varchar_key IN (SELECT col_varchar_nokey FROM t2)
+;
+col_varchar_key
+r
+DROP TABLE t1, t2;
+DROP VIEW v3;
+# End Bug#11852644
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_nomat_nosj_jcl6.result'
--- a/mysql-test/r/subquery_nomat_nosj_jcl6.result	2011-02-14 11:21:26 +0000
+++ b/mysql-test/r/subquery_nomat_nosj_jcl6.result	2011-03-29 08:10:26 +0000
@@ -4927,7 +4927,7 @@ WHERE t3.name='xxx' AND t2.id=t3.id);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	4	Using where
 2	DEPENDENT SUBQUERY	t2	eq_ref	PRIMARY	PRIMARY	4	func	1	Using where; Using index; Full scan on NULL key
-2	DEPENDENT SUBQUERY	t3	eq_ref	PRIMARY	PRIMARY	4	func	1	Using index condition; Using where; Full scan on NULL key; Using join buffer (BKA, incremental buffers)
+2	DEPENDENT SUBQUERY	t3	eq_ref	PRIMARY	PRIMARY	4	func	1	Using where; Full scan on NULL key; Using join buffer (BKA, incremental buffers)
 SELECT * FROM t1
 WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3 
 WHERE t3.name='xxx' AND t2.id=t3.id);

=== modified file 'mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result	2011-03-31 08:39:55 +0000
@@ -57,11 +57,6 @@ f1	f2	f3	f4	f5	f6	f7	f8	f9	hex(f10)	hex(
 27	27	27	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
 29	29	29	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
 30	30	30	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
-call mtr.add_suppression("Slave SQL.*Error .Can.t DROP .c7.; check that column.key exists. on query.* 1091");
-call mtr.add_suppression("Slave SQL.*Error .Unknown column .c7. in .t15.. on query.* 1054");
-call mtr.add_suppression("Slave SQL.*Error .Key column .c6. doesn.t exist in table. on query.* 1072");
-call mtr.add_suppression("Slave SQL.*Column 2 of table .test.t1.. cannot be converted from type.* Error_code: 1677");
 
 * Select count and 20 rows from Slave *
 

=== modified file 'mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result	2011-03-31 08:39:55 +0000
@@ -57,11 +57,6 @@ f1	f2	f3	f4	f5	f6	f7	f8	f9	hex(f10)	hex(
 27	27	27	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
 29	29	29	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
 30	30	30	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
-call mtr.add_suppression("Slave SQL.*Error .Can.t DROP .c7.; check that column.key exists. on query.* 1091");
-call mtr.add_suppression("Slave SQL.*Error .Unknown column .c7. in .t15.. on query.* 1054");
-call mtr.add_suppression("Slave SQL.*Error .Key column .c6. doesn.t exist in table. on query.* 1072");
-call mtr.add_suppression("Slave SQL.*Column 2 of table .test.t1.. cannot be converted from type.* Error_code: 1677");
 
 * Select count and 20 rows from Slave *
 

=== modified file 'mysql-test/t/innodb_mysql_lock.test'
--- a/mysql-test/t/innodb_mysql_lock.test	2010-08-06 11:29:37 +0000
+++ b/mysql-test/t/innodb_mysql_lock.test	2011-03-09 15:06:13 +0000
@@ -279,6 +279,38 @@ disconnect con2;
 disconnect con3;
 
 
+--echo #
+--echo # Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
+--echo #              KEY NO 0 FOR TABLE IN ERROR LOG 
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--connect (con1,localhost,root)
+
+--echo # Connection default
+connection default;
+CREATE TABLE t1 (id INT PRIMARY KEY, value INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1, 12345);
+START TRANSACTION;
+SELECT * FROM t1;
+
+--echo # Connection con1
+--connection con1
+SET lock_wait_timeout=1;
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD INDEX idx(value);
+
+--echo # Connection default
+--connection default
+SELECT * FROM t1;
+COMMIT;
+DROP TABLE t1;
+disconnect con1;
+
+
 # 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/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test	2011-03-07 13:30:49 +0000
+++ b/mysql-test/t/innodb_mysql_sync.test	2011-03-22 13:34:04 +0000
@@ -152,129 +152,133 @@ disconnect con1;
 --echo #           that implement add_index
 --echo #
 
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-connect(con1,localhost,root);
-connect(con2,localhost,root);
-
---echo # Test 1: Secondary index, should not block reads (original test case).
-
---echo # Connection default
-connection default;
-CREATE DATABASE db1;
-CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
-INSERT INTO db1.t1(value) VALUES (1), (2);
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE db1.t1 ADD INDEX(value)
-
---echo # Connection con1
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-# Neither of these two statements should be blocked
-USE db1;
-SELECT * FROM t1;
-SET DEBUG_SYNC= "now SIGNAL query";
-
---echo # Connection default
-connection default;
---echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
---reap
-DROP DATABASE db1;
-
---echo # Test 2: Primary index (implicit), should block reads.
-
-CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE t1 ADD UNIQUE INDEX(a)
-
---echo # Connection con1
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-USE test;
---echo # Sending:
---send SELECT * FROM t1
-
---echo # Connection con2
-connection con2;
---echo # Waiting for SELECT to be blocked by the metadata lock on t1
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
-  WHERE state= 'Waiting for table metadata lock'
-  AND info='SELECT * FROM t1';
---source include/wait_condition.inc
-SET DEBUG_SYNC= "now SIGNAL query";
-
---echo # Connection default
-connection default;
---echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
---reap
-
---echo # Connection con1
-connection con1;
---echo # Reaping: SELECT * FROM t1
---reap
-
---echo # Test 3: Primary index (explicit), should block reads.
-
---echo # Connection default
-connection default;
-ALTER TABLE t1 DROP INDEX a;
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE t1 ADD PRIMARY KEY (a)
-
---echo # Connection con1
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
---echo # Sending:
---send SELECT * FROM t1
-
---echo # Connection con2
-connection con2;
---echo # Waiting for SELECT to be blocked by the metadata lock on t1
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
-  WHERE state= 'Waiting for table metadata lock'
-  AND info='SELECT * FROM t1';
---source include/wait_condition.inc
-SET DEBUG_SYNC= "now SIGNAL query";
-
---echo # Connection default
-connection default;
---echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
---reap
-
---echo # Connection con1
-connection con1;
---echo # Reaping: SELECT * FROM t1
---reap
-
---echo # Test 4: Secondary unique index, should not block reads.
-
---echo # Connection default
-connection default;
-SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE t1 ADD UNIQUE (b)
-
---echo # Connection con1
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-SELECT * FROM t1;
-SET DEBUG_SYNC= "now SIGNAL query";
-
---echo # Connection default
-connection default;
---echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b)
---reap
+--echo #
+--echo # DISABLED due to Bug#11815600
+--echo #
 
-disconnect con1;
-disconnect con2;
-SET DEBUG_SYNC= "RESET";
-DROP TABLE t1;
+#--disable_warnings
+#DROP DATABASE IF EXISTS db1;
+#DROP TABLE IF EXISTS t1;
+#--enable_warnings
+#
+#connect(con1,localhost,root);
+#connect(con2,localhost,root);
+#
+#--echo # Test 1: Secondary index, should not block reads (original test case).
+#
+#--echo # Connection default
+#connection default;
+#CREATE DATABASE db1;
+#CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
+#INSERT INTO db1.t1(value) VALUES (1), (2);
+#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+#--echo # Sending:
+#--send ALTER TABLE db1.t1 ADD INDEX(value)
+#
+#--echo # Connection con1
+#connection con1;
+#SET DEBUG_SYNC= "now WAIT_FOR manage";
+# # Neither of these two statements should be blocked
+#USE db1;
+#SELECT * FROM t1;
+#SET DEBUG_SYNC= "now SIGNAL query";
+#
+#--echo # Connection default
+#connection default;
+#--echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
+#--reap
+#DROP DATABASE db1;
+#
+#--echo # Test 2: Primary index (implicit), should block reads.
+#
+#CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
+#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+#--echo # Sending:
+#--send ALTER TABLE t1 ADD UNIQUE INDEX(a)
+#
+#--echo # Connection con1
+#connection con1;
+#SET DEBUG_SYNC= "now WAIT_FOR manage";
+#USE test;
+#--echo # Sending:
+#--send SELECT * FROM t1
+#
+#--echo # Connection con2
+#connection con2;
+#--echo # Waiting for SELECT to be blocked by the metadata lock on t1
+#let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+#  WHERE state= 'Waiting for table metadata lock'
+#  AND info='SELECT * FROM t1';
+#--source include/wait_condition.inc
+#SET DEBUG_SYNC= "now SIGNAL query";
+#
+#--echo # Connection default
+#connection default;
+#--echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
+#--reap
+#
+#--echo # Connection con1
+#connection con1;
+#--echo # Reaping: SELECT * FROM t1
+#--reap
+#
+#--echo # Test 3: Primary index (explicit), should block reads.
+#
+#--echo # Connection default
+#connection default;
+#ALTER TABLE t1 DROP INDEX a;
+#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+#--echo # Sending:
+#--send ALTER TABLE t1 ADD PRIMARY KEY (a)
+#
+#--echo # Connection con1
+#connection con1;
+#SET DEBUG_SYNC= "now WAIT_FOR manage";
+#--echo # Sending:
+#--send SELECT * FROM t1
+#
+#--echo # Connection con2
+#connection con2;
+#--echo # Waiting for SELECT to be blocked by the metadata lock on t1
+#let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+#  WHERE state= 'Waiting for table metadata lock'
+#  AND info='SELECT * FROM t1';
+#--source include/wait_condition.inc
+#SET DEBUG_SYNC= "now SIGNAL query";
+#
+#--echo # Connection default
+#connection default;
+#--echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
+#--reap
+#
+#--echo # Connection con1
+#connection con1;
+#--echo # Reaping: SELECT * FROM t1
+#--reap
+#
+#--echo # Test 4: Secondary unique index, should not block reads.
+#
+#--echo # Connection default
+#connection default;
+#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+#--echo # Sending:
+#--send ALTER TABLE t1 ADD UNIQUE (b)
+#
+#--echo # Connection con1
+#connection con1;
+#SET DEBUG_SYNC= "now WAIT_FOR manage";
+#SELECT * FROM t1;
+#SET DEBUG_SYNC= "now SIGNAL query";
+#
+#--echo # Connection default
+#connection default;
+#--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b)
+#--reap
+#
+#disconnect con1;
+#disconnect con2;
+#SET DEBUG_SYNC= "RESET";
+#DROP TABLE t1;
 
 
 # Check that all connections opened by test cases in this file are really

=== modified file 'mysql-test/t/lowercase_table2.test'
--- a/mysql-test/t/lowercase_table2.test	2010-06-28 09:23:50 +0000
+++ b/mysql-test/t/lowercase_table2.test	2011-04-06 15:11:43 +0000
@@ -151,6 +151,41 @@ where TABLE_SCHEMA ='mysqltest_LC2';
 use test;
 drop database mysqltest_LC2;
 
+
+--echo #
+--echo # Bug #11758687: 50924: object names not resolved correctly 
+--echo #   on lctn2 systems
+--echo #
+
+CREATE DATABASE BUP_XPFM_COMPAT_DB2;
+
+CREATE TABLE BUP_XPFM_COMPAT_DB2.TABLE2 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE BUP_XPFM_COMPAT_DB2.table1 (c13 INT) DEFAULT CHARSET latin1;
+CREATE TABLE bup_xpfm_compat_db2.table3 (c13 INT) DEFAULT CHARSET latin1;
+
+delimiter |;
+#
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.trigger1 AFTER INSERT
+  ON BUP_XPFM_COMPAT_DB2.table1 FOR EACH ROW
+  update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TRIGGER2 AFTER INSERT
+  ON BUP_XPFM_COMPAT_DB2.TABLE2 FOR EACH ROW
+  update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TrigGer3 AFTER INSERT
+  ON BUP_XPFM_COMPAT_DB2.TaBle3 FOR EACH ROW
+  update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
+|
+delimiter ;|
+
+SELECT trigger_schema, trigger_name, event_object_table FROM
+INFORMATION_SCHEMA.TRIGGERS
+  WHERE trigger_schema COLLATE utf8_bin = 'BUP_XPFM_COMPAT_DB2'
+  ORDER BY trigger_schema, trigger_name;
+
+DROP DATABASE BUP_XPFM_COMPAT_DB2;
+
 --echo # End of 5.1 tests
 
 

=== modified file 'mysql-test/t/plugin_auth.test'
--- a/mysql-test/t/plugin_auth.test	2011-03-18 14:58:27 +0000
+++ b/mysql-test/t/plugin_auth.test	2011-04-07 09:55:09 +0000
@@ -491,4 +491,26 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INF
   TABLE_SCHEMA='mysql'
 ORDER BY COLUMN_NAME;
 
+
+--echo #
+--echo # Bug #11936829: diff. between mysql.user (authentication_string) 
+--echo #   in fresh and upgraded 5.5.11
+--echo #
+
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
+  WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
+    COLUMN_NAME IN ('plugin', 'authentication_string')
+  ORDER BY COLUMN_NAME;
+ALTER TABLE mysql.user MODIFY plugin char(64) DEFAULT '' NOT NULL;
+ALTER TABLE mysql.user MODIFY authentication_string TEXT NOT NULL;
+
+--echo Run mysql_upgrade on a 5.5.10 external authentication column layout
+--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+
+SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
+  WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
+    COLUMN_NAME IN ('plugin', 'authentication_string')
+  ORDER BY COLUMN_NAME;
+
+
 --echo End of 5.5 tests

=== modified file 'mysql-test/t/show_check.test'
--- a/mysql-test/t/show_check.test	2011-03-07 15:17:39 +0000
+++ b/mysql-test/t/show_check.test	2011-03-30 13:33:29 +0000
@@ -1082,6 +1082,7 @@ DROP DATABASE `�
 #
 --error ER_NO_SUCH_TABLE,ER_FILE_NOT_FOUND
 show columns from `#mysql50#????????`;
+call mtr.add_suppression("Can.t find file: '.\\\\test\\\\\\?{8}.frm'");
 
 #
 # SHOW CREATE TRIGGER test.

=== modified file 'mysql-test/t/sp-destruct.test'
--- a/mysql-test/t/sp-destruct.test	2010-12-16 18:18:20 +0000
+++ b/mysql-test/t/sp-destruct.test	2011-03-30 13:33:29 +0000
@@ -14,6 +14,7 @@
 
 # Supress warnings written to the log file
 call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted");
+call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc");
 
 # Backup proc table
 let $MYSQLD_DATADIR= `select @@datadir`;

=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql	2011-03-18 14:58:27 +0000
+++ b/scripts/mysql_system_tables_fix.sql	2011-04-07 09:55:09 +0000
@@ -644,6 +644,7 @@ drop procedure mysql.die;
 
 ALTER TABLE user ADD plugin char(64) DEFAULT '',  ADD authentication_string TEXT;
 ALTER TABLE user MODIFY plugin char(64) DEFAULT '';
+ALTER TABLE user MODIFY authentication_string TEXT;
 
 -- Need to pre-fill mysql.proxies_priv with access for root even when upgrading from
 -- older versions

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-04-04 08:47:25 +0000
+++ b/sql/item.cc	2011-04-07 10:45:24 +0000
@@ -6742,7 +6742,19 @@ my_decimal *Item_ref::val_decimal(my_dec
 int Item_ref::save_in_field(Field *to, bool no_conversions)
 {
   int res;
-  DBUG_ASSERT(!result_field);
+  if (result_field)
+  {
+    if (result_field->is_null())
+    {
+      null_value= 1;
+      res= set_field_to_null_with_conversions(to, no_conversions);
+      return res;
+    }
+    to->set_notnull();
+    res= field_conv(to, result_field);
+    null_value= 0;
+    return res;
+  }
   res= (*ref)->save_in_field(to, no_conversions);
   null_value= (*ref)->null_value;
   return res;

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2011-04-04 08:47:25 +0000
+++ b/sql/opt_range.cc	2011-04-07 14:24:47 +0000
@@ -1154,8 +1154,7 @@ SQL_SELECT::SQL_SELECT() :quick(0),cond(
 
 void SQL_SELECT::cleanup()
 {
-  delete quick;
-  quick= 0;
+  set_quick(NULL);
   if (free_cond)
   {
     free_cond=0;
@@ -2216,8 +2215,7 @@ int SQL_SELECT::test_quick_select(THD *t
 		      (ulong) keys_to_use.to_ulonglong(), (ulong) prev_tables,
 		      (ulong) const_tables));
   DBUG_PRINT("info", ("records: %lu", (ulong) head->file->stats.records));
-  delete quick;
-  quick=0;
+  set_quick(NULL);
   needed_reg.clear_all();
   quick_keys.clear_all();
   if (keys_to_use.is_clear_all())
@@ -2458,10 +2456,7 @@ int SQL_SELECT::test_quick_select(THD *t
     {
       records= best_trp->records;
       if (!(quick= best_trp->make_quick(&param, TRUE)) || quick->init())
-      {
-        delete quick;
-        quick= NULL;
-      }
+        set_quick(NULL);
     }
 
   free_mem:

=== modified file 'sql/sql_join_cache.cc'
--- a/sql/sql_join_cache.cc	2011-03-22 11:44:40 +0000
+++ b/sql/sql_join_cache.cc	2011-04-07 14:24:47 +0000
@@ -1777,12 +1777,9 @@ enum_nested_loop_state JOIN_CACHE_BNL::j
   if (skip_last)     
     put_record();     
  
-  if (join_tab->use_quick == 2 && join_tab->select->quick)
-  { 
+  if (join_tab->use_quick == QS_DYNAMIC_RANGE && join_tab->select->quick)
     /* A dynamic range access was used last. Clean up after it */
-    delete join_tab->select->quick;
-    join_tab->select->quick= 0;
-  }
+    join_tab->select->set_quick(NULL);
 
   for (tab= join->join_tab; tab != join_tab ; tab++)
   {

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-04-04 08:47:25 +0000
+++ b/sql/sql_select.cc	2011-04-07 14:24:47 +0000
@@ -11253,10 +11253,7 @@ make_join_readinfo(JOIN *join, ulonglong
     case JT_REF_OR_NULL:
     case JT_REF:
       if (tab->select)
-      {
-	delete tab->select->quick;
-	tab->select->quick=0;
-      }
+        tab->select->set_quick(NULL);
       delete tab->quick;
       tab->quick=0;
       /* fall through */
@@ -18421,8 +18418,7 @@ int read_first_record_seq(JOIN_TAB *tab)
 static int
 test_if_quick_select(JOIN_TAB *tab)
 {
-  delete tab->select->quick;
-  tab->select->quick=0;
+  tab->select->set_quick(NULL);
   return tab->select->test_quick_select(tab->join->thd, 
                                         tab->keys,
                                         0,          // empty table map
@@ -20341,10 +20337,8 @@ skipped_filesort:
 use_filesort:
   // Restore original save_quick
   if (select && select->quick != save_quick)
-  {
-    delete select->quick;
-    select->quick= save_quick;
-  }
+    select->set_quick(save_quick);
+
   if (orig_select_cond_saved)
     tab->set_cond(orig_select_cond, __LINE__);
   DBUG_RETURN(0);

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2011-04-04 08:47:25 +0000
+++ b/sql/sql_show.cc	2011-04-06 15:21:05 +0000
@@ -3557,6 +3557,12 @@ int get_all_tables(THD *thd, TABLE_LIST 
   it.rewind(); /* To get access to new elements in basis list */
   while ((db_name= it++))
   {
+    LEX_STRING orig_db_name;
+
+    /* db_name can be changed in make_table_list() func */
+    if (!thd->make_lex_string(&orig_db_name, db_name->str,
+                              db_name->length, FALSE))
+      goto err;
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
     if (!(check_access(thd, SELECT_ACL, db_name->str,
                        &thd->col_access, NULL, 0, 1) ||
@@ -3621,17 +3627,13 @@ int get_all_tables(THD *thd, TABLE_LIST 
             }
 
             int res;
-            LEX_STRING tmp_lex_string, orig_db_name;
+            LEX_STRING tmp_lex_string;
             /*
               Set the parent lex of 'sel' because it is needed by
               sel.init_query() which is called inside make_table_list.
             */
             thd->no_warnings_for_error= 1;
             sel.parent_lex= lex;
-            /* db_name can be changed in make_table_list() func */
-            if (!thd->make_lex_string(&orig_db_name, db_name->str,
-                                      db_name->length, FALSE))
-              goto err;
             if (make_table_list(thd, &sel, db_name, table_name))
               goto err;
             TABLE_LIST *show_table_list= sel.table_list.first;

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2011-04-01 14:04:52 +0000
+++ b/sql/sql_update.cc	2011-04-07 14:24:47 +0000
@@ -577,11 +577,10 @@ int mysql_update(THD *thd,
       /* Change select to use tempfile */
       if (select)
       {
-	delete select->quick;
-	if (select->free_cond)
-	  delete select->cond;
-	select->quick=0;
-	select->cond=0;
+        select->set_quick(NULL);
+        if (select->free_cond)
+          delete select->cond;
+        select->cond= NULL;
       }
       else
       {

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-04-04 06:17:15 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-04-07 09:55:09 +0000
@@ -2826,10 +2826,8 @@ innobase_alter_table_flags(
 	uint	flags)
 {
 	return(HA_INPLACE_ADD_INDEX_NO_READ_WRITE
-		| HA_INPLACE_ADD_INDEX_NO_WRITE
 		| HA_INPLACE_DROP_INDEX_NO_READ_WRITE
 		| HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE
-		| HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE
 		| HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE
 		| HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE);
 }

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-trunk branch (marc.alff:3335) Marc Alff8 Apr