List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:March 24 2008 11:12am
Subject:bk commit into 5.0 tree (svoj:1.2600) BUG#35274
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of svoj.  When svoj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-03-24 15:12:46+04:00, svoj@stripped +3 -0
  BUG#35274 - merge table doesn't need any base tables, gives
              error 124 when key accessed
  
  SELECT queries that use index against a merge table with empty
  underlying tables list may return with error "Got error 124 from
  storage engine".
  
  The problem was in wrong error being returned.

  myisammrg/myrg_queue.c@stripped, 2008-03-24 15:12:43+04:00, svoj@stripped +11 -1
    Return "end of file" error instead of "wrong index" error when
    we got a merge table with empty underlying tables list.

  mysql-test/r/merge.result@stripped, 2008-03-24 15:12:43+04:00, svoj@stripped +5 -0
    A test case for BUG#35274.

  mysql-test/t/merge.test@stripped, 2008-03-24 15:12:43+04:00, svoj@stripped +8 -0
    A test case for BUG#35274.

diff -Nrup a/myisammrg/myrg_queue.c b/myisammrg/myrg_queue.c
--- a/myisammrg/myrg_queue.c	2006-12-31 00:02:05 +04:00
+++ b/myisammrg/myrg_queue.c	2008-03-24 15:12:43 +04:00
@@ -65,7 +65,17 @@ int _myrg_init_queue(MYRG_INFO *info,int
     }
   }
   else
-    my_errno= error= HA_ERR_WRONG_INDEX;
+  {
+    /*
+      inx may be bigger than info->keys if there are no underlying tables
+      defined. In this case we should return empty result. As we check for
+      underlying tables conformance when we open a table, we may not enter
+      this branch with underlying table that has less keys than merge table
+      have.
+    */
+    DBUG_ASSERT(!info->open_tables);
+    error= my_errno= HA_ERR_END_OF_FILE;
+  }
   return error;
 }
 
diff -Nrup a/mysql-test/r/merge.result b/mysql-test/r/merge.result
--- a/mysql-test/r/merge.result	2008-03-14 19:38:20 +04:00
+++ b/mysql-test/r/merge.result	2008-03-24 15:12:43 +04:00
@@ -940,4 +940,9 @@ m1	CREATE TABLE `m1` (
   `a` int(11) default NULL
 ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1, m1;
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+MAX(a)
+NULL
+DROP TABLE t1;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/merge.test b/mysql-test/t/merge.test
--- a/mysql-test/t/merge.test	2008-03-14 19:38:20 +04:00
+++ b/mysql-test/t/merge.test	2008-03-24 15:12:43 +04:00
@@ -556,4 +556,12 @@ ALTER TABLE m1 UNION=();
 SHOW CREATE TABLE m1;
 DROP TABLE t1, m1;
 
+#
+# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
+#             key accessed
+#
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+DROP TABLE t1;
+
 --echo End of 5.0 tests
Thread
bk commit into 5.0 tree (svoj:1.2600) BUG#35274Sergey Vojtovich24 Mar