List:Commits« Previous MessageNext Message »
From:Roy Lyseng Date:October 6 2011 10:59am
Subject:bzr push into mysql-trunk branch (roy.lyseng:3456 to 3457) Bug#12867557
View as plain text  
 3457 Roy Lyseng	2011-10-06
      Bug#12867557: Valgrind: conditional jump/move at key_cmp
      
      This problem may occur when starting a JOIN execution for the second
      and subsequent time, such as when a subquery is evaluated in the
      context of an UPDATE statement to evaluate whether a row qualifies
      to be updated. The problem may also appear only in the case of a
      loosescan semi-join strategy. When the previous execution had
      qualifying rows, the found_match flag may be left with value TRUE,
      so that we erroneously assume that there is a row in loosescan_buf
      that we may compare the current row with.
      
      The problem is fixed by clearing the found_match flag when entering a
      new join_tab level within sub_select().
      
      mysql-test/include/subquery_sj.inc
        Added test case for bug#12867557.
      
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
        Added test case results for bug#12867557.
      
      sql/sql_select.cc
        In sub_select(), added initialization of loosescan match flag when
        entering a new join_tab level.

    modified:
      mysql-test/include/subquery_sj.inc
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      sql/sql_select.cc
 3456 Tor Didriksen	2011-10-05
      New test results after merge from trunk

    modified:
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_all_bka_nixbnl.result
=== modified file 'mysql-test/include/subquery_sj.inc'
--- a/mysql-test/include/subquery_sj.inc	2011-10-01 19:26:04 +0000
+++ b/mysql-test/include/subquery_sj.inc	2011-10-06 10:58:30 +0000
@@ -4115,4 +4115,58 @@ DROP TABLE it, ot;
 
 --echo # End of test for bug#12714094
 
+--echo #
+--echo # Bug#12867557: Valgrind: conditional jump/move at key_cmp
+--echo #
+
+CREATE TABLE t1 (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_key INTEGER,
+ PRIMARY KEY (pk),
+ KEY (col_int_key)
+) AUTO_INCREMENT=10;
+
+INSERT INTO t1 (col_int_key) VALUES (8);
+
+CREATE TABLE t2 (
+ pk INTEGER AUTO_INCREMENT,
+ col_int_key INTEGER,
+ col_time_key TIME,
+ PRIMARY KEY (pk),
+ KEY (col_int_key),
+ KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+ (8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+ (7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+ (1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+ (9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+ (0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+ (NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+ (NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+   (SELECT parent1.col_int_key AS p1
+    FROM t1 AS parent1)
+ AND grandparent1.pk > 9;
+
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+   (SELECT grandparent1.col_time_key AS g1
+    FROM t2 AS grandparent1
+    WHERE grandparent1.col_int_key IN
+       (SELECT parent1.col_int_key AS p1
+        FROM t1 AS parent1)
+      AND grandparent1.pk > 9);
+
+DROP TABLE t0, t1, t2;
+
+--echo # End of test for bug#12867557
+
 --echo # End of 5.6 tests

=== modified file 'mysql-test/r/subquery_sj_all.result'
--- a/mysql-test/r/subquery_sj_all.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_all.result	2011-10-06 10:58:30 +0000
@@ -6794,5 +6794,50 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_all_bka.result'
--- a/mysql-test/r/subquery_sj_all_bka.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_all_bka.result	2011-10-06 10:58:30 +0000
@@ -6795,6 +6795,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_all_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_all_bka_nixbnl.result	2011-10-04 06:35:35 +0000
+++ b/mysql-test/r/subquery_sj_all_bka_nixbnl.result	2011-10-06 10:58:30 +0000
@@ -6795,6 +6795,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_all_bkaunique.result'
--- a/mysql-test/r/subquery_sj_all_bkaunique.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_all_bkaunique.result	2011-10-06 10:58:30 +0000
@@ -6796,6 +6796,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_dupsweed.result'
--- a/mysql-test/r/subquery_sj_dupsweed.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed.result	2011-10-06 10:58:30 +0000
@@ -6794,5 +6794,50 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka.result	2011-10-06 10:58:30 +0000
@@ -6795,6 +6795,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result	2011-10-04 06:35:35 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result	2011-10-06 10:58:30 +0000
@@ -6795,6 +6795,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bkaunique.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2011-10-06 10:58:30 +0000
@@ -6796,6 +6796,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_firstmatch.result'
--- a/mysql-test/r/subquery_sj_firstmatch.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch.result	2011-10-06 10:58:30 +0000
@@ -6795,6 +6795,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 #
 # Bug#51457 Firstmatch semijoin strategy gives wrong results for

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka.result	2011-10-06 10:58:30 +0000
@@ -6796,6 +6796,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 #
 # Bug#51457 Firstmatch semijoin strategy gives wrong results for

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result	2011-10-04 06:35:35 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result	2011-10-06 10:58:30 +0000
@@ -6796,6 +6796,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 #
 # Bug#51457 Firstmatch semijoin strategy gives wrong results for

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bkaunique.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2011-10-06 10:58:30 +0000
@@ -6797,6 +6797,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 #
 # Bug#51457 Firstmatch semijoin strategy gives wrong results for

=== modified file 'mysql-test/r/subquery_sj_loosescan.result'
--- a/mysql-test/r/subquery_sj_loosescan.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_loosescan.result	2011-10-06 10:58:30 +0000
@@ -6795,5 +6795,50 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bka.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka.result	2011-10-06 10:58:30 +0000
@@ -6796,6 +6796,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result	2011-10-04 06:35:35 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result	2011-10-06 10:58:30 +0000
@@ -6796,6 +6796,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bkaunique.result'
--- a/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2011-10-06 10:58:30 +0000
@@ -6797,6 +6797,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat.result'
--- a/mysql-test/r/subquery_sj_mat.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_mat.result	2011-10-06 10:58:30 +0000
@@ -6794,5 +6794,50 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat_bka.result'
--- a/mysql-test/r/subquery_sj_mat_bka.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_mat_bka.result	2011-10-06 10:58:30 +0000
@@ -6795,6 +6795,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_mat_bka_nixbnl.result	2011-10-04 06:35:35 +0000
+++ b/mysql-test/r/subquery_sj_mat_bka_nixbnl.result	2011-10-06 10:58:30 +0000
@@ -6795,6 +6795,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat_bkaunique.result'
--- a/mysql-test/r/subquery_sj_mat_bkaunique.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_mat_bkaunique.result	2011-10-06 10:58:30 +0000
@@ -6796,6 +6796,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat_nosj.result'
--- a/mysql-test/r/subquery_sj_mat_nosj.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_mat_nosj.result	2011-10-06 10:58:30 +0000
@@ -6871,5 +6871,50 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none.result'
--- a/mysql-test/r/subquery_sj_none.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_none.result	2011-10-06 10:58:30 +0000
@@ -6806,5 +6806,50 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none_bka.result'
--- a/mysql-test/r/subquery_sj_none_bka.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_none_bka.result	2011-10-06 10:58:30 +0000
@@ -6807,6 +6807,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_none_bka_nixbnl.result	2011-10-04 06:35:35 +0000
+++ b/mysql-test/r/subquery_sj_none_bka_nixbnl.result	2011-10-06 10:58:30 +0000
@@ -6807,6 +6807,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none_bkaunique.result'
--- a/mysql-test/r/subquery_sj_none_bkaunique.result	2011-10-01 19:26:04 +0000
+++ b/mysql-test/r/subquery_sj_none_bkaunique.result	2011-10-06 10:58:30 +0000
@@ -6808,6 +6808,51 @@ field1
 1
 DROP TABLE it, ot;
 # End of test for bug#12714094
+#
+# Bug#12867557: Valgrind: conditional jump/move at key_cmp
+#
+CREATE TABLE t1 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+PRIMARY KEY (pk),
+KEY (col_int_key)
+) AUTO_INCREMENT=10;
+INSERT INTO t1 (col_int_key) VALUES (8);
+CREATE TABLE t2 (
+pk INTEGER AUTO_INCREMENT,
+col_int_key INTEGER,
+col_time_key TIME,
+PRIMARY KEY (pk),
+KEY (col_int_key),
+KEY (col_time_key)
+)  AUTO_INCREMENT=10;
+INSERT INTO t2 (col_int_key, col_time_key)
+VALUES
+(8, '22:55:23.019225'), (7, '10:19:31.050677'), (1, '14:40:36.038608'),
+(7, '04:37:47.062416'), (9, '19:34:06.054514'), (NULL,'20:35:33.022996'),
+(1, NULL), (9, '14:43:37.057393'), (2, '02:23:09.043438'),
+(9, '01:22:45.041064'), (2, '00:00:00'), (4, '00:13:25.038482'),
+(0, '03:47:16.042671'), (4, '01:41:48.007423'), (8, '00:00:00'),
+(NULL, '22:32:04.047407'), (NULL, '16:44:14.028443'), (0, '17:38:37.059754'),
+(NULL, '08:46:48.042388'), (8, '14:11:27.044095');
+CREATE TABLE t0
+SELECT DISTINCT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9;
+UPDATE t0
+SET g1 = g1
+WHERE g1 IN
+(SELECT grandparent1.col_time_key AS g1
+FROM t2 AS grandparent1
+WHERE grandparent1.col_int_key IN
+(SELECT parent1.col_int_key AS p1
+FROM t1 AS parent1)
+AND grandparent1.pk > 9);
+DROP TABLE t0, t1, t2;
+# End of test for bug#12867557
 # End of 5.6 tests
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-10-05 08:04:25 +0000
+++ b/sql/sql_select.cc	2011-10-06 10:58:30 +0000
@@ -18979,7 +18979,8 @@ sub_select(JOIN *join,JOIN_TAB *join_tab
   }
 
   join->return_tab= join_tab;
-  join_tab->not_null_compl= TRUE;
+  join_tab->not_null_compl= true;
+  join_tab->found_match= false;
 
   if (join_tab->last_inner)
   {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (roy.lyseng:3456 to 3457) Bug#12867557Roy Lyseng7 Oct