[Commits] Rev 3503: LP BUG#978847 fixed. in file:///home/bell/maria/bzr/work-maria-5.3-lpb978847/

sanja at montyprogram.com sanja at montyprogram.com
Tue Apr 17 23:40:13 EEST 2012


At file:///home/bell/maria/bzr/work-maria-5.3-lpb978847/

------------------------------------------------------------
revno: 3503
revision-id: sanja at montyprogram.com-20120417204012-jote7508bhnac1nq
parent: wlad at montyprogram.com-20120416213538-761a4vkzg1sokgo2
committer: sanja at montyprogram.com
branch nick: work-maria-5.3-lpb978847
timestamp: Tue 2012-04-17 23:40:12 +0300
message:
  LP BUG#978847 fixed.
  
  Fixed incorrect type casting which made all fields (except very first) changes to materialized table incorrect.
-------------- next part --------------
=== modified file 'mysql-test/r/derived_view.result'
--- a/mysql-test/r/derived_view.result	2012-04-05 20:32:57 +0000
+++ b/mysql-test/r/derived_view.result	2012-04-17 20:40:12 +0000
@@ -2034,6 +2034,27 @@ a
 drop table t1,t2;
 set optimizer_switch=@save968720_optimizer_switch;
 #
+# LP BUG#978847 Server crashes in Item_ref::real_item on
+# INSERT .. SELECT with FROM subquery and derived_merge=ON
+SET @save978847_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on';
+CREATE TABLE t1 ( a INT, b INT );
+INSERT INTO t1 VALUES (2,1),(3,2);
+select * from t1;
+a	b
+2	1
+3	2
+INSERT INTO t1 SELECT * FROM
+( SELECT * FROM t1 ) AS alias;
+select * from t1;
+a	b
+2	1
+3	2
+2	1
+3	2
+drop table t1;
+set optimizer_switch=@save978847_optimizer_switch;
+#
 # end of 5.3 tests
 #
 set optimizer_switch=@exit_optimizer_switch;

=== modified file 'mysql-test/t/derived_view.test'
--- a/mysql-test/t/derived_view.test	2012-04-05 20:32:57 +0000
+++ b/mysql-test/t/derived_view.test	2012-04-17 20:40:12 +0000
@@ -1414,6 +1414,24 @@ drop table t1,t2;
 set optimizer_switch=@save968720_optimizer_switch;
 
 --echo #
+--echo # LP BUG#978847 Server crashes in Item_ref::real_item on
+--echo # INSERT .. SELECT with FROM subquery and derived_merge=ON
+SET @save978847_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on';
+
+CREATE TABLE t1 ( a INT, b INT );
+INSERT INTO t1 VALUES (2,1),(3,2);
+
+select * from t1;
+INSERT INTO t1 SELECT * FROM
+  ( SELECT * FROM t1 ) AS alias;
+select * from t1;
+
+drop table t1;
+
+set optimizer_switch=@save978847_optimizer_switch;
+
+--echo #
 --echo # end of 5.3 tests
 --echo #
 

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2012-04-05 20:32:57 +0000
+++ b/sql/table.cc	2012-04-17 20:40:12 +0000
@@ -6088,7 +6088,8 @@ bool TABLE_LIST::change_refs_to_fields()
       We need to restore the pointers after the execution of the
       prepared statement.
     */
-    thd->change_item_tree((Item **)&ref->ref, (Item*)materialized_items + idx);
+    thd->change_item_tree((Item **)&ref->ref,
+                          (Item*)(materialized_items + idx));
   }
 
   return FALSE;



More information about the commits mailing list