List:Commits« Previous MessageNext Message »
From:Roy Lyseng Date:February 13 2012 10:12am
Subject:bzr push into mysql-trunk branch (roy.lyseng:3870 to 3886) Bug#13586314
View as plain text  
 3886 Gopal Shankar	2012-02-13
      Bug#13586314 - RUNTIME - HIBISCUS: ISSUE DEPRECATION
                     WARNING FOR LOW_PRIORITY MODIFIER
      
      As of 5.5.3, the LOW_PRIORITY modifier for
      'LOCK TABLES tbl_name LOW_PRIORITY WRITE' command has no
      effect. This patch adds deprecation warning for above command,
      based on a decision made as part of WL#6101.

    modified:
      mysql-test/r/lock.result
      mysql-test/t/lock.test
      sql/sql_yacc.yy
 3885 Rohit Kalhans	2012-02-13 [merge]
      merge from mysql 5.5->mysql-trunk

    modified:
      mysql-test/r/multi_update.result
      mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
      mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
      mysql-test/t/multi_update.test
      sql/sql_base.cc
 3884 Sunny Bains	2012-02-13
      Bug#13614037 - CRASH IN LOCK_TABLE_CREATE DURING KILL_CONNECTION
            
      DDL transactions must be tagged with trx_t::will_lock. This was missing for:
            
       1. DROP TABLE
       2. DROP DATABASE
       3. RENAME TABLE
            
      Otherwise our check for non-locking-autocommit-read-only transactions will
      mistakenly tag them as true.
            
      rb://930 Approved by Jimmy Yang.

    modified:
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/trx/trx0trx.cc
 3883 Alexander Barkov	2012-02-13
      Post-fix for WL#946 "Fractional seconds..."
      
      - Field_temporal::store()
      
        Fixing the code merging two error codes in Field_temporal::store()
        1 + 3 should give 1, i.e. "error + note = error".
        Previously the code returned "error + note = note".
        Also, the old code depended on the order of "|" operand execution,
        which is not guaranteed by the C standard.
        Production build on Windows appeared to execute the operands
        in backward order.
      
      - Field_timef::store_internal()
        Adding a note on storing a DATETIME value with a non-zero date part
        into a TIME column,
        for symmetry with Field_newdate::store_internal().
      
      - convert_constant_item()
        Allow constant conversion in case of a note.

    modified:
      mysql-test/r/ps_2myisam.result
      mysql-test/r/ps_3innodb.result
      mysql-test/r/ps_4heap.result
      mysql-test/r/ps_5merge.result
      mysql-test/r/type_temporal_fractional.result
      mysql-test/r/type_time.result
      sql/field.cc
      sql/item_cmpfunc.cc
 3882 Sunny Bains	2012-02-13
      UNDO fix for bug#13628249.

    modified:
      storage/innobase/trx/trx0trx.cc
 3881 Sunny Bains	2012-02-13
      Bug# 13628249 - ASSERT MAX_UNDO_LOGS == ULINT_UNDEFINED WHEN INNODB-FORCE-RECOVERY >= 5
      
      Fix a bug introduced by the fix for Bug#13255225. Use the available number of
      UNDO logs not the total number of known UNDO logs.
      
      Approved by Jimmy over IM.

    modified:
      storage/innobase/trx/trx0trx.cc
 3880 kevin.lewis@stripped	2012-02-10
      Enhanced test for WL6145 to show that DATA DIRECTORY is
      displayed by SHOW CREATE TABLE.

    modified:
      mysql-test/r/archive_symlink.result
      mysql-test/t/archive_symlink.test
 3879 kevin.lewis@stripped	2012-02-10
      Testcases for WL#6145

    added:
      mysql-test/r/archive_no_symlink.result
      mysql-test/r/archive_symlink.result
      mysql-test/t/archive_no_symlink-master.opt
      mysql-test/t/archive_no_symlink.test
      mysql-test/t/archive_symlink.test
 3878 Jorgen Loland	2012-02-10
      Bug#13627632 - INFORMATION SCHEMA TABLES DO NOT PACK LONG 
                     VARCHAR COLUMNS
      
      db_create_option needs HA_OPTION_PACK_RECORD to be set in 
      order to create MyISAM tables with packed record format.
      
      When processing queries that access "normal" tables, temporary
      table fields are created in create_tmp_field_from_field(). On
      the other hand, queries against information_schema tables
      create fields for the temporary table in
      create_tmp_field_for_schema(). This patch aligns the two 
      functions by setting db_create_options-flag 
      HA_OPTION_PACK_RECORD when a VARCHAR column is added for 
      schema temp tables just as is done for "normal" temp tables.
      
      The result is that temp tables for information schema queries 
      use the packed MyISAM format if they contain sufficiently 
      large VARCHAR columns.
     @ mysql-test/suite/opt_trace/r/temp_table.result
        Add test that I_S temporary tables use the packed MyISAM format
     @ mysql-test/suite/opt_trace/t/temp_table.test
        Add test that I_S temporary tables use the packed MyISAM format
     @ sql/sql_tmp_table.cc
        Set HA_OPTION_PACK_RECORD in create_tmp_field_for_schema()
        if a VARCHAR column is added.

    modified:
      mysql-test/suite/opt_trace/r/temp_table.result
      mysql-test/suite/opt_trace/t/temp_table.test
      sql/sql_tmp_table.cc
 3877 Sunny Bains	2012-02-10
      BUG#12739098 - 62401: ASSERTION TRX->ERROR_STATE == DB_SUCCESS, QUE0QUE.C LINE 1264 ON TRUNCATE 
      
      Move a test in innodb-index.test, that was added as part of this bug fix, to
      innodb-index-debug.test. This test uses a debug feature to simulate errors.

    added:
      mysql-test/suite/innodb/r/innodb-index-debug.result
      mysql-test/suite/innodb/t/innodb-index-debug.test
    modified:
      mysql-test/suite/innodb/r/innodb-index.result
      mysql-test/suite/innodb/t/innodb-index.test
 3876 Sunny Bains	2012-02-10 [merge]
      Merge from mysql-5.5.

 3875 Sunny Bains	2012-02-10 [merge]
      Merge from mysql-5.5.
      
      Additionally fix merge conflicts and update the patch with the following
      changes:
      
      1. Set trx_t::error_state=DB_SUCCESS in dict0stats.cc
      
      2. Add an error injection test that simulates a DB_TOO_MANY_CONCURRENT_TRXS
         error during FIC.
      
      Both changes part of the the original approval on rb://935.

    modified:
      mysql-test/suite/innodb/r/innodb-index.result
      mysql-test/suite/innodb/t/innodb-index.test
      storage/innobase/dict/dict0stats.cc
      storage/innobase/include/ha_prototypes.h
      storage/innobase/row/row0merge.cc
      storage/innobase/trx/trx0trx.cc
 3874 Rohit Kalhans	2012-02-10 [merge]
      merge from 5.5->trunk

 3873 Rohit Kalhans	2012-02-09 [merge]
      Merge from mysql-5.5-->mysql-trunk

    modified:
      mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
      mysql-test/extra/rpl_tests/rpl_multi_update.test
      mysql-test/extra/rpl_tests/rpl_multi_update2.test
      mysql-test/extra/rpl_tests/rpl_multi_update3.test
      mysql-test/r/ps.result
      mysql-test/suite/binlog/r/binlog_unsafe.result
      mysql-test/suite/binlog/t/binlog_unsafe.test
      mysql-test/suite/rpl/r/rpl_auto_increment_11932.result
      mysql-test/suite/rpl/r/rpl_insert_id_pk.result
      mysql-test/suite/rpl/r/rpl_multi_update.result
      mysql-test/suite/rpl/r/rpl_multi_update2.result
      mysql-test/suite/rpl/r/rpl_multi_update3.result
      mysql-test/suite/rpl/r/rpl_rotate_logs.result
      mysql-test/suite/rpl/t/rpl_auto_increment_11932.test
      mysql-test/suite/rpl/t/rpl_multi_update2.test
      mysql-test/suite/rpl/t/rpl_multi_update3.test
      mysql-test/suite/rpl/t/rpl_optimize.test
      mysql-test/suite/rpl/t/rpl_rotate_logs.test
      mysql-test/suite/rpl/t/rpl_semi_sync_event.test
      mysql-test/suite/rpl/t/rpl_timezone.test
      mysql-test/t/multi_update.test
      mysql-test/t/ps.test
      sql/share/errmsg-utf8.txt
      sql/sql_base.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_table.cc
 3872 Guilhem Bichot	2012-02-09
      Bug #13623473 	MISSING ROWS ON SELECT AND JOIN WITH TIME/DATETIME COMPARE
      Cannot use index for indexed_time=datetime.
     @ mysql-test/r/type_time.result
        Without the code fix in add_key_field(), all ref access on
        t1.col_time_key would return only 2012-01-31 00:00:00 and
        miss rows. You can see the new warning "Cannot use ref access".
        
        Without the code fix in get_mm_leaf(), queries with
        "range checked for each record" used the index on t1.col_time_key
        and missed rows. For example:
        SELECT * FROM
        t2 ignore INDEX (col_datetime_key)
        STRAIGHT_JOIN
        t1 force INDEX (col_time_key)
        WHERE col_time_key <= col_datetime_key;
        missed:
        2012-02-01 00:00:00	24:00:00
        2012-02-02 00:00:00	24:00:00
        2012-02-02 00:00:00	48:00:00
        And:
        SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key)
        ON t3.col_time_key > t2.col_datetime_key;
        returned only:
        1	2001-11-04 19:07:55	k	19:22:21
        1	2001-11-04 19:07:55	k	19:47:59
        1	2001-11-04 19:07:55	k	21:22:34
        You cannot see the new warning "Cannot use range access" because:
        * when the range optimizer is tried for indexed_time=datetime_column,
        it is the "range checked for each record" case: range optimizer
        is called for each outer row during execution; that does not happen
        in EXPLAIN, and the warning may be raised only in EXPLAIN.
        * To see the warning in EXPLAIN, range optimizer would have
        to be called during optimization, which would require
        indexed_time=datetime_constant, in which case we are
        not in the same conversion rules...
     @ mysql-test/t/type_time.test
        test of col_time_key OP col_datetime_key, where OP is =,>=,>,<=,<,
        and index is forced/ignored. Exercises ref access and range scan.
        Plus the original testcase of the bug report.
     @ sql/opt_range.cc
        "indexed_time OP temporal_expression_with_date"
        does not use index anymore (OP = any comparison operator)
     @ sql/sql_optimizer.cc
        "indexed_time = temporal_expression_with_date"
        does not use index anymore.
        A comment in code explains why "ref" access is impossible.

    modified:
      mysql-test/r/type_time.result
      mysql-test/t/type_time.test
      sql/opt_range.cc
      sql/sql_optimizer.cc
      sql/sql_optimizer.h
 3871 Vasil Dimov	2012-02-09
      Fix Bug#13513676 INNODB_BUFFER_POOL_DUMP_STATUS IS NOT POPULATED WITHIN EXPECTED TIME
      
      There is a tiny interval of time during startup when the status variable
      'innodb_buffer_pool_dump_status' can be '' before it becomes 'not started'.
      
      This patch makes the bug 100% reproducable:
      
      --- cut ---
        --- storage/innobase/buf/buf0dump.cc
        +++ storage/innobase/buf/buf0dump.cc
        @@ -577,12 +577,13 @@ DECLARE_THREAD(buf_dump_thread)(
         /*============================*/
         	void*	arg __attribute__((unused)))	/*!< in: a dummy parameter
         						required by os_thread_create */
         {
         	srv_buf_dump_thread_active = TRUE;
         
        +	sleep(5);
         	buf_dump_status(STATUS_INFO, "not started");
         	buf_load_status(STATUS_INFO, "not started");
      --- cut ---
      
      It is not easy to assign a default value to this variable which to be
      available before buf_dump_thread() starts, thus:
      
      The solution is to use include/wait_for_status_var.inc to wait for the
      variable to become 'not started'.

    modified:
      mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test
 3870 Guilhem Bichot	2012-02-09 [merge]
      merge from trunk

    modified:
      mysql-test/r/events_restart.result
      mysql-test/t/events_restart.test
      sql/events.cc
=== modified file 'mysql-test/extra/rpl_tests/rpl_insert_id_pk.test'
--- a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test	2012-02-09 20:26:08 +0000
@@ -10,6 +10,8 @@
 # We also check how the foreign_key_check variable is replicated
 
 -- source include/master-slave.inc
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+
 #should work for both SBR and RBR
 
 create table t1(a int auto_increment, primary key(a));
@@ -50,6 +52,7 @@ create table t2(b int auto_increment, c 
 insert into t1 values (10);
 insert into t1 values (null),(null),(null);
 insert into t2 values (5,0);
+--disable_warnings ONCE
 insert into t2 (c) select * from t1 ORDER BY a;
 select * from t2 ORDER BY b;
 sync_slave_with_master;

=== modified file 'mysql-test/extra/rpl_tests/rpl_multi_update.test'
--- a/mysql-test/extra/rpl_tests/rpl_multi_update.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_multi_update.test	2012-02-09 20:26:08 +0000
@@ -1,5 +1,7 @@
 source include/master-slave.inc;
 
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
+
 eval CREATE TABLE t1 (
  a int unsigned not null auto_increment primary key,
  b int unsigned
@@ -11,6 +13,7 @@ eval CREATE TABLE t2 (
 ) ENGINE=$engine_type;
 
 INSERT INTO t1 VALUES (NULL, 0);
+--disable_warnings ONCE
 INSERT INTO t1 SELECT NULL, 0 FROM t1;
 
 INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
@@ -18,6 +21,7 @@ INSERT INTO t2 VALUES (NULL, 0), (NULL,1
 SELECT * FROM t1 ORDER BY a;
 SELECT * FROM t2 ORDER BY a;
 
+--disable_warnings ONCE
 UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
 sync_slave_with_master;
 

=== modified file 'mysql-test/extra/rpl_tests/rpl_multi_update2.test'
--- a/mysql-test/extra/rpl_tests/rpl_multi_update2.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_multi_update2.test	2012-02-09 20:26:08 +0000
@@ -17,6 +17,8 @@ eval CREATE TABLE t2 (
 ) ENGINE=$engine_type;
 
 INSERT INTO t1 VALUES (NULL, 0);
+
+--disable_warnings ONCE
 INSERT INTO t1 SELECT NULL, 0 FROM t1;
 
 INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
@@ -24,6 +26,7 @@ INSERT INTO t2 VALUES (NULL, 0), (NULL,1
 SELECT * FROM t1 ORDER BY a;
 SELECT * FROM t2 ORDER BY a;
 
+--disable_warnings ONCE
 UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
 SELECT * FROM t1 ORDER BY a;
 SELECT * FROM t2 ORDER BY a;

=== modified file 'mysql-test/extra/rpl_tests/rpl_multi_update3.test'
--- a/mysql-test/extra/rpl_tests/rpl_multi_update3.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_multi_update3.test	2012-02-09 20:26:08 +0000
@@ -18,6 +18,8 @@ eval CREATE TABLE t2 (
 ) ENGINE=$engine_type;
 
 INSERT INTO t1 VALUES (NULL, 0);
+
+--disable_warnings ONCE
 INSERT INTO t1 SELECT NULL, 0 FROM t1;
 
 INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
@@ -25,6 +27,7 @@ INSERT INTO t2 VALUES (NULL, 0), (NULL,1
 SELECT * FROM t1 ORDER BY a;
 SELECT * FROM t2 ORDER BY a;
 
+--disable_warnings ONCE
 UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
 SELECT * FROM t1 ORDER BY a;
 SELECT * FROM t2 ORDER BY a;

=== added file 'mysql-test/r/archive_no_symlink.result'
--- a/mysql-test/r/archive_no_symlink.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/archive_no_symlink.result	2012-02-10 21:18:47 +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/r/archive_symlink.result'
--- a/mysql-test/r/archive_symlink.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/archive_symlink.result	2012-02-10 22:43:46 +0000
@@ -0,0 +1,57 @@
+# 
+# Archive can only use an existing directory for DATA DIRECTORY.
+# 
+CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive';
+ERROR HY000: Can't create table 'test.t1' (errno: 2)
+# 
+# mkdir MYSQL_TMP_DIR/archive and try again... 
+# Archive will use a symlink for DATA DIRECTORY but ignore INDEX DIRECTORY.
+# 
+CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive';
+Warnings:
+Warning	1618	<INDEX DIRECTORY> option ignored
+INSERT INTO t1 VALUES (NULL, "blue");
+INSERT INTO t1 VALUES (NULL, "red");
+INSERT INTO t1 VALUES (NULL, "yellow");
+# Checking if archive file exists where we specified in DATA DIRECTORY
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) NOT NULL AUTO_INCREMENT,
+  `b` char(30) DEFAULT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=ARCHIVE AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/archive/'
+DROP TABLE t1;
+# 
+# Be sure SQL MODE "NO_DIR_IN_CREATE" prevents the use of DATA DIRECTORY
+# 
+SET @org_mode=@@sql_mode;
+SET @@sql_mode='NO_DIR_IN_CREATE';
+SELECT @@sql_mode;
+@@sql_mode
+NO_DIR_IN_CREATE
+CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive';
+Warnings:
+Warning	1618	<DATA DIRECTORY> option ignored
+INSERT INTO t1 VALUES (NULL, "blue");
+INSERT INTO t1 VALUES (NULL, "red");
+INSERT INTO t1 VALUES (NULL, "yellow");
+# Checking if archive file exists in --datadir since DATA DIRECTORY was ignored.
+DROP TABLE t1;
+set @@sql_mode=@org_mode;
+# 
+# MySQL engine does not allow DATA DIRECTORY to be
+# within --datadir for any engine, including Archive
+# 
+CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+ENGINE archive DATA DIRECTORY 'MYSQLD_DATADIR/test';
+ERROR HY000: Incorrect arguments to DATA DIRECTORY
+CREATE TABLE t1 (c1 int(10), PRIMARY KEY (c1))
+ENGINE archive INDEX DIRECTORY 'MYSQLD_DATADIR/test';
+ERROR HY000: Incorrect arguments to INDEX DIRECTORY
+# 
+# Cleanup
+# 

=== modified file 'mysql-test/r/lock.result'
--- a/mysql-test/r/lock.result	2011-01-26 22:06:30 +0000
+++ b/mysql-test/r/lock.result	2012-02-13 09:45:43 +0000
@@ -457,5 +457,18 @@ UNLOCK TABLES;
 UNLOCK TABLES;
 DROP TABLE t1, t2;
 #
+# Bug#13586314 - RUNTIME - HIBISCUS: ISSUE DEPRECATION
+# WARNING FOR LOW_PRIORITY MODIFIER
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+# Below statement should return a deprecation warning
+LOCK TABLES t1 LOW_PRIORITY WRITE;
+Warnings:
+Warning	1287	'LOW_PRIORITY WRITE' is deprecated and will be removed in a future release. Please use WRITE instead
+UNLOCK TABLES;
+DROP TABLE t1;
+# End of Bug#13586314
+#
 # End of 6.0 tests.
 #

=== modified file 'mysql-test/r/multi_update.result'
--- a/mysql-test/r/multi_update.result	2011-12-13 14:10:33 +0000
+++ b/mysql-test/r/multi_update.result	2012-02-13 08:50:03 +0000
@@ -1,3 +1,4 @@
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
 drop table if exists t1,t2,t3;
 drop database if exists mysqltest;
 drop view if exists v1;
@@ -125,6 +126,8 @@ ID	ParId	tst	tst1
 2	2	NULL	NULL
 3	3	NULL	NULL
 UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id;
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 select * from t2;
 ID	ParId	tst	tst1
 1	1	MySQL	MySQL AB
@@ -349,6 +352,8 @@ drop table t1,t2;
 create table t1 (a int not null auto_increment primary key, b int not null);
 insert into t1 (b) values (1),(2),(3),(4);
 update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a;
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 select * from t1;
 a	b
 1	2
@@ -605,7 +610,8 @@ a	b
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; UPDATE t2,t1 SET t2.a=t1.a+2
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 delete from t1;
 delete from t2;
@@ -617,7 +623,8 @@ ERROR 23000: Duplicate entry '4' for key
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; UPDATE t2,t1  SET t2.a=t2.b where t2.a=t1.a
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
+master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 drop table t1, t2;
 set @@session.binlog_format= @sav_binlog_format;

=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/r/ps.result	2012-02-09 20:26:08 +0000
@@ -1,3 +1,4 @@
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
 drop table if exists t1,t2,t3,t4;
 drop database if exists client_test_db;
 create table t1

=== modified file 'mysql-test/r/ps_2myisam.result'
--- a/mysql-test/r/ps_2myisam.result	2012-02-07 20:32:47 +0000
+++ b/mysql-test/r/ps_2myisam.result	2012-02-13 06:26:52 +0000
@@ -2962,25 +2962,31 @@ test_sequence
 -- insert into date/time columns --
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Warning	1265	Data truncated for column 'c13' at row 1

=== modified file 'mysql-test/r/ps_3innodb.result'
--- a/mysql-test/r/ps_3innodb.result	2012-02-07 20:32:47 +0000
+++ b/mysql-test/r/ps_3innodb.result	2012-02-13 06:26:52 +0000
@@ -2945,25 +2945,31 @@ test_sequence
 -- insert into date/time columns --
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Warning	1265	Data truncated for column 'c13' at row 1

=== modified file 'mysql-test/r/ps_4heap.result'
--- a/mysql-test/r/ps_4heap.result	2012-02-07 20:32:47 +0000
+++ b/mysql-test/r/ps_4heap.result	2012-02-13 06:26:52 +0000
@@ -2946,25 +2946,31 @@ test_sequence
 -- insert into date/time columns --
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Warning	1265	Data truncated for column 'c13' at row 1

=== modified file 'mysql-test/r/ps_5merge.result'
--- a/mysql-test/r/ps_5merge.result	2012-02-07 20:32:47 +0000
+++ b/mysql-test/r/ps_5merge.result	2012-02-13 06:26:52 +0000
@@ -2882,25 +2882,31 @@ test_sequence
 -- insert into date/time columns --
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Warning	1265	Data truncated for column 'c13' at row 1
@@ -5902,25 +5908,31 @@ test_sequence
 -- insert into date/time columns --
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
 Warnings:
 Note	1265	Data truncated for column 'c13' at row 1
+Note	1265	Data truncated for column 'c16' at row 1
 Warning	1265	Data truncated for column 'c17' at row 1
 Warnings:
 Warning	1265	Data truncated for column 'c13' at row 1

=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2012-02-07 20:32:47 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2012-02-13 06:26:52 +0000
@@ -17027,6 +17027,9 @@ INSERT INTO t1 VALUES
 (SEC_TO_TIME(46),'20030628121312.000376','20020323065409.039577'),            
 (SEC_TO_TIME(48),'20071219173306.048009',NULL),            
 (SEC_TO_TIME(50),'0000-00-00',NULL);
+Warnings:
+Note	1265	Data truncated for column 'c_time' at row 2
+Note	1265	Data truncated for column 'c_time' at row 3
 SELECT c_time FROM t1;
 c_time
 00:00:00

=== modified file 'mysql-test/r/type_time.result'
--- a/mysql-test/r/type_time.result	2012-02-07 20:32:47 +0000
+++ b/mysql-test/r/type_time.result	2012-02-13 06:26:52 +0000
@@ -1,6 +1,8 @@
 drop table if exists t1;
 create table t1 (t time);
 insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10  1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
+Warnings:
+Note	1265	Data truncated for column 't' at row 13
 insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
 select * from t1;
 t
@@ -429,6 +431,2331 @@ SELECT TIME(MIN(a)) FROM t1;
 TIME(MIN(a))
 00:00:00
 DROP TABLE t1;
+#
+# Bug#13623473 "MISSING ROWS ON SELECT AND JOIN WITH
+# TIME/DATETIME COMPARE"
+#
+# Systematic testing of ref access and range scan
+SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
+CREATE TABLE t1 (col_time_key TIME, KEY(col_time_key)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('00:00:00'),('-24:00:00'),('-48:00:00'),('24:00:00'),('48:00:00');
+CREATE TABLE t2 (col_datetime_key DATETIME, KEY(col_datetime_key)) ENGINE=InnoDB;
+INSERT INTO t2 SELECT * FROM t1;
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where
+1	SIMPLE	t2	ref	col_datetime_key	col_datetime_key	6	test.t1.col_time_key	1	100.00	Using where; Using index
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where
+1	SIMPLE	t2	ref	col_datetime_key	col_datetime_key	6	test.t1.col_time_key	1	100.00	Using where; Using index
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index
+1	SIMPLE	t2	ref	col_datetime_key	col_datetime_key	6	test.t1.col_time_key	1	100.00	Using where; Using index
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key = col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index
+1	SIMPLE	t2	ref	col_datetime_key	col_datetime_key	6	test.t1.col_time_key	1	100.00	Using where; Using index
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key = col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` = `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key = col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Warning	1713	Cannot use ref access on index 'col_time_key' due to type or collation conversion on field 'col_time_key'
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` = `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key = col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key >= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key >= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` >= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key >= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` >= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key >= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key > col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key > col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key > col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` > `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key > col_time_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key <= col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-30 00:00:00
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-29 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-01-31 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-01 00:00:00
+24:00:00	2012-02-02 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key <= col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+-24:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+00:00:00	2012-01-31 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+24:00:00	2012-02-01 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+48:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` <= `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key <= col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` <= `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key <= col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	-48:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	-24:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	00:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	24:00:00
+2012-02-01 00:00:00	48:00:00
+2012-02-02 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` IGNORE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 ignore INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` IGNORE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 ignore INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_time_key < col_datetime_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-31 00:00:00
+-24:00:00	2012-02-01 00:00:00
+-24:00:00	2012-02-02 00:00:00
+-48:00:00	2012-01-30 00:00:00
+-48:00:00	2012-01-31 00:00:00
+-48:00:00	2012-02-01 00:00:00
+-48:00:00	2012-02-02 00:00:00
+00:00:00	2012-02-01 00:00:00
+00:00:00	2012-02-02 00:00:00
+24:00:00	2012-02-02 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using index
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t1`.`col_time_key` AS `col_time_key`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key` from `test`.`t1` FORCE INDEX (`col_time_key`) straight_join `test`.`t2` FORCE INDEX (`col_datetime_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t1 force INDEX (col_time_key)
+STRAIGHT_JOIN
+t2 force INDEX (col_datetime_key)
+WHERE col_datetime_key < col_time_key;
+col_time_key	col_datetime_key
+-24:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-29 00:00:00
+00:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-29 00:00:00
+24:00:00	2012-01-30 00:00:00
+24:00:00	2012-01-31 00:00:00
+48:00:00	2012-01-29 00:00:00
+48:00:00	2012-01-30 00:00:00
+48:00:00	2012-01-31 00:00:00
+48:00:00	2012-02-01 00:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	5	100.00	
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` IGNORE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 ignore INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` IGNORE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 ignore INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	ALL	col_time_key	NULL	NULL	NULL	5	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t1`.`col_time_key` < `test`.`t2`.`col_datetime_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_time_key < col_datetime_key;
+col_datetime_key	col_time_key
+2012-01-30 00:00:00	-48:00:00
+2012-01-31 00:00:00	-24:00:00
+2012-01-31 00:00:00	-48:00:00
+2012-02-01 00:00:00	-24:00:00
+2012-02-01 00:00:00	-48:00:00
+2012-02-01 00:00:00	00:00:00
+2012-02-02 00:00:00	-24:00:00
+2012-02-02 00:00:00	-48:00:00
+2012-02-02 00:00:00	00:00:00
+2012-02-02 00:00:00	24:00:00
+EXPLAIN EXTENDED SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	index	col_datetime_key	col_datetime_key	6	NULL	5	100.00	Using index
+1	SIMPLE	t1	index	col_time_key	col_time_key	4	NULL	5	100.00	Using where; Using index; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t1`.`col_time_key` AS `col_time_key` from `test`.`t2` FORCE INDEX (`col_datetime_key`) straight_join `test`.`t1` FORCE INDEX (`col_time_key`) where (`test`.`t2`.`col_datetime_key` < `test`.`t1`.`col_time_key`)
+SELECT * FROM
+t2 force INDEX (col_datetime_key)
+STRAIGHT_JOIN
+t1 force INDEX (col_time_key)
+WHERE col_datetime_key < col_time_key;
+col_datetime_key	col_time_key
+2012-01-29 00:00:00	-24:00:00
+2012-01-29 00:00:00	00:00:00
+2012-01-29 00:00:00	24:00:00
+2012-01-29 00:00:00	48:00:00
+2012-01-30 00:00:00	00:00:00
+2012-01-30 00:00:00	24:00:00
+2012-01-30 00:00:00	48:00:00
+2012-01-31 00:00:00	24:00:00
+2012-01-31 00:00:00	48:00:00
+2012-02-01 00:00:00	48:00:00
+DROP TABLE t1,t2;
+
+# Original test of the bug report
+
+CREATE TABLE t1 (
+pk INT NOT NULL AUTO_INCREMENT,
+col_int_nokey INT,
+col_int_key INT NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (10,1,7), (11,7,0), (12,4,9), (13,7,3),
+(14,0,4), (15,2,2), (16,9,5), (17,4,3), (18,0,1), (19,9,3), (20,1,6),
+(21,3,7), (22,8,5), (23,8,1), (24,18,204), (25,84,224), (26,6,9),
+(27,3,5), (28,6,0), (29,6,3);
+CREATE TABLE t2 (
+col_int_nokey INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_datetime_key (col_datetime_key),
+KEY col_varchar_key (col_varchar_key)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,'2001-11-04 19:07:55','k');
+CREATE TABLE t3 (
+col_time_key TIME,
+KEY col_time_key (col_time_key)
+) ENGINE=InnoDB;
+INSERT INTO t3 VALUES ('21:22:34'), ('10:50:38'), ('00:21:38'),
+('04:08:02'), ('16:25:11'), ('10:14:58'), ('19:47:59'), ('11:14:24'),
+('00:00:00'), ('00:00:00'), ('15:57:25'), ('07:05:51'), ('19:22:21'),
+('03:53:16'), ('09:16:38'), ('15:37:26'), ('00:00:00'), ('05:03:03'),
+('02:59:24'), ('00:01:58');
+EXPLAIN EXTENDED SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key)
+ON t3.col_time_key > t2.col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	1	100.00	
+1	SIMPLE	t3	ALL	col_time_key	NULL	NULL	NULL	20	100.00	Range checked for each record (index map: 0x1)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_int_nokey` AS `col_int_nokey`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t2`.`col_varchar_key` AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t2` straight_join `test`.`t3` FORCE INDEX (`col_time_key`) where (`test`.`t3`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key)
+ON t3.col_time_key > t2.col_datetime_key;
+col_int_nokey	col_datetime_key	col_varchar_key	col_time_key
+1	2001-11-04 19:07:55	k	00:00:00
+1	2001-11-04 19:07:55	k	00:00:00
+1	2001-11-04 19:07:55	k	00:00:00
+1	2001-11-04 19:07:55	k	00:01:58
+1	2001-11-04 19:07:55	k	00:21:38
+1	2001-11-04 19:07:55	k	02:59:24
+1	2001-11-04 19:07:55	k	03:53:16
+1	2001-11-04 19:07:55	k	04:08:02
+1	2001-11-04 19:07:55	k	05:03:03
+1	2001-11-04 19:07:55	k	07:05:51
+1	2001-11-04 19:07:55	k	09:16:38
+1	2001-11-04 19:07:55	k	10:14:58
+1	2001-11-04 19:07:55	k	10:50:38
+1	2001-11-04 19:07:55	k	11:14:24
+1	2001-11-04 19:07:55	k	15:37:26
+1	2001-11-04 19:07:55	k	15:57:25
+1	2001-11-04 19:07:55	k	16:25:11
+1	2001-11-04 19:07:55	k	19:22:21
+1	2001-11-04 19:07:55	k	19:47:59
+1	2001-11-04 19:07:55	k	21:22:34
+EXPLAIN EXTENDED SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key)
+ON t3.col_time_key > t2.col_datetime_key;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t2	ALL	col_datetime_key	NULL	NULL	NULL	1	100.00	
+1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	20	100.00	Using where; Using join buffer (Block Nested Loop)
+Warnings:
+Note	1003	/* select#1 */ select `test`.`t2`.`col_int_nokey` AS `col_int_nokey`,`test`.`t2`.`col_datetime_key` AS `col_datetime_key`,`test`.`t2`.`col_varchar_key` AS `col_varchar_key`,`test`.`t3`.`col_time_key` AS `col_time_key` from `test`.`t2` straight_join `test`.`t3` IGNORE INDEX (`col_time_key`) where (`test`.`t3`.`col_time_key` > `test`.`t2`.`col_datetime_key`)
+SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key)
+ON t3.col_time_key > t2.col_datetime_key;
+col_int_nokey	col_datetime_key	col_varchar_key	col_time_key
+1	2001-11-04 19:07:55	k	00:00:00
+1	2001-11-04 19:07:55	k	00:00:00
+1	2001-11-04 19:07:55	k	00:00:00
+1	2001-11-04 19:07:55	k	00:01:58
+1	2001-11-04 19:07:55	k	00:21:38
+1	2001-11-04 19:07:55	k	02:59:24
+1	2001-11-04 19:07:55	k	03:53:16
+1	2001-11-04 19:07:55	k	04:08:02
+1	2001-11-04 19:07:55	k	05:03:03
+1	2001-11-04 19:07:55	k	07:05:51
+1	2001-11-04 19:07:55	k	09:16:38
+1	2001-11-04 19:07:55	k	10:14:58
+1	2001-11-04 19:07:55	k	10:50:38
+1	2001-11-04 19:07:55	k	11:14:24
+1	2001-11-04 19:07:55	k	15:37:26
+1	2001-11-04 19:07:55	k	15:57:25
+1	2001-11-04 19:07:55	k	16:25:11
+1	2001-11-04 19:07:55	k	19:22:21
+1	2001-11-04 19:07:55	k	19:47:59
+1	2001-11-04 19:07:55	k	21:22:34
+EXPLAIN EXTENDED SELECT outr.col_int_nokey
+FROM t2 as outr
+STRAIGHT_JOIN t3 AS outr2
+ON outr2.col_time_key > outr.col_datetime_key
+WHERE outr.col_int_nokey IN (
+SELECT col_int_key
+FROM t1 AS innr
+WHERE innr.pk >= innr.col_int_nokey
+) AND (
+outr.col_int_nokey <= 6
+OR
+outr.col_varchar_key IS NULL
+);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	outr	ALL	col_datetime_key	NULL	NULL	NULL	1	100.00	Using where
+1	PRIMARY	outr2	ALL	col_time_key	NULL	NULL	NULL	20	100.00	Range checked for each record (index map: 0x1)
+2	DEPENDENT SUBQUERY	innr	index_subquery	col_int_key	col_int_key	4	func	1	100.00	Using where
+Warnings:
+Note	1003	/* select#1 */ select `test`.`outr`.`col_int_nokey` AS `col_int_nokey` from `test`.`t2` `outr` straight_join `test`.`t3` `outr2` where (<in_optimizer>(`test`.`outr`.`col_int_nokey`,<exists>(<index_lookup>(<cache>(`test`.`outr`.`col_int_nokey`) in t1 on col_int_key where ((`test`.`innr`.`pk` >= `test`.`innr`.`col_int_nokey`) and (<cache>(`test`.`outr`.`col_int_nokey`) = `test`.`innr`.`col_int_key`))))) and (`test`.`outr`.`col_int_nokey` <= 6) and (`test`.`outr2`.`col_time_key` > `test`.`outr`.`col_datetime_key`))
+SELECT outr.col_int_nokey
+FROM t2 as outr
+STRAIGHT_JOIN t3 AS outr2
+ON outr2.col_time_key > outr.col_datetime_key
+WHERE outr.col_int_nokey IN (
+SELECT col_int_key
+FROM t1 AS innr
+WHERE innr.pk >= innr.col_int_nokey
+) AND (
+outr.col_int_nokey <= 6
+OR
+outr.col_varchar_key IS NULL
+);
+col_int_nokey
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+DROP TABLE t1,t2,t3;
+SET TIMESTAMP=0;
 #
 # End of 5.6 tests
 #

=== modified file 'mysql-test/suite/binlog/r/binlog_unsafe.result'
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result	2012-02-09 20:26:08 +0000
@@ -1760,7 +1760,7 @@ SELECT COUNT(*) FROM mysql.general_log;
 
 Invoking function func_sidef_1 invoking statement that is unsafe in many ways.
 CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; RETURN 0; END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t1 SELECT func_sidef_1();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1769,12 +1769,13 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
 Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
 CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1783,13 +1784,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
 CREATE PROCEDURE proc_2() BEGIN INSERT INTO t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_2();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1798,13 +1800,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
 CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1813,6 +1816,7 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
@@ -1826,7 +1830,8 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
-* binlog_format = STATEMENT: expect 6 warnings.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT * FROM view_sidef_2;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1835,13 +1840,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP VIEW view_sidef_2;
 
 Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
 PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_2;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1850,6 +1856,7 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1857,7 +1864,7 @@ DROP FUNCTION func_sidef_1;
 
 Invoking procedure proc_1 invoking statement that is unsafe in many ways.
 CREATE PROCEDURE proc_1() BEGIN INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; INSERT INTO ta1 VALUES (47); END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_1();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1866,12 +1873,13 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
 Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
 CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1880,13 +1888,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
 CREATE PROCEDURE proc_2() BEGIN CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_2();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1895,13 +1904,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
 CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1910,13 +1920,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
 
 Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
 PREPARE prep_2 FROM "CALL proc_1()";
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_2;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1925,6 +1936,7 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -1932,7 +1944,7 @@ DROP PROCEDURE proc_1;
 
 Invoking trigger trig_1 invoking statement that is unsafe in many ways.
 CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_1 VALUES (1);
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1941,12 +1953,13 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 
 Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
 CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO t2 SELECT func_sidef_2();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1955,13 +1968,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP FUNCTION func_sidef_2;
 
 Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
 CREATE PROCEDURE proc_2() BEGIN INSERT INTO trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 CALL proc_2();
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1970,13 +1984,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PROCEDURE proc_2;
 
 Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
 CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT INTO trigger_table_2 VALUES (1);
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -1985,13 +2000,14 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP TRIGGER trig_2;
 
 Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
 PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_2;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -2000,6 +2016,7 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_2;
@@ -2007,7 +2024,7 @@ DROP TRIGGER trig_1;
 
 Invoking prepared statement prep_1 invoking statement that is unsafe in many ways.
 PREPARE prep_1 FROM "INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1";
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 EXECUTE prep_1;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -2016,12 +2033,13 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 DROP PREPARE prep_1;
 
 Invoking statement that is unsafe in many ways.
-* binlog_format = STATEMENT: expect 6 warnings.
+* binlog_format = STATEMENT: expect 7 warnings.
 INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
@@ -2030,6 +2048,7 @@ Note	1592	Unsafe statement written to th
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 * SQL_LOG_BIN = 0: expect nothing logged and no warning.
 * binlog_format = MIXED: expect row events in binlog and no warning.
 

=== modified file 'mysql-test/suite/binlog/t/binlog_unsafe.test'
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test	2012-02-09 20:26:08 +0000
@@ -233,7 +233,7 @@ while ($unsafe_type < 9) {
     --let $value_0=
     --let $sel_sidef_0=
     --let $sel_retval_0=
-    --let $CRC_ARG_expected_number_of_warnings= 6
+    --let $CRC_ARG_expected_number_of_warnings= 7
   }
 
   if ($unsafe_type == 8) {

=== added file 'mysql-test/suite/innodb/r/innodb-index-debug.result'
--- a/mysql-test/suite/innodb/r/innodb-index-debug.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb-index-debug.result	2012-02-10 04:40:19 +0000
@@ -0,0 +1,26 @@
+set global innodb_file_per_table=on;
+set global innodb_file_format='Barracuda';
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) NOT NULL,
+  `c2` int(11) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
+SET SESSION DEBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
+ALTER TABLE t1 ADD UNIQUE INDEX(c2);
+ERROR HY000: Too many active concurrent transactions
+SET SESSION DEBUG=DEFAULT;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) NOT NULL,
+  `c2` int(11) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+set global innodb_file_per_table=0;
+set global innodb_file_format=Antelope;
+set global innodb_file_format_max=Antelope;

=== added file 'mysql-test/suite/innodb/t/innodb-index-debug.test'
--- a/mysql-test/suite/innodb/t/innodb-index-debug.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb-index-debug.test	2012-02-10 04:40:19 +0000
@@ -0,0 +1,28 @@
+-- source include/have_debug.inc
+-- source include/have_innodb.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+let $per_table=`select @@innodb_file_per_table`;
+let $format=`select @@innodb_file_format`;
+set global innodb_file_per_table=on;
+set global innodb_file_format='Barracuda';
+
+#
+# Test for BUG# 12739098, check whether trx->error_status is reset on error.
+#
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
+
+SET SESSION DEBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
+--error ER_TOO_MANY_CONCURRENT_TRXS
+ALTER TABLE t1 ADD UNIQUE INDEX(c2);
+SET SESSION DEBUG=DEFAULT;
+
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+eval set global innodb_file_per_table=$per_table;
+eval set global innodb_file_format=$format;
+eval set global innodb_file_format_max=$format;

=== modified file 'mysql-test/suite/innodb/t/innodb-index.test'
--- a/mysql-test/suite/innodb/t/innodb-index.test	2012-02-02 12:00:50 +0000
+++ b/mysql-test/suite/innodb/t/innodb-index.test	2012-02-10 04:40:19 +0000
@@ -375,4 +375,3 @@ disconnect a;
 disconnect b;
 
 DROP TABLE t1,t2;
-

=== modified file 'mysql-test/suite/opt_trace/r/temp_table.result'
--- a/mysql-test/suite/opt_trace/r/temp_table.result	2012-01-04 09:51:39 +0000
+++ b/mysql-test/suite/opt_trace/r/temp_table.result	2012-02-10 09:06:59 +0000
@@ -516,4 +516,132 @@ SELECT uniq, col1, col2 FROM t1 GROUP BY
   ] /* steps */
 }	0	0
 SET GLOBAL tmp_table_size= @old_size;
+SELECT pool_id FROM information_schema.innodb_buffer_page LIMIT 1;
+pool_id
+0
+SELECT * FROM information_schema.OPTIMIZER_TRACE;
+QUERY	TRACE	MISSING_BYTES_BEYOND_MAX_MEM_SIZE	INSUFFICIENT_PRIVILEGES
+SELECT pool_id FROM information_schema.innodb_buffer_page LIMIT 1	{
+  "steps": [
+    {
+      "creating_tmp_table": {
+        "tmp_table_info": {
+          "database": "information_schema",
+          "table": "innodb_buffer_page",
+          "row_length": 6852,
+          "key_length": 0,
+          "unique_constraint": false,
+          "location": "memory (heap)",
+          "row_limit_estimate": 1
+        } /* tmp_table_info */
+      } /* creating_tmp_table */
+    },
+    {
+      "join_preparation": {
+        "select#": 1,
+        "steps": [
+          {
+            "expanded_query": "/* select#1 */ select `information_schema`.`innodb_buffer_page`.`POOL_ID` AS `pool_id` from `information_schema`.`innodb_buffer_page` limit 1"
+          }
+        ] /* steps */
+      } /* join_preparation */
+    },
+    {
+      "join_optimization": {
+        "select#": 1,
+        "steps": [
+          {
+            "table_dependencies": [
+              {
+                "database": "information_schema",
+                "table": "innodb_buffer_page",
+                "row_may_be_null": false,
+                "map_bit": 0,
+                "depends_on_map_bits": [
+                ] /* depends_on_map_bits */
+              }
+            ] /* table_dependencies */
+          },
+          {
+            "rows_estimation": [
+              {
+                "database": "information_schema",
+                "table": "innodb_buffer_page",
+                "table_scan": {
+                  "rows": 2,
+                  "cost": 10
+                } /* table_scan */
+              }
+            ] /* rows_estimation */
+          },
+          {
+            "considered_execution_plans": [
+              {
+                "database": "information_schema",
+                "table": "innodb_buffer_page",
+                "best_access_path": {
+                  "considered_access_paths": [
+                    {
+                      "access_type": "scan",
+                      "rows": 2,
+                      "cost": 10.1,
+                      "chosen": true
+                    }
+                  ] /* considered_access_paths */
+                } /* best_access_path */,
+                "cost_for_plan": 10.5,
+                "rows_for_plan": 2,
+                "chosen": true
+              }
+            ] /* considered_execution_plans */
+          },
+          {
+            "attaching_conditions_to_tables": {
+              "original_condition": null,
+              "attached_conditions_computation": [
+              ] /* attached_conditions_computation */,
+              "attached_conditions_summary": [
+                {
+                  "database": "information_schema",
+                  "table": "innodb_buffer_page",
+                  "attached": null
+                }
+              ] /* attached_conditions_summary */
+            } /* attaching_conditions_to_tables */
+          },
+          {
+            "refine_plan": [
+              {
+                "database": "information_schema",
+                "table": "innodb_buffer_page",
+                "access_type": "table_scan"
+              }
+            ] /* refine_plan */
+          }
+        ] /* steps */
+      } /* join_optimization */
+    },
+    {
+      "join_execution": {
+        "select#": 1,
+        "steps": [
+          {
+            "converting_tmp_table_to_myisam": {
+              "cause": "memory_table_size_exceeded",
+              "tmp_table_info": {
+                "database": "information_schema",
+                "table": "innodb_buffer_page",
+                "row_length": 6852,
+                "key_length": 0,
+                "unique_constraint": false,
+                "location": "disk (MyISAM)",
+                "record_format": "packed"
+              } /* tmp_table_info */
+            } /* converting_tmp_table_to_myisam */
+          }
+        ] /* steps */
+      } /* join_execution */
+    }
+  ] /* steps */
+}	0	0
 DROP TABLE t1, tmp;

=== modified file 'mysql-test/suite/opt_trace/t/temp_table.test'
--- a/mysql-test/suite/opt_trace/t/temp_table.test	2011-11-18 12:17:45 +0000
+++ b/mysql-test/suite/opt_trace/t/temp_table.test	2012-02-10 09:06:59 +0000
@@ -45,4 +45,9 @@ SELECT * FROM information_schema.OPTIMIZ
 
 SET GLOBAL tmp_table_size= @old_size;
 
+# Temp tables for I_S tables. Uses HEAP temporary table. 
+# Converts it to MyISAM packed record format due to heap size limitation
+SELECT pool_id FROM information_schema.innodb_buffer_page LIMIT 1;
+SELECT * FROM information_schema.OPTIMIZER_TRACE;
+
 DROP TABLE t1, tmp;

=== modified file 'mysql-test/suite/rpl/r/rpl_auto_increment_11932.result'
--- a/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment_11932.result	2012-02-09 20:26:08 +0000
@@ -3,6 +3,7 @@ Warnings:
 Note	1756	Sending passwords in plain text without SSL/TLS is extremely insecure.
 Note	1757	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
 [connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
 drop database if exists test1;
 create database test1;
 use test1;

=== modified file 'mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result'
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result	2012-02-13 08:50:03 +0000
@@ -864,7 +864,8 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 SELECT * FROM t1
+master-bin.000001	#	Table_map	#	#	table_id: # (test_rpl.t2)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test_rpl`; INSERT INTO t2 VALUES (1, 't1, text 1') ON DUPLICATE KEY UPDATE b = 't2, text 1'

=== modified file 'mysql-test/suite/rpl/r/rpl_insert_id_pk.result'
--- a/mysql-test/suite/rpl/r/rpl_insert_id_pk.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_insert_id_pk.result	2012-02-09 20:26:08 +0000
@@ -3,6 +3,7 @@ Warnings:
 Note	1756	Sending passwords in plain text without SSL/TLS is extremely insecure.
 Note	1757	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
 [connection master]
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
 create table t1(a int auto_increment, primary key(a));
 create table t2(b int auto_increment, c int, primary key(b));
 insert into t1 values (1),(2),(3);

=== modified file 'mysql-test/suite/rpl/r/rpl_known_bugs_detection.result'
--- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result	2011-12-26 17:21:34 +0000
+++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result	2012-02-13 08:50:03 +0000
@@ -49,6 +49,7 @@ ON DUPLICATE KEY UPDATE
 t1.field_3 = t2.field_c;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
 INSERT INTO t1 (field_1, field_2, field_3)
 SELECT t2.field_a, t2.field_b, t2.field_c
@@ -57,6 +58,7 @@ ON DUPLICATE KEY UPDATE
 t1.field_3 = t2.field_c;
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave.
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
 SELECT * FROM t1;
 id	field_1	field_2	field_3
 1	1	a	1a

=== modified file 'mysql-test/suite/rpl/r/rpl_multi_update.result'
--- a/mysql-test/suite/rpl/r/rpl_multi_update.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_multi_update.result	2012-02-09 20:26:08 +0000
@@ -3,6 +3,7 @@ Warnings:
 Note	1756	Sending passwords in plain text without SSL/TLS is extremely insecure.
 Note	1757	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
 [connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
 CREATE TABLE t1 (
 a int unsigned not null auto_increment primary key,
 b int unsigned

=== modified file 'mysql-test/suite/rpl/r/rpl_multi_update2.result'
--- a/mysql-test/suite/rpl/r/rpl_multi_update2.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_multi_update2.result	2012-02-09 20:26:08 +0000
@@ -3,6 +3,7 @@ Warnings:
 Note	1756	Sending passwords in plain text without SSL/TLS is extremely insecure.
 Note	1757	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
 [connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
 drop table if exists t1,t2;
 CREATE TABLE t1 (
 a int unsigned not null auto_increment primary key,

=== modified file 'mysql-test/suite/rpl/r/rpl_multi_update3.result'
--- a/mysql-test/suite/rpl/r/rpl_multi_update3.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_multi_update3.result	2012-02-09 20:26:08 +0000
@@ -3,6 +3,7 @@ Warnings:
 Note	1756	Sending passwords in plain text without SSL/TLS is extremely insecure.
 Note	1757	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
 [connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
 
 -------- Test for BUG#9361 --------
 CREATE TABLE t1 (

=== modified file 'mysql-test/suite/rpl/r/rpl_rotate_logs.result'
--- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result	2012-02-09 20:26:08 +0000
@@ -1,3 +1,4 @@
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
 CALL mtr.add_suppression("Failed to open the existing info file");
 CALL mtr.add_suppression("Error while reading from master info file");
 CALL mtr.add_suppression("Failed to create a new info file");

=== modified file 'mysql-test/suite/rpl/t/rpl_auto_increment_11932.test'
--- a/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/t/rpl_auto_increment_11932.test	2012-02-09 20:26:08 +0000
@@ -8,6 +8,7 @@
 # Test supplied by Are Casilla
 
 source include/master-slave.inc;
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
 --disable_warnings
 connection master;
 drop database if exists test1;
@@ -42,12 +43,16 @@ CREATE PROCEDURE simpleproc3 ()
     $
 DELIMITER ;$
 
+--disable_warnings
 CALL simpleproc3();
+--enable_warnings
 
 select * from t2;
 
 TRUNCATE TABLE `t1`;
+--disable_warnings
 CALL simpleproc3();
+--enable_warnings
 
 select * from t1;
 

=== modified file 'mysql-test/suite/rpl/t/rpl_multi_update2.test'
--- a/mysql-test/suite/rpl/t/rpl_multi_update2.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/t/rpl_multi_update2.test	2012-02-09 20:26:08 +0000
@@ -6,6 +6,7 @@
 #######################################################
 --source include/not_ndb_default.inc
 --source include/master-slave.inc
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
 let $engine_type=MyISAM;
 --source extra/rpl_tests/rpl_multi_update2.test
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_multi_update3.test'
--- a/mysql-test/suite/rpl/t/rpl_multi_update3.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/t/rpl_multi_update3.test	2012-02-09 20:26:08 +0000
@@ -6,6 +6,7 @@
 #######################################################
 --source include/not_ndb_default.inc
 --source include/master-slave.inc
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
 let $engine_type=MyISAM;
 -- source extra/rpl_tests/rpl_multi_update3.test
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_optimize.test'
--- a/mysql-test/suite/rpl/t/rpl_optimize.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/t/rpl_optimize.test	2012-02-09 20:26:08 +0000
@@ -19,6 +19,7 @@ enable_query_log;
 
 create table t1 (a int not null auto_increment primary key, b int, key(b));
 INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+--disable_warnings
 INSERT INTO t1 (a) SELECT null FROM t1;
 INSERT INTO t1 (a) SELECT null FROM t1;
 INSERT INTO t1 (a) SELECT null FROM t1;
@@ -32,6 +33,7 @@ INSERT INTO t1 (a) SELECT null FROM t1;
 INSERT INTO t1 (a) SELECT null FROM t1;
 INSERT INTO t1 (a) SELECT null FROM t1;
 INSERT INTO t1 (a) SELECT null FROM t1;
+--enable_warnings
 save_master_pos;
 # a few updates to force OPTIMIZE to do something
 --disable_warnings

=== modified file 'mysql-test/suite/rpl/t/rpl_rotate_logs.test'
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test	2012-02-09 20:26:08 +0000
@@ -28,6 +28,7 @@ chmod 0000 $MYSQLD_SLAVE_DATADIR/master.
 connection slave;
 
 --disable_result_log
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
 CALL mtr.add_suppression("Failed to open the existing info file");
 CALL mtr.add_suppression("Error while reading from master info file");
 CALL mtr.add_suppression("Failed to create a new info file");

=== modified file 'mysql-test/suite/rpl/t/rpl_semi_sync_event.test'
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test	2012-02-09 20:26:08 +0000
@@ -52,9 +52,10 @@ SET GLOBAL event_scheduler = ON;
 replace_result $engine_type ENGINE_TYPE;
 eval CREATE TABLE t1 (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f varchar(8)) ENGINE=$engine_type;
 INSERT INTO t1 (f) VALUES ('a'),('a'),('a'),('a'),('a');
+--disable_warnings
 INSERT INTO t1 SELECT i+5, f FROM t1;
 INSERT INTO t1 SELECT i+10, f FROM t1;
-
+--enable_warnings
 CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
 DO INSERT INTO t1 VALUES (SLEEP(5),CONCAT('ev1_',CONNECTION_ID()));
 CREATE EVENT ev2 ON SCHEDULE EVERY 1 SECOND

=== modified file 'mysql-test/suite/rpl/t/rpl_timezone.test'
--- a/mysql-test/suite/rpl/t/rpl_timezone.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/suite/rpl/t/rpl_timezone.test	2012-02-09 20:26:08 +0000
@@ -13,14 +13,14 @@
 # timezone used in CONVERT_TZ is not binlogged. To debug (by Guilhem
 # and possibly Konstantin).
 
+source include/master-slave.inc;
+
 --disable_query_log
 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
 --enable_query_log
 
 --disable_ps_protocol
 
-source include/master-slave.inc;
-
 # Save original timezone
 set @my_time_zone= @@global.time_zone;
 
@@ -90,6 +90,7 @@ insert into t1 values ('20040101000000',
 # from originally inserted)
 #
 set time_zone='MET';
+--disable_warnings ONCE
 insert into t2 (select * from t1);
 SELECT * FROM t1 ORDER BY n;
 sync_slave_with_master;

=== modified file 'mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	2011-12-08 09:14:27 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	2012-02-09 16:24:17 +0000
@@ -13,6 +13,9 @@ SELECT @orig;
 # 'Buffer pool(s) dump completed at ' left from previous runs because if
 # it is then the following wait condition may be satisfied without the
 # dump actually being complete and file_exists may fail.
+let $status_var = innodb_buffer_pool_dump_status;
+let $status_var_value = not started;
+-- source include/wait_for_status_var.inc
 SELECT variable_value
 FROM information_schema.global_status
 WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';

=== added file 'mysql-test/t/archive_no_symlink-master.opt'
--- a/mysql-test/t/archive_no_symlink-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/archive_no_symlink-master.opt	2012-02-10 21:18:47 +0000
@@ -0,0 +1 @@
+--skip-symbolic-links

=== added file 'mysql-test/t/archive_no_symlink.test'
--- a/mysql-test/t/archive_no_symlink.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/archive_no_symlink.test	2012-02-10 21:18:47 +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;
+

=== added file 'mysql-test/t/archive_symlink.test'
--- a/mysql-test/t/archive_symlink.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/archive_symlink.test	2012-02-10 22:43:46 +0000
@@ -0,0 +1,72 @@
+# Test archive engine when symbolic links are available.
+--source include/not_windows.inc
+--source include/have_archive.inc
+
+# DATA DIRECTORY/INDEX DIRECTORY require symbolic link support
+--source include/have_symlink.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $data_directory = DATA DIRECTORY = '$MYSQL_TMP_DIR/archive';
+let $index_directory = INDEX DIRECTORY = '$MYSQL_TMP_DIR/archive';
+
+--echo # 
+--echo # Archive can only use an existing directory for DATA DIRECTORY.
+--echo # 
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--error ER_CANT_CREATE_TABLE
+eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+     ENGINE archive $data_directory $index_directory;
+
+--echo # 
+--echo # mkdir MYSQL_TMP_DIR/archive and try again... 
+--echo # Archive will use a symlink for DATA DIRECTORY but ignore INDEX DIRECTORY.
+--echo # 
+--mkdir $MYSQL_TMP_DIR/archive
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+     ENGINE archive $data_directory $index_directory;
+INSERT INTO t1 VALUES (NULL, "blue");
+INSERT INTO t1 VALUES (NULL, "red");
+INSERT INTO t1 VALUES (NULL, "yellow");
+--echo # Checking if archive file exists where we specified in DATA DIRECTORY
+--file_exists $MYSQL_TMP_DIR/archive/t1.ARZ
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo # 
+--echo # Be sure SQL MODE "NO_DIR_IN_CREATE" prevents the use of DATA DIRECTORY
+--echo # 
+SET @org_mode=@@sql_mode;
+SET @@sql_mode='NO_DIR_IN_CREATE';
+SELECT @@sql_mode;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+     ENGINE archive $data_directory;
+INSERT INTO t1 VALUES (NULL, "blue");
+INSERT INTO t1 VALUES (NULL, "red");
+INSERT INTO t1 VALUES (NULL, "yellow");
+--echo # Checking if archive file exists in --datadir since DATA DIRECTORY was ignored.
+--file_exists $MYSQLD_DATADIR/test/t1.ARZ
+DROP TABLE t1;
+set @@sql_mode=@org_mode;
+
+--echo # 
+--echo # MySQL engine does not allow DATA DIRECTORY to be
+--echo # within --datadir for any engine, including Archive
+--echo # 
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--error ER_WRONG_ARGUMENTS
+eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
+     ENGINE archive DATA DIRECTORY '$MYSQLD_DATADIR/test';
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--error ER_WRONG_ARGUMENTS
+eval CREATE TABLE t1 (c1 int(10), PRIMARY KEY (c1))
+ENGINE archive INDEX DIRECTORY '$MYSQLD_DATADIR/test';
+
+--echo # 
+--echo # Cleanup
+--echo # 
+--rmdir $MYSQL_TMP_DIR/archive
+

=== modified file 'mysql-test/t/lock.test'
--- a/mysql-test/t/lock.test	2011-10-19 10:15:25 +0000
+++ b/mysql-test/t/lock.test	2012-02-13 09:45:43 +0000
@@ -550,6 +550,23 @@ UNLOCK TABLES;
 DROP TABLE t1, t2;
 disconnect con2;
 
+--echo #
+--echo # Bug#13586314 - RUNTIME - HIBISCUS: ISSUE DEPRECATION
+--echo # WARNING FOR LOW_PRIORITY MODIFIER
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+--echo # Below statement should return a deprecation warning
+LOCK TABLES t1 LOW_PRIORITY WRITE;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+--echo # End of Bug#13586314
+
 
 --echo #
 --echo # End of 6.0 tests.

=== modified file 'mysql-test/t/multi_update.test'
--- a/mysql-test/t/multi_update.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/t/multi_update.test	2012-02-13 08:50:03 +0000
@@ -6,6 +6,8 @@
 source include/not_embedded.inc;
 source include/have_log_bin.inc;
 
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+
 --disable_warnings
 drop table if exists t1,t2,t3;
 drop database if exists mysqltest;
@@ -352,6 +354,7 @@ create table `t2` (`c2_id` int(10) unsig
 insert into t1 values (0,'A01-Comp',1);
 insert into t1 values (0,'B01-Comp',1);
 insert into t2 values (0,1,'A Note',1);
+--disable_warnings ONCE
 update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
 select * from t1;
 select * from t2;

=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test	2012-02-08 06:45:31 +0000
+++ b/mysql-test/t/ps.test	2012-02-09 20:26:08 +0000
@@ -1,5 +1,6 @@
 -- source include/not_embedded.inc
 -- source include/have_log_bin.inc
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); 
 #
 # SQL Syntax for Prepared Statements test
 #
@@ -238,8 +239,10 @@ prepare stmt1 from "select 1 into @var";
 execute stmt1;
 execute stmt1;
 prepare stmt1 from "create table t1 select 1 as i";
+--disable_warnings ONCE
 execute stmt1;
 drop table t1;
+--disable_warnings ONCE
 execute stmt1;
 prepare stmt1 from "insert into t1 select i from t1";
 execute stmt1;
@@ -431,6 +434,7 @@ deallocate prepare stmt;
 create table t1 (a int); 
 insert into t1 values (1),(2),(3);
 create table t2 select * from t1;
+--disable_warnings
 prepare stmt FROM 'create table t2 select * from t1';
 drop table t2;
 execute stmt;
@@ -440,6 +444,7 @@ execute stmt;
 execute stmt;
 drop table t2;
 execute stmt;
+--enable_warnings
 drop table t1,t2;
 deallocate prepare stmt;
 
@@ -1172,6 +1177,7 @@ create database mysqltest character set 
 prepare stmt1 from "create table mysqltest.t1 (c char(10))";
 prepare stmt2 from "create table mysqltest.t2 select 'test'";
 execute stmt1;
+--disable_warnings ONCE
 execute stmt2;
 show create table mysqltest.t1;
 show create table mysqltest.t2;
@@ -1179,6 +1185,7 @@ drop table mysqltest.t1;
 drop table mysqltest.t2;
 alter database mysqltest character set latin1;
 execute stmt1;
+--disable_warnings ONCE
 execute stmt2;
 show create table mysqltest.t1;
 show create table mysqltest.t2;

=== modified file 'mysql-test/t/type_time.test'
--- a/mysql-test/t/type_time.test	2012-02-07 20:32:47 +0000
+++ b/mysql-test/t/type_time.test	2012-02-09 17:07:12 +0000
@@ -266,5 +266,180 @@ SELECT TIME(MIN(a)) FROM t1;
 DROP TABLE t1;
 
 --echo #
+--echo # Bug#13623473 "MISSING ROWS ON SELECT AND JOIN WITH
+--echo # TIME/DATETIME COMPARE"
+--echo #
+
+--echo # Systematic testing of ref access and range scan
+
+SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
+
+CREATE TABLE t1 (col_time_key TIME, KEY(col_time_key)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('00:00:00'),('-24:00:00'),('-48:00:00'),('24:00:00'),('48:00:00');
+CREATE TABLE t2 (col_datetime_key DATETIME, KEY(col_datetime_key)) ENGINE=InnoDB;
+INSERT INTO t2 SELECT * FROM t1;
+
+let $cnt_0=5;
+let $operator= =;
+# For operator in =, >=, >, <=, <
+while ($cnt_0)
+{  
+  let $cnt_1=2;
+  let $first_table=t1;
+  # for table in t1,t2
+  while ($cnt_1)
+  {
+    if ($first_table==t1)
+    {
+      let $first_index=col_time_key;
+      let $second_table=t2;
+      let $second_index=col_datetime_key;
+    }
+    if ($first_table==t2)
+    {
+      let $first_index=col_datetime_key;
+      let $second_table=t1;
+      let $second_index=col_time_key;
+    }
+    let $cnt_2=2;
+    let $first_index_hint=ignore;
+    # for first_index_hint in ignore,force
+    while ($cnt_2)
+    {
+      let $cnt_3=2;
+      let $second_index_hint=ignore;
+      # for second_index_hint in ignore, force
+      while ($cnt_3)
+      {
+        let $cnt_4=2;
+        let $first_operand=col_time_key;
+        # for first_operand in col_time_key, col_datetime_key
+        while ($cnt_4)
+        {
+          if ($first_operand==col_time_key)
+          {
+            let $second_operand=col_datetime_key;
+          }
+          if ($first_operand==col_datetime_key)
+          {
+            let $second_operand=col_time_key;
+          }
+  
+          eval EXPLAIN EXTENDED SELECT * FROM
+               $first_table $first_index_hint INDEX ($first_index)
+               STRAIGHT_JOIN
+               $second_table $second_index_hint INDEX ($second_index)
+               WHERE $first_operand $operator $second_operand;
+          --sorted_result
+          eval SELECT * FROM
+               $first_table $first_index_hint INDEX ($first_index)
+               STRAIGHT_JOIN
+               $second_table $second_index_hint INDEX ($second_index)
+               WHERE $first_operand $operator $second_operand;
+  
+          let $first_operand=col_datetime_key;
+          dec $cnt_4;
+        }
+        let $second_index_hint=force;
+        dec $cnt_3;
+      }
+      let $first_index_hint=force;
+      dec $cnt_2;
+    }
+    let $first_table=t2;
+    dec $cnt_1;
+  }
+  if ($cnt_0==5)
+  {
+    let $operator= >=;
+  }
+  if ($cnt_0==4)
+  {
+    let $operator= >;
+  }
+  if ($cnt_0==3)
+  {
+    let $operator= <=;
+  }
+  if ($cnt_0==2)
+  {
+    let $operator= <;
+  }
+  dec $cnt_0;
+}
+
+DROP TABLE t1,t2;
+
+--echo
+--echo # Original test of the bug report
+--echo
+
+CREATE TABLE t1 (
+  pk INT NOT NULL AUTO_INCREMENT,
+  col_int_nokey INT,
+  col_int_key INT NOT NULL,
+  PRIMARY KEY (pk),
+  KEY col_int_key (col_int_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (10,1,7), (11,7,0), (12,4,9), (13,7,3),
+(14,0,4), (15,2,2), (16,9,5), (17,4,3), (18,0,1), (19,9,3), (20,1,6),
+(21,3,7), (22,8,5), (23,8,1), (24,18,204), (25,84,224), (26,6,9),
+(27,3,5), (28,6,0), (29,6,3);
+
+CREATE TABLE t2 (
+  col_int_nokey INT NOT NULL,
+  col_datetime_key DATETIME NOT NULL,
+  col_varchar_key VARCHAR(1) NOT NULL,
+  KEY col_datetime_key (col_datetime_key),
+  KEY col_varchar_key (col_varchar_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES (1,'2001-11-04 19:07:55','k');
+
+CREATE TABLE t3 (
+  col_time_key TIME,
+  KEY col_time_key (col_time_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t3 VALUES ('21:22:34'), ('10:50:38'), ('00:21:38'),
+('04:08:02'), ('16:25:11'), ('10:14:58'), ('19:47:59'), ('11:14:24'),
+('00:00:00'), ('00:00:00'), ('15:57:25'), ('07:05:51'), ('19:22:21'),
+('03:53:16'), ('09:16:38'), ('15:37:26'), ('00:00:00'), ('05:03:03'),
+('02:59:24'), ('00:01:58');
+
+let $query=SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key)
+           ON t3.col_time_key > t2.col_datetime_key;
+eval EXPLAIN EXTENDED $query;
+--sorted_result
+eval $query;
+
+let $query=SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key)
+           ON t3.col_time_key > t2.col_datetime_key;
+eval EXPLAIN EXTENDED $query;
+--sorted_result
+eval $query;
+
+let $query=SELECT outr.col_int_nokey
+FROM t2 as outr
+  STRAIGHT_JOIN t3 AS outr2
+  ON outr2.col_time_key > outr.col_datetime_key
+WHERE outr.col_int_nokey IN (
+  SELECT col_int_key
+  FROM t1 AS innr
+  WHERE innr.pk >= innr.col_int_nokey
+) AND (
+  outr.col_int_nokey <= 6
+  OR
+  outr.col_varchar_key IS NULL
+);
+eval EXPLAIN EXTENDED $query;
+--sorted_result
+eval $query;
+
+DROP TABLE t1,t2,t3;
+SET TIMESTAMP=0; # back to current time
+
+--echo #
 --echo # End of 5.6 tests
 --echo #

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2012-02-07 20:32:47 +0000
+++ b/sql/field.cc	2012-02-13 06:26:52 +0000
@@ -4861,8 +4861,10 @@ Field_temporal::store(const char *str, u
   }
   else
   {
-    error= test(status.warnings) |
-           store_internal_with_round(&ltime, &status.warnings);
+    error= test(status.warnings); // Test convert_str_to_TIME warnings
+    const int error2= store_internal_with_round(&ltime, &status.warnings);
+    if (!error)
+      error= error2; 
   }
   if (status.warnings)
     set_warnings(ErrConvString(str, len, cs), status.warnings);
@@ -5808,7 +5810,17 @@ longlong Field_timef::val_time_temporal(
 
 int Field_timef::store_internal(const MYSQL_TIME *ltime, int *warnings)
 {
-  return store_packed(TIME_to_longlong_time_packed(ltime));
+  int rc= store_packed(TIME_to_longlong_time_packed(ltime));
+  if (rc == 0 && non_zero_date(ltime))
+  {
+    /*
+      The DATE part got lost; we warn, like in Field_newdate::store_internal,
+      and trigger some code in get_mm_leaf() (see err==3 there).
+    */
+    *warnings|= MYSQL_TIME_NOTE_TRUNCATED;
+    rc= 3;
+  }
+  return rc;
 }
 
 

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2012-02-08 15:25:17 +0000
+++ b/sql/item_cmpfunc.cc	2012-02-13 06:26:52 +0000
@@ -449,7 +449,9 @@ static bool convert_constant_item(THD *t
                                (STATUS_GARBAGE | STATUS_NOT_FOUND))));
     if (save_field_value)
       orig_field_val= field->val_int();
-    if (!(*item)->is_null() && !(*item)->save_in_field(field, 1)) // TS-TODO
+    int rc;
+    if (!(*item)->is_null() &&
+        (((rc= (*item)->save_in_field(field, 1)) == 0) || rc == 3)) // TS-TODO
     {
       int field_cmp= 0;
       /*

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2012-02-09 11:22:17 +0000
+++ b/sql/opt_range.cc	2012-02-09 17:07:12 +0000
@@ -115,7 +115,7 @@
 #include "sql_select.h"
 #include "opt_trace.h"
 #include "filesort.h"         // filesort_free_buffers
-#include "sql_optimizer.h"    // is_indexed_agg_distinct
+#include "sql_optimizer.h"    // is_indexed_agg_distinct,field_time_cmp_date
 
 using std::min;
 using std::max;
@@ -6352,14 +6352,18 @@ get_mm_leaf(RANGE_OPT_PARAM *param, Item
 
        WHERE latin1_swedish_ci_colimn = BINARY 'a '
 
-  */
-  if (field->result_type() == STRING_RESULT &&
-      field->match_collation_to_optimize_range() &&
-      value->result_type() == STRING_RESULT &&
-      key_part->image_type == Field::itRAW &&
-      field->charset() != conf_func->compare_collation() &&
-      !(conf_func->compare_collation()->state & MY_CS_BINSORT &&
-        (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC)))
+    3. Grep for IndexedTimeComparedToDate. If 'value' is a DATETIME part,
+       using the index on the TIME column would retain only the TIME part of
+       'value', giving false comparison results.
+  */
+  if ((field->result_type() == STRING_RESULT &&
+       field->match_collation_to_optimize_range() &&
+       value->result_type() == STRING_RESULT &&
+       key_part->image_type == Field::itRAW &&
+       field->charset() != conf_func->compare_collation() &&
+       !(conf_func->compare_collation()->state & MY_CS_BINSORT &&
+         (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC))) ||
+      field_time_cmp_date(field, value))
   {
     if (param->using_real_indexes &&
         param->thd->lex->describe & DESCRIBE_EXTENDED)

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2012-02-08 06:45:31 +0000
+++ b/sql/share/errmsg-utf8.txt	2012-02-09 20:26:08 +0000
@@ -6624,3 +6624,11 @@ ER_INNODB_FT_LIMIT
 
 ER_INNODB_NO_FT_TEMP_TABLE
   eng "Cannot create FULLTEXT index on temporary InnoDB table"
+
+ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT
+  eng "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave."
+
+ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC
+  eng "CREATE TABLE... SELECT...  on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave."
+
+

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2012-02-08 06:45:31 +0000
+++ b/sql/sql_base.cc	2012-02-13 08:50:03 +0000
@@ -224,7 +224,8 @@ static bool auto_repair_table(THD *thd, 
 static void free_cache_entry(TABLE *entry);
 static bool
 has_write_table_with_auto_increment(TABLE_LIST *tables);
-
+static bool
+has_write_table_with_auto_increment_and_select(TABLE_LIST *tables);
 
 uint cached_open_tables(void)
 {
@@ -5853,9 +5854,20 @@ bool lock_tables(THD *thd, TABLE_LIST *t
 	*(ptr++)= table->table;
     }
 
+    /*
+    DML statements that modify a table with an auto_increment column based on
+    rows selected from a table are unsafe as the order in which the rows are
+    fetched fron the select tables cannot be determined and may differ on
+    master and slave.
+    */
+    if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables &&
+        has_write_table_with_auto_increment_and_select(tables))
+      thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT);
+
     /* We have to emulate LOCK TABLES if we are statement needs prelocking. */
     if (thd->lex->requires_prelocking())
     {
+
       /*
         A query that modifies autoinc column in sub-statement can make the 
         master and slave inconsistent.
@@ -9348,6 +9360,41 @@ has_write_table_with_auto_increment(TABL
 
   return 0;
 }
+
+/*
+   checks if we have select tables in the table list and write tables
+   with auto-increment column.
+
+  SYNOPSIS
+   has_two_write_locked_tables_with_auto_increment_and_select
+      tables        Table list
+
+  RETURN VALUES
+
+   -true if the table list has atleast one table with auto-increment column
+
+
+         and atleast one table to select from.
+   -false otherwise
+*/
+
+static bool
+has_write_table_with_auto_increment_and_select(TABLE_LIST *tables)
+{
+  bool has_select= false;
+  bool has_auto_increment_tables = has_write_table_with_auto_increment(tables);
+  for(TABLE_LIST *table= tables; table; table= table->next_global)
+  {
+     if (!table->placeholder() &&
+        (table->lock_type <= TL_READ_NO_INSERT))
+      {
+        has_select= true;
+        break;
+      }
+  }
+  return(has_select && has_auto_increment_tables);
+}
+
 
 
 /*

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2012-02-08 09:44:42 +0000
+++ b/sql/sql_lex.cc	2012-02-09 20:26:08 +0000
@@ -65,9 +65,11 @@ Query_tables_list::binlog_stmt_unsafe_er
   ER_BINLOG_UNSAFE_MIXED_STATEMENT,
   ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT,
   ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE,
+  ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT,
   ER_BINLOG_UNSAFE_REPLACE_SELECT,
   ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT,
   ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT,
+  ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC,
   ER_BINLOG_UNSAFE_UPDATE_IGNORE
 };
 

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2012-02-08 06:45:31 +0000
+++ b/sql/sql_lex.h	2012-02-09 20:26:08 +0000
@@ -1257,6 +1257,13 @@ public:
     BINLOG_STMT_UNSAFE_INSERT_SELECT_UPDATE,
 
     /**
+     Query that writes to a table with auto_inc column after selecting from 
+     other tables are unsafe as the order in which the rows are retrieved by
+     select may differ on master and slave.
+    */
+    BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT,
+
+    /**
       INSERT...REPLACE SELECT is unsafe because which rows are replaced depends
       on the order that rows are retrieved by SELECT. This order cannot be
       predicted and may differ on master and the slave.
@@ -1276,6 +1283,14 @@ public:
       cannot be predicted and may differ on master and the slave
     */
     BINLOG_STMT_UNSAFE_CREATE_REPLACE_SELECT,
+
+    /**
+      CREATE TABLE...SELECT on a table with auto-increment column is unsafe
+      because which rows are replaced depends on the order that rows are
+      retrieved from SELECT. This order cannot be predicted and may differ on
+      master and the slave
+    */
+    BINLOG_STMT_UNSAFE_CREATE_SELECT_AUTOINC,
 
     /**
       UPDATE...IGNORE is unsafe because which rows are ignored depends on the

=== modified file 'sql/sql_optimizer.cc'
--- a/sql/sql_optimizer.cc	2012-02-08 15:25:17 +0000
+++ b/sql/sql_optimizer.cc	2012-02-09 17:07:12 +0000
@@ -4567,10 +4567,23 @@ add_key_field(KEY_FIELD **key_fields,uin
             Can't optimize datetime_column=indexed_varchar_column,
             also can't use indexes if the effective collation
             of the operation differ from the field collation.
+            IndexedTimeComparedToDate: can't optimize
+            'indexed_time = temporal_expr_with_date_part' because:
+            - without index, a TIME column with value '48:00:00' is equal to a
+            DATETIME column with value 'CURDATE() + 2 days'
+            - with ref access into the TIME column, CURDATE() + 2 days becomes
+            "00:00:00" (Field_timef::store_internal() simply extracts the time
+            part from the datetime) which is a lookup key which does not match
+            "48:00:00"; so ref access is not be able to give the same result
+            as without index, so is disabled.
+            On the other hand, we can optimize indexed_datetime = time
+            because Field_temporal_with_date::store_time() will convert
+            48:00:00 to CURDATE() + 2 days which is the correct lookup key.
           */
           if ((!field->is_temporal() && value[0]->is_temporal()) ||
               (field->cmp_type() == STRING_RESULT &&
-               field->charset() != cond->compare_collation()))
+               field->charset() != cond->compare_collation()) ||
+              field_time_cmp_date(field, value[0]))
           {
             warn_index_not_applicable(stat->join->thd, field, possible_keys);
             return;

=== modified file 'sql/sql_optimizer.h'
--- a/sql/sql_optimizer.h	2012-02-07 20:32:47 +0000
+++ b/sql/sql_optimizer.h	2012-02-09 17:07:12 +0000
@@ -514,5 +514,16 @@ Item *
 make_cond_for_table(Item *cond, table_map tables, table_map used_table,
                     bool exclude_expensive_cond);
 
+/**
+   Returns true if arguments are a temporal Field having no date,
+   part and a temporal expression having a date part.
+   @param  f  Field
+   @param  v  Expression
+ */
+inline bool field_time_cmp_date(const Field *f, const Item *v)
+{
+  return f->is_temporal() && !f->is_temporal_with_date() &&
+    v->is_temporal_with_date();
+}
 
 #endif /* SQL_OPTIMIZER_INCLUDED */

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2012-02-08 13:10:23 +0000
+++ b/sql/sql_table.cc	2012-02-09 20:26:08 +0000
@@ -3334,6 +3334,15 @@ mysql_prepare_create_table(THD *thd, HA_
     DBUG_RETURN(TRUE);
   }
 
+  /*
+   CREATE TABLE[with auto_increment column] SELECT is unsafe as the rows
+   inserted in the created table depends on the order of the rows fetched
+   from the select tables. This order may differ on master and slave. We
+   therefore mark it as unsafe.
+  */
+  if (select_field_count > 0 && auto_increment)
+  thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_CREATE_SELECT_AUTOINC);
+
   /* Create keys */
 
   List_iterator<Key> key_iterator(alter_info->key_list);

=== modified file 'sql/sql_tmp_table.cc'
--- a/sql/sql_tmp_table.cc	2012-01-25 08:46:00 +0000
+++ b/sql/sql_tmp_table.cc	2012-02-10 09:06:59 +0000
@@ -210,9 +210,12 @@ static Field *create_tmp_field_for_schem
       field= new Field_blob(item->max_length, item->maybe_null,
                             item->name, item->collation.collation);
     else
+    {
       field= new Field_varstring(item->max_length, item->maybe_null,
                                  item->name,
                                  table->s, item->collation.collation);
+      table->s->db_create_options|= HA_OPTION_PACK_RECORD;
+    }
     if (field)
       field->init(table);
     return field;

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2012-02-03 18:09:00 +0000
+++ b/sql/sql_yacc.yy	2012-02-13 09:45:43 +0000
@@ -13815,7 +13815,11 @@ table_lock:
 lock_option:
           READ_SYM               { $$= TL_READ_NO_INSERT; }
         | WRITE_SYM              { $$= TL_WRITE_DEFAULT; }
-        | LOW_PRIORITY WRITE_SYM { $$= TL_WRITE_LOW_PRIORITY; }
+        | LOW_PRIORITY WRITE_SYM 
+          { 
+            $$= TL_WRITE_LOW_PRIORITY; 
+            WARN_DEPRECATED(YYTHD, "LOW_PRIORITY WRITE", "WRITE");
+          }
         | READ_SYM LOCAL_SYM     { $$= TL_READ; }
         ;
 

=== modified file 'storage/innobase/dict/dict0stats.cc'
--- a/storage/innobase/dict/dict0stats.cc	2012-01-23 14:09:29 +0000
+++ b/storage/innobase/dict/dict0stats.cc	2012-02-10 02:20:47 +0000
@@ -1549,6 +1549,8 @@ dict_stats_save_index_stat(
 			"stat name %s: %s\n",
 			index->table->name, index->name,
 			stat_name, ut_strerr(ret));
+
+		trx->error_state = DB_SUCCESS;
 	}
 
 	return(ret);
@@ -2593,6 +2595,8 @@ dict_stats_delete_index_stats(
 
 		ut_print_timestamp(stderr);
 		fprintf(stderr, " InnoDB: %s\n", errstr);
+
+		trx->error_state = DB_SUCCESS;
 	}
 
 	dict_stats_close(dict_stats);

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2012-02-08 13:10:23 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2012-02-13 08:22:20 +0000
@@ -9202,8 +9202,15 @@ ha_innobase::delete_table(
 
 	ut_a(name_len < 1000);
 
-	/* Drop the table in InnoDB */
+	/* Either the transaction is already flagged as a locking transaction
+	or it hasn't been started yet. */
+
+	ut_a(!trx_is_started(trx) || trx->will_lock > 0);
+
+	/* We are doing a DDL operation. */
+	++trx->will_lock;
 
+	/* Drop the table in InnoDB */
 	error = row_drop_table_for_mysql(norm_name, trx,
 					 thd_sql_command(thd)
 					 == SQLCOM_DROP_DB);
@@ -9313,6 +9320,14 @@ innobase_drop_database(
 #endif
 	trx = innobase_trx_allocate(thd);
 
+	/* Either the transaction is already flagged as a locking transaction
+	or it hasn't been started yet. */
+
+	ut_a(!trx_is_started(trx) || trx->will_lock > 0);
+
+	/* We are doing a DDL operation. */
+	++trx->will_lock;
+
 	row_drop_database_for_mysql(namebuf, trx);
 
 	my_free(namebuf);
@@ -9362,6 +9377,11 @@ innobase_rename_table(
 		row_mysql_lock_data_dictionary(trx);
 	}
 
+	/* Transaction must be flagged as a locking transaction or it hasn't
+	been started yet. */
+
+	ut_a(trx->will_lock > 0);
+
 	error = row_rename_table_for_mysql(
 		norm_from, norm_to, trx, lock_and_commit);
 
@@ -9473,6 +9493,14 @@ ha_innobase::rename_table(
 	trx_search_latch_release_if_reserved(parent_trx);
 
 	trx = innobase_trx_allocate(thd);
+
+	/* Either the transaction is already flagged as a locking transaction
+	or it hasn't been started yet. */
+
+	ut_a(!trx_is_started(trx) || trx->will_lock > 0);
+
+	/* We are doing a DDL operation. */
+	++trx->will_lock;
 
 	error = innobase_rename_table(trx, from, to, TRUE);
 

=== modified file 'storage/innobase/include/ha_prototypes.h'
--- a/storage/innobase/include/ha_prototypes.h	2011-11-21 00:04:40 +0000
+++ b/storage/innobase/include/ha_prototypes.h	2012-02-10 02:20:47 +0000
@@ -27,6 +27,7 @@ Created 5/11/2006 Osku Salerma
 #ifndef HA_INNODB_PROTOTYPES_H
 #define HA_INNODB_PROTOTYPES_H
 
+#include "my_dbug.h"
 #include "my_compare.h"
 
 #include "trx0types.h"

=== modified file 'storage/innobase/row/row0merge.cc'
--- a/storage/innobase/row/row0merge.cc	2012-02-02 12:00:50 +0000
+++ b/storage/innobase/row/row0merge.cc	2012-02-10 03:13:44 +0000
@@ -2222,7 +2222,7 @@ row_merge_drop_index(
 	dict_table_t*	table,	/*!< in: table */
 	trx_t*		trx)	/*!< in: transaction handle */
 {
-	ulint		err;
+	db_err		err;
 	pars_info_t*	info = pars_info_create();
 
 	/* We use the private SQL parser of Innobase to generate the
@@ -2230,7 +2230,7 @@ row_merge_drop_index(
 	tables in Innobase. Deleting a row from SYS_INDEXES table also
 	frees the file segments of the B-tree associated with the index. */
 
-	static const char str1[] =
+	static const char sql[] =
 		"PROCEDURE DROP_INDEX_PROC () IS\n"
 		"BEGIN\n"
 		/* Rename the index, so that it will be dropped by
@@ -2254,22 +2254,39 @@ row_merge_drop_index(
 
 	ut_a(trx->dict_operation_lock_mode == RW_X_LATCH);
 
-	err = que_eval_sql(info, str1, FALSE, trx);
+	err = static_cast<db_err>(que_eval_sql(info, sql, FALSE, trx));
 
-	ut_a(err == DB_SUCCESS);
+	DBUG_EXECUTE_IF(
+		"ib_drop_index_too_many_concurrent_trxs",
+		err = DB_TOO_MANY_CONCURRENT_TRXS;
+		trx->error_state = err;);
 
-	/* If it is FTS index, drop from table->fts and also drop
-	its auxiliary tables */
-	if (index->type & DICT_FTS) {
-		ut_a(table->fts);
-		fts_drop_index(table, index, trx);
-	}
+	if (err == DB_SUCCESS) {
+
+		/* If it is FTS index, drop from table->fts and also drop
+		its auxiliary tables */
+		if (index->type & DICT_FTS) {
+			ut_a(table->fts);
+			fts_drop_index(table, index, trx);
+		}
+
+		/* Replace this index with another equivalent index for all
+		foreign key constraints on this table where this index is
+		used */
 
-	/* Replace this index with another equivalent index for all
-	foreign key constraints on this table where this index is used */
+		dict_table_replace_index_in_foreign_list(table, index, trx);
+		dict_index_remove_from_cache(table, index);
 
-	dict_table_replace_index_in_foreign_list(table, index, trx);
-	dict_index_remove_from_cache(table, index);
+	} else {
+		/* Even though we ensure that DDL transactions are WAIT
+		and DEADLOCK free, we could encounter other errors e.g.,
+		DB_TOO_MANY_TRANSACTIONS. */
+		trx->error_state = DB_SUCCESS;
+
+		ut_print_timestamp(stderr);
+		fprintf(stderr, " InnoDB: Error: row_merge_drop_index failed "
+			"with error code: %lu.\n", (ulint) err);
+	}
 
 	trx->op_info = "";
 }
@@ -2585,13 +2602,13 @@ row_merge_rename_indexes(
 	trx_t*		trx,		/*!< in/out: transaction */
 	dict_table_t*	table)		/*!< in/out: table with new indexes */
 {
-	ulint		err = DB_SUCCESS;
+	db_err		err = DB_SUCCESS;
 	pars_info_t*	info = pars_info_create();
 
 	/* We use the private SQL parser of Innobase to generate the
 	query graphs needed in renaming indexes. */
 
-	static const char rename_indexes[] =
+	static const char* sql =
 		"PROCEDURE RENAME_INDEXES_PROC () IS\n"
 		"BEGIN\n"
 		"UPDATE SYS_INDEXES SET NAME=SUBSTR(NAME,1,LENGTH(NAME)-1)\n"
@@ -2607,7 +2624,12 @@ row_merge_rename_indexes(
 
 	pars_info_add_ull_literal(info, "tableid", table->id);
 
-	err = que_eval_sql(info, rename_indexes, FALSE, trx);
+	err = static_cast<db_err>(que_eval_sql(info, sql, FALSE, trx));
+
+	DBUG_EXECUTE_IF(
+		"ib_rename_indexes_too_many_concurrent_trxs",
+		err = DB_TOO_MANY_CONCURRENT_TRXS;
+		trx->error_state = static_cast<db_err>(err););
 
 	if (err == DB_SUCCESS) {
 		dict_index_t*	index = dict_table_get_first_index(table);
@@ -2617,6 +2639,16 @@ row_merge_rename_indexes(
 			}
 			index = dict_table_get_next_index(index);
 		} while (index);
+	} else {
+		/* Even though we ensure that DDL transactions are WAIT
+		and DEADLOCK free, we could encounter other errors e.g.,
+		DB_TOO_MANY_TRANSACTIONS. */
+
+		trx->error_state = DB_SUCCESS;
+
+		ut_print_timestamp(stderr);
+		fprintf(stderr, " InnoDB: Error: row_merge_rename_indexes "
+			"failed with error code: %lu.\n", (ulint) err);
 	}
 
 	trx->op_info = "";
@@ -2654,7 +2686,7 @@ row_merge_rename_tables(
 		memcpy(old_name, old_table->name, strlen(old_table->name) + 1);
 	} else {
 		ut_print_timestamp(stderr);
-		fprintf(stderr, "InnoDB: too long table name: '%s', "
+		fprintf(stderr, " InnoDB: too long table name: '%s', "
 			"max length is %d\n", old_table->name,
 			MAX_FULL_NAME_LEN);
 		ut_error;
@@ -2992,18 +3024,22 @@ wait_again:
 		if (indexes[i]->type & DICT_FTS && fts_enable_diag_print) {
 			char*	name = (char*) indexes[i]->name;
 
-			ut_print_timestamp(stderr);
-
 			if (*name == TEMP_INDEX_PREFIX)  {
 				name++;
 			}
 
-			fprintf(stderr, "  InnoDB_FTS: Finish building"
-				" Fulltext index %s\n", name);
+			ut_print_timestamp(stderr);
+			fprintf(stderr, " InnoDB: Finished building "
+				"full-text index %s\n", name);
 		}
 	}
 
 func_exit:
+	DBUG_EXECUTE_IF(
+		"ib_build_indexes_too_many_concurrent_trxs",
+		error = DB_TOO_MANY_CONCURRENT_TRXS;
+		trx->error_state = static_cast<db_err>(error););
+
 	row_merge_file_destroy_low(tmpfd);
 
 	for (i = 0; i < n_indexes; i++) {

=== modified file 'storage/innobase/trx/trx0trx.cc'
--- a/storage/innobase/trx/trx0trx.cc	2012-01-21 03:30:27 +0000
+++ b/storage/innobase/trx/trx0trx.cc	2012-02-13 08:22:20 +0000
@@ -1022,6 +1022,13 @@ trx_commit(
 		ut_ad(!trx->in_ro_trx_list);
 		ut_ad(!trx->in_rw_trx_list);
 
+		/* Note: We are asserting without holding the lock mutex. But
+		that is OK because this transaction is not waiting and cannot
+		be rolled back and no new locks can (or should not) be added
+		becuase it is flagged as a non-locking read-only transaction. */
+
+		ut_a(UT_LIST_GET_LEN(trx->lock.trx_locks) == 0);
+
 		/* This state change is not protected by any mutex, therefore
 		there is an inherent race here around state transition during
 		printouts. We ignore this race for the sake of efficiency.
@@ -1163,6 +1170,9 @@ trx_commit(
 	ut_ad(UT_LIST_GET_LEN(trx->lock.trx_locks) == 0);
 	ut_ad(!trx->in_ro_trx_list);
 	ut_ad(!trx->in_rw_trx_list);
+
+	trx->error_state = DB_SUCCESS;
+
 	/* trx->in_mysql_trx_list would hold between
 	trx_allocate_for_mysql() and trx_free_for_mysql(). It does not
 	hold for recovered transactions or system transactions. */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (roy.lyseng:3870 to 3886) Bug#13586314Roy Lyseng13 Feb