[Commits] Rev 3858: Automatic merge in file:///data0/psergey/dev2/5.5-pull/

Sergey Petrunya psergey at askmonty.org
Thu Aug 22 13:13:47 EEST 2013


At file:///data0/psergey/dev2/5.5-pull/

------------------------------------------------------------
revno: 3858 [merge]
revision-id: psergey at askmonty.org-20130822101346-sc32vyfgsgygh3x5
parent: igor at askmonty.org-20130821193458-ju0edat1o4msyvc9
parent: psergey at askmonty.org-20130822101210-ttb02qxb184o2u09
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5-pull
timestamp: Thu 2013-08-22 14:13:46 +0400
message:
  Automatic merge
modified:
  mysql-test/r/table_elim.result table_elim.result-20090603125022-nge13y0ohk1g2tt2-1
  mysql-test/t/table_elim.test   table_elim.test-20090603125018-ka3vcfrm07bsldz8-1
  sql/opt_table_elimination.cc   opt_table_eliminatio-20090625095316-7ka9w3zr7n5114iv-1
=== modified file 'mysql-test/r/table_elim.result'
--- a/mysql-test/r/table_elim.result	2013-08-19 02:58:51 +0000
+++ b/mysql-test/r/table_elim.result	2013-08-22 10:12:10 +0000
@@ -628,4 +628,24 @@ id	select_type	table	type	possible_keys
 Warnings:
 Note	1003	select `test`.`t2`.`b` AS `b` from `test`.`t2` where <expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(select sum(1) from dual having (<cache>(`test`.`t2`.`b`) = <ref_null_helper>(sum(1))))))
 DROP TABLE t1,t2;
+#
+# MDEV-4840: Wrong result (missing rows) on LEFT JOIN with InnoDB tables
+#
+CREATE TABLE t1 (alpha3 VARCHAR(3));
+INSERT INTO t1 VALUES ('USA'),('CAN');
+CREATE TABLE t2 ( t3_code VARCHAR(3), name VARCHAR(64));
+INSERT INTO t2 VALUES ('USA','Austin'),('USA','Boston');
+CREATE TABLE t3 ( code VARCHAR(3),  name VARCHAR(64),  PRIMARY KEY (code),  UNIQUE KEY (name));
+INSERT INTO t3 VALUES ('CAN','Canada'),('USA','United States');
+SELECT *         FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code  = t3.code ) ON t1.alpha3 = t3.code;
+alpha3	t3_code	name	code	name
+USA	USA	Austin	USA	United States
+USA	USA	Boston	USA	United States
+CAN	NULL	NULL	NULL	NULL
+SELECT t1.alpha3 FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code  = t3.code ) ON t1.alpha3 = t3.code;
+alpha3
+USA
+USA
+CAN
+DROP TABLE t1, t2, t3;
 SET optimizer_switch=@save_optimizer_switch;

=== modified file 'mysql-test/t/table_elim.test'
--- a/mysql-test/t/table_elim.test	2012-05-21 18:54:41 +0000
+++ b/mysql-test/t/table_elim.test	2013-08-22 10:12:10 +0000
@@ -561,4 +561,21 @@ EXPLAIN EXTENDED
 
 DROP TABLE t1,t2;
 
+--echo #
+--echo # MDEV-4840: Wrong result (missing rows) on LEFT JOIN with InnoDB tables
+--echo #
+CREATE TABLE t1 (alpha3 VARCHAR(3));
+INSERT INTO t1 VALUES ('USA'),('CAN');
+
+CREATE TABLE t2 ( t3_code VARCHAR(3), name VARCHAR(64));
+INSERT INTO t2 VALUES ('USA','Austin'),('USA','Boston');
+
+CREATE TABLE t3 ( code VARCHAR(3),  name VARCHAR(64),  PRIMARY KEY (code),  UNIQUE KEY (name));
+INSERT INTO t3 VALUES ('CAN','Canada'),('USA','United States');
+
+SELECT *         FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code  = t3.code ) ON t1.alpha3 = t3.code;
+SELECT t1.alpha3 FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code  = t3.code ) ON t1.alpha3 = t3.code;
+
+DROP TABLE t1, t2, t3;
+
 SET optimizer_switch=@save_optimizer_switch;

=== modified file 'sql/opt_table_elimination.cc'
--- a/sql/opt_table_elimination.cc	2012-02-17 11:19:38 +0000
+++ b/sql/opt_table_elimination.cc	2013-08-22 10:12:10 +0000
@@ -892,8 +892,11 @@ bool Dep_analysis_context::run_wave(List
       iter= module->init_unbound_values_iter(iter_buf);
       while ((value= module->get_next_unbound_value(this, iter)))
       {
-        value->make_bound();
-        new_bound_values.push_back(value);
+        if (!value->is_bound())
+        {
+          value->make_bound();
+          new_bound_values.push_back(value);
+        }
       }
     }
     new_bound_modules->empty();
@@ -1740,7 +1743,7 @@ Dep_module* Dep_value_field::get_next_un
     - have this field as a part of them
   */
   while (key_dep && (key_dep->is_applicable() ||
-         !field->part_of_key.is_set(key_dep->keyno)))
+         !field->part_of_key_not_clustered.is_set(key_dep->keyno)))
   {
     key_dep= key_dep->next_table_key;
   }



More information about the commits mailing list