MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Anurag Shekhar Date:April 17 2009 10:11am
Subject:bzr commit into mysql-6.0-bugteam branch (anurag.shekhar:3217)
Bug#44040
View as plain text  
#At file:///home/anurag/mysqlsrc/mysql-6.0-bugteam/ based on revid:anurag.shekhar@stripped

 3217 Anurag Shekhar	2009-04-17
      Bug#44040 MySQL allows creating a MERGE table upon VIEWs but crashes when 
                using it.
      
      Due to changes in code base in 6.0 the fix for 5.1 is not valid in 6.0.
      To fix in 6.0 added a check in merge engine.
     @ mysql-test/r/merge.result
        Updated results for the new test case.
     @ mysql-test/t/merge.test
        Added new test case for this bug.
     @ storage/myisammrg/ha_myisammrg.cc
        Added a check in myisammrg_attach_children_callback to check
        if the child table is view. If the child table is a view 
        return error.

    modified:
      mysql-test/r/merge.result
      mysql-test/t/merge.test
      storage/myisammrg/ha_myisammrg.cc
=== modified file 'mysql-test/r/merge.result'
--- a/mysql-test/r/merge.result	2009-04-17 09:58:42 +0000
+++ b/mysql-test/r/merge.result	2009-04-17 10:11:28 +0000
@@ -2015,6 +2015,18 @@ insert into m1 (col1) values (1);
 insert into m1 (col1) values (1);
 ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
 drop table m1, t1;
+CREATE TABLE t1 (
+col1 INT(10)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
+CREATE VIEW v1 as SELECT * FROM t1;
+CREATE TABLE m1 (
+col1 INT(10)
+)ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(v1);
+#Select should detect that the child table is a view and fail.
+SELECT * FROM m1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+DROP VIEW v1;
+DROP TABLE m1, t1;
 End of 5.1 tests
 #
 # An additional test case for Bug#27430 Crash in subquery code

=== modified file 'mysql-test/t/merge.test'
--- a/mysql-test/t/merge.test	2009-04-17 09:58:42 +0000
+++ b/mysql-test/t/merge.test	2009-04-17 10:11:28 +0000
@@ -1376,6 +1376,27 @@ insert into m1 (col1) values (1);
 insert into m1 (col1) values (1);
 
 drop table m1, t1;
+
+#
+#Bug #44040   MySQL allows creating a MERGE table upon VIEWs but crashes 
+#when using it
+#
+
+CREATE TABLE t1 (
+        col1 INT(10)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
+
+CREATE VIEW v1 as SELECT * FROM t1;
+CREATE TABLE m1 (
+        col1 INT(10)
+)ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(v1);
+
+--echo #Select should detect that the child table is a view and fail.
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM m1;
+
+DROP VIEW v1;
+DROP TABLE m1, t1;
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc	2009-04-09 11:05:57 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc	2009-04-17 10:11:28 +0000
@@ -490,6 +490,16 @@ static MI_INFO *myisammrg_attach_childre
     my_errno= 0; /* Ok, no more child tables. */
     goto end;
   }
+
+  /*
+    view as child table is not supported.
+  */
+  if (child_l->view)
+  {
+    my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
+    goto end;
+  }
+  
   child= child_l->table;
   /*
     Prepare for next child. Used as child_l in next call to this function.


Attachment: [text/bzr-bundle] bzr/anurag.shekhar@sun.com-20090417101128-2fcaovhcoztlpci7.bundle
Thread
bzr commit into mysql-6.0-bugteam branch (anurag.shekhar:3217)Bug#44040Anurag Shekhar17 Apr