[Commits] Rev 4153: Fixed the problem of mdev-5970: in file:///home/igor/maria/maria-10.0-bugs/

Igor Babaev igor at askmonty.org
Thu Apr 17 22:53:54 EEST 2014


At file:///home/igor/maria/maria-10.0-bugs/

------------------------------------------------------------
revno: 4153
revision-id: igor at askmonty.org-20140417195353-y3y0mc2prcz1ylhz
parent: svoj at mariadb.org-20140416054930-fsp4jajo2tzp4yrd
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-10.0-bugs
timestamp: Thu 2014-04-17 12:53:53 -0700
message:
  Fixed the problem of mdev-5970: 
  back-ported the patch for bug #13256831 from mysql-5.6 code line.
  
    Here's the comment this patch was provided with:
  
    Fixed bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD.
  
    This bug only occurs if a user tries to update a base table using
    an updatable view and this view was created as a join for which
    the clause 'WITH CHECK OPTION' was specified.
  
    The reason for the bug was that when such an update was
    executed, row positions were not properly handled for tables
    that were not updated but had constraints that had to be
    checked due to the 'WITH CHECK OPTION' clause.
  
    The reason for the bug was that when such update is executed
    then for tables specified in the view definition and
    also listed in the 'WITH CHECK OPTION' clause the positioning to
    row being updated is not performed.
-------------- next part --------------
=== modified file 'mysql-test/r/multi_update.result'
--- a/mysql-test/r/multi_update.result	2014-01-31 10:06:28 +0000
+++ b/mysql-test/r/multi_update.result	2014-04-17 19:53:53 +0000
@@ -795,3 +795,25 @@
 1	7	11	4
 DROP TABLE t1,t2;
 end of 5.5 tests
+
+# Bug mdev-5970
+# Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (5, 7);
+INSERT INTO t2 VALUES (6, 97);
+CREATE ALGORITHM = MERGE VIEW v1 AS 
+SELECT a2.f1 AS f1, a2.f2 AS f2
+FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1 
+WITH LOCAL CHECK OPTION;
+SELECT * FROM v1;
+f1	f2
+6	97
+UPDATE v1 SET f1 = 1;
+SELECT * FROM v1;
+f1	f2
+1	97
+DROP TABLE t1, t2;
+DROP VIEW v1;
+end of 10.0 tests

=== modified file 'mysql-test/t/multi_update.test'
--- a/mysql-test/t/multi_update.test	2013-09-14 01:09:36 +0000
+++ b/mysql-test/t/multi_update.test	2014-04-17 19:53:53 +0000
@@ -810,3 +810,29 @@
 
 --echo end of 5.5 tests
 
+
+--source include/have_xtradb.inc
+
+--echo
+--echo # Bug mdev-5970
+--echo # Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD
+--echo
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (5, 7);
+INSERT INTO t2 VALUES (6, 97);
+
+CREATE ALGORITHM = MERGE VIEW v1 AS 
+SELECT a2.f1 AS f1, a2.f2 AS f2
+FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1 
+WITH LOCAL CHECK OPTION; 
+
+SELECT * FROM v1;
+UPDATE v1 SET f1 = 1;
+SELECT * FROM v1;
+
+DROP TABLE t1, t2;
+DROP VIEW v1;
+
+--echo end of 10.0 tests

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2014-03-24 06:18:01 +0000
+++ b/sql/sql_update.cc	2014-04-17 19:53:53 +0000
@@ -1917,6 +1917,13 @@
     TABLE *tbl= table;
     do
     {
+      /*
+        Signal each table (including tables referenced by WITH CHECK OPTION
+        clause) for which we will store row position in the temporary table
+        that we need a position to be read first.
+      */
+      tbl->prepare_for_position();
+
       Field_string *field= new Field_string(tbl->file->ref_length, 0,
                                             tbl->alias.c_ptr(),
                                             &my_charset_bin);



More information about the commits mailing list