[Commits] Rev 3485: MDEV-3880: test suite added. in file:///home/bell/maria/bzr/work-maria-10.0-exists2in/

sanja at montyprogram.com sanja at montyprogram.com
Thu Nov 29 12:18:24 EET 2012


At file:///home/bell/maria/bzr/work-maria-10.0-exists2in/

------------------------------------------------------------
revno: 3485
revision-id: sanja at montyprogram.com-20121129101823-k7kt2gjym2mmiqe7
parent: sanja at montyprogram.com-20121129100434-4cvzueaobqhlgk16
committer: sanja at montyprogram.com
branch nick: work-maria-10.0-exists2in
timestamp: Thu 2012-11-29 12:18:23 +0200
message:
  MDEV-3880: test suite added.
  
  MDEV-3881: removed commented out code.
-------------- next part --------------
=== modified file 'mysql-test/r/subselect_exists2in.result'
--- a/mysql-test/r/subselect_exists2in.result	2012-11-29 10:04:34 +0000
+++ b/mysql-test/r/subselect_exists2in.result	2012-11-29 10:18:23 +0000
@@ -743,6 +743,24 @@ a1	b1
 6	w
 drop table t1, t2;
 #
+# MDEV-3880: Wrong result (missing rows) with exists_to_in=on,
+# LEFT JOIN and NOT EXISTS subquery.
+# (Duplicate of above MDEV-3879).
+#
+SET optimizer_switch = 'exists_to_in=on';
+CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'b'),(5,'y');
+CREATE TABLE t2 (b2 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('z'),('b');
+CREATE TABLE t3 (a3 INT, b3 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4,'j'),(6,'v');
+SELECT * FROM t1 LEFT JOIN t2 ON ( b2 = b1 ) 
+WHERE NOT EXISTS ( SELECT * FROM t3 WHERE b3 = b2 AND a3 = a1 ) ;
+a1	b1	b2
+4	b	b
+5	y	NULL
+drop table t1, t2, t3;
+#
 # MDEV-3881: Endless loop and crash in Item_ref::real_item with
 # exists_to_in=on, NOT EXISTS subquery, merge view or from subquery,
 # constant table

=== modified file 'mysql-test/t/subselect_exists2in.test'
--- a/mysql-test/t/subselect_exists2in.test	2012-11-29 10:04:34 +0000
+++ b/mysql-test/t/subselect_exists2in.test	2012-11-29 10:18:23 +0000
@@ -586,6 +586,29 @@ WHERE NOT EXISTS ( SELECT * FROM t2 WHER
 drop table t1, t2;
 
 --echo #
+--echo # MDEV-3880: Wrong result (missing rows) with exists_to_in=on,
+--echo # LEFT JOIN and NOT EXISTS subquery.
+--echo # (Duplicate of above MDEV-3879).
+--echo #
+
+SET optimizer_switch = 'exists_to_in=on';
+CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'b'),(5,'y');
+
+CREATE TABLE t2 (b2 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('z'),('b');
+
+CREATE TABLE t3 (a3 INT, b3 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4,'j'),(6,'v');
+
+SELECT * FROM t1 LEFT JOIN t2 ON ( b2 = b1 ) 
+WHERE NOT EXISTS ( SELECT * FROM t3 WHERE b3 = b2 AND a3 = a1 ) ;
+
+drop table t1, t2, t3;
+
+
+
+--echo #
 --echo # MDEV-3881: Endless loop and crash in Item_ref::real_item with
 --echo # exists_to_in=on, NOT EXISTS subquery, merge view or from subquery,
 --echo # constant table
@@ -620,7 +643,5 @@ SELECT * FROM t1, ( SELECT * FROM t2 ) a
 
 drop table t1, t2, t3;
 
-
-
 #restore defaults
 set optimizer_switch=default;

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2012-11-29 10:04:34 +0000
+++ b/sql/item_subselect.cc	2012-11-29 10:18:23 +0000
@@ -2571,16 +2571,16 @@ static bool check_equality_for_exist2in(
       args[0]->all_used_tables() != OUTER_REF_TABLE_BIT &&
       args[1]->all_used_tables() == OUTER_REF_TABLE_BIT)
   {
-    *local_field= (Item_field *)args[0];//->real_item();
-    *outer_exp= args[1];//->real_item();
+    *local_field= (Item_field *)args[0];
+    *outer_exp= args[1];
     return TRUE;
   }
   else if (args[1]->real_type() == Item::FIELD_ITEM &&
            args[1]->all_used_tables() != OUTER_REF_TABLE_BIT &&
            args[0]->all_used_tables() == OUTER_REF_TABLE_BIT)
   {
-    *local_field= (Item_field *)args[1];//->real_item();
-    *outer_exp= args[0];//->real_item();
+    *local_field= (Item_field *)args[1];
+    *outer_exp= args[0];
     return TRUE;
   }
 



More information about the commits mailing list