[Commits] Rev 3685: Fixed bug mdev-4952 in file:///home/igor/maria/maria-5.3/

Igor Babaev igor at askmonty.org
Tue Aug 27 01:51:48 EEST 2013


At file:///home/igor/maria/maria-5.3/

------------------------------------------------------------
revno: 3685
revision-id: igor at askmonty.org-20130826225147-cb5wezwpfgkn6i22
parent: igor at askmonty.org-20130826195558-bdfh22gblb7e5ahr
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.3
timestamp: Mon 2013-08-26 15:51:47 -0700
message:
  Fixed bug mdev-4952
  When in function remove_eq_conds() a sub-formula of the processed condition
  is replaced for another formula we should ensure that in the resulting
  formula AND/OR levels must alternate.
-------------- next part --------------
=== modified file 'mysql-test/r/join_outer.result'
--- a/mysql-test/r/join_outer.result	2013-08-26 19:55:58 +0000
+++ b/mysql-test/r/join_outer.result	2013-08-26 22:51:47 +0000
@@ -1848,4 +1848,18 @@
 SELECT * FROM t1 LEFT JOIN t2 ON i1 = i2 WHERE d1 IS NULL AND d2 IS NULL;
 i1	d1	i2	d2
 DROP TABLE t1,t2;
+#
+# Bug mdev-4952: LEFT JOIN with disjunctive 
+#                <non-nullable datetime field> IS NULL in WHERE 
+#                causes an assert failure  
+#
+CREATE TABLE t1 (a1 int, b1 int NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 10), (2, 11);
+CREATE TABLE t2 (dt datetime NOT NULL, a2 int, b2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('2006-10-08 09:34:54', 1, 100), ('2001-01-19 01:04:43', 2, 200);
+SELECT * FROM t1 LEFT JOIN t2 ON a1 = a2
+WHERE ( dt IS NULL OR FALSE ) AND b2 IS NULL;
+a1	b1	dt	a2	b2
+DROP TABLE t1,t2;
 SET optimizer_switch=@save_optimizer_switch;

=== modified file 'mysql-test/r/join_outer_jcl6.result'
--- a/mysql-test/r/join_outer_jcl6.result	2013-08-26 19:55:58 +0000
+++ b/mysql-test/r/join_outer_jcl6.result	2013-08-26 22:51:47 +0000
@@ -1859,6 +1859,20 @@
 SELECT * FROM t1 LEFT JOIN t2 ON i1 = i2 WHERE d1 IS NULL AND d2 IS NULL;
 i1	d1	i2	d2
 DROP TABLE t1,t2;
+#
+# Bug mdev-4952: LEFT JOIN with disjunctive 
+#                <non-nullable datetime field> IS NULL in WHERE 
+#                causes an assert failure  
+#
+CREATE TABLE t1 (a1 int, b1 int NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 10), (2, 11);
+CREATE TABLE t2 (dt datetime NOT NULL, a2 int, b2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('2006-10-08 09:34:54', 1, 100), ('2001-01-19 01:04:43', 2, 200);
+SELECT * FROM t1 LEFT JOIN t2 ON a1 = a2
+WHERE ( dt IS NULL OR FALSE ) AND b2 IS NULL;
+a1	b1	dt	a2	b2
+DROP TABLE t1,t2;
 SET optimizer_switch=@save_optimizer_switch;
 set join_cache_level=default;
 show variables like 'join_cache_level';

=== modified file 'mysql-test/t/join_outer.test'
--- a/mysql-test/t/join_outer.test	2013-08-24 05:17:02 +0000
+++ b/mysql-test/t/join_outer.test	2013-08-26 22:51:47 +0000
@@ -1392,4 +1392,22 @@
 
 DROP TABLE t1,t2;
 
+--echo #
+--echo # Bug mdev-4952: LEFT JOIN with disjunctive 
+--echo #                <non-nullable datetime field> IS NULL in WHERE 
+--echo #                causes an assert failure  
+--echo #
+
+CREATE TABLE t1 (a1 int, b1 int NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 10), (2, 11);
+
+CREATE TABLE t2 (dt datetime NOT NULL, a2 int, b2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('2006-10-08 09:34:54', 1, 100), ('2001-01-19 01:04:43', 2, 200);
+
+SELECT * FROM t1 LEFT JOIN t2 ON a1 = a2
+  WHERE ( dt IS NULL OR FALSE ) AND b2 IS NULL;
+
+DROP TABLE t1,t2;
+
 SET optimizer_switch=@save_optimizer_switch;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2013-08-26 19:55:58 +0000
+++ b/sql/sql_select.cc	2013-08-26 22:51:47 +0000
@@ -13407,7 +13407,20 @@
         }
         else
 	{
-          li.replace(new_item);
+          if (new_item->type() == Item::COND_ITEM &&
+              ((Item_cond*) new_item)->functype() == 
+              ((Item_cond*) cond)->functype())
+	  {
+	    List<Item> *new_item_arg_list=
+              ((Item_cond *) new_item)->argument_list();
+            uint cnt= new_item_arg_list->elements;
+            li.replace(*new_item_arg_list);
+            /* Make iterator li ignore new items */
+            for (cnt--; cnt; cnt--)
+              li++;
+          }
+          else
+            li.replace(new_item);
           should_fix_fields= 1;
         } 
       }   



More information about the commits mailing list