List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:September 29 2009 2:34am
Subject:bzr push into mysql-pe branch (Sergey.Glukhov:3627 to 3628)
View as plain text  
 3628 Sergey Glukhov	2009-09-29 [merge]
      5.1-bugteam->mysql-pe merge
     @ mysql-test/t/join.test
        5.1-bugteam->mysql-pe merge
     @ sql/item.cc
        5.1-bugteam->mysql-pe merge

    modified:
      mysql-test/r/join.result
      mysql-test/t/join.test
      sql/item.cc
 3627 Jonathan Perkin	2009-09-28 [merge]
      Merge up to mysql-pe

    modified:
      support-files/binary-configure.sh
=== modified file 'mysql-test/r/join.result'
--- a/mysql-test/r/join.result	2009-06-02 13:04:43 +0000
+++ b/mysql-test/r/join.result	2009-09-29 02:32:08 +0000
@@ -1064,3 +1064,13 @@ a	b	c	d
 128	NULL	128	NULL
 DROP TABLE IF EXISTS t1,t2;
 End of 5.0 tests.
+CREATE TABLE t1 (f1 int);
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2  VALUES (1);
+CREATE VIEW v1 AS SELECT * FROM t2;
+PREPARE stmt FROM 'UPDATE t2 AS A NATURAL JOIN v1 B SET B.f1 = 1';
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1, t2;

=== modified file 'mysql-test/t/join.test'
--- a/mysql-test/t/join.test	2008-10-06 12:51:50 +0000
+++ b/mysql-test/t/join.test	2009-09-29 02:32:08 +0000
@@ -729,4 +729,24 @@ SELECT * FROM t1 JOIN t2 ON b=c ORDER BY
 SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
 
 DROP TABLE IF EXISTS t1,t2;
+
 --echo End of 5.0 tests.
+
+
+#
+# Bug#47150 Assertion in Field_long::val_int() on MERGE + TRIGGER + multi-table UPDATE
+#
+CREATE TABLE t1 (f1 int);
+
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2  VALUES (1);
+CREATE VIEW v1 AS SELECT * FROM t2;
+
+PREPARE stmt FROM 'UPDATE t2 AS A NATURAL JOIN v1 B SET B.f1 = 1';
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP VIEW v1;
+DROP TABLE t1, t2;

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-08-30 18:08:25 +0000
+++ b/sql/item.cc	2009-09-29 02:32:08 +0000
@@ -6561,9 +6561,26 @@ bool Item_direct_view_ref::fix_fields(TH
   /* view fild reference must be defined */
   DBUG_ASSERT(*ref);
   /* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */
-  if (!(*ref)->fixed &&
-      ((*ref)->fix_fields(thd, ref)))
+  if ((*ref)->fixed)
+  {
+    Item *ref_item= (*ref)->real_item();
+    if (ref_item->type() == Item::FIELD_ITEM)
+    {
+      /*
+        In some cases we need to update table read set(see bug#47150).
+        If ref item is FIELD_ITEM and fixed then field and table
+        have proper values. So we can use them for update.
+      */
+      Field *fld= ((Item_field*) ref_item)->field;
+      DBUG_ASSERT(fld && fld->table);
+      if (thd->mark_used_columns == MARK_COLUMNS_READ)
+        bitmap_set_bit(fld->table->read_set, fld->field_index);
+    }
+  }
+  else if (!(*ref)->fixed &&
+           ((*ref)->fix_fields(thd, ref)))
     return TRUE;
+
   return Item_direct_ref::fix_fields(thd, reference);
 }
 


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@sun.com-20090929023208-8ye9pbtmkd47tfes.bundle
Thread
bzr push into mysql-pe branch (Sergey.Glukhov:3627 to 3628)Sergey Glukhov29 Sep