List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:June 27 2006 3:43am
Subject:bk commit into 5.0 tree (jimw:1.2200) BUG#17766
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw 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
  1.2200 06/06/26 18:43:34 jimw@stripped +6 -0
  Bug #17766: The server accepts to create MERGE tables which cannot work
  
   This throws an error when creating a MERGE table with no UNION
   specified, instead of allowing it and throwing errors when trying
   to insert data.

  sql/share/errmsg.txt
    1.65 06/06/26 18:43:31 jimw@stripped +2 -0
    Add new error message

  sql/handler.cc
    1.213 06/06/26 18:43:31 jimw@stripped +1 -0
    Handle new error message

  sql/ha_myisammrg.cc
    1.78 06/06/26 18:43:31 jimw@stripped +3 -0
    Return an error when creating a merge table with no UNION.

  mysql-test/t/merge.test
    1.42 06/06/26 18:43:31 jimw@stripped +7 -8
    Remove obsolete test, and add new regression test

  mysql-test/r/merge.result
    1.49 06/06/26 18:43:31 jimw@stripped +3 -4
    Update results

  include/my_base.h
    1.78 06/06/26 18:43:31 jimw@stripped +2 -1
    Add new handler error

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-17766

--- 1.77/include/my_base.h	2006-03-10 06:04:04 -08:00
+++ 1.78/include/my_base.h	2006-06-26 18:43:31 -07:00
@@ -347,8 +347,9 @@ enum ha_base_keytype {
 #define HA_ERR_NULL_IN_SPATIAL   158  /* NULLs are not supported in spatial index */
 #define HA_ERR_TABLE_DEF_CHANGED 159  /* The table changed in storage engine */
 #define HA_ERR_TABLE_NEEDS_UPGRADE 160  /* The table changed in storage engine */
+#define HA_ERR_MRG_TABLE_MISSING_UNION 161 /* Merge table has no UNION */
 
-#define HA_ERR_LAST              160  /*Copy last error nr.*/
+#define HA_ERR_LAST              161  /*Copy last error nr.*/
 /* Add error numbers before HA_ERR_LAST and change it accordingly. */
 #define HA_ERR_ERRORS            (HA_ERR_LAST - HA_ERR_FIRST + 1)
 

--- 1.77/sql/ha_myisammrg.cc	2006-05-09 13:31:42 -07:00
+++ 1.78/sql/ha_myisammrg.cc	2006-06-26 18:43:31 -07:00
@@ -454,6 +454,9 @@ int ha_myisammrg::create(const char *nam
   uint dirlgt= dirname_length(name);
   DBUG_ENTER("ha_myisammrg::create");
 
+  if (!create_info->merge_list.elements)
+    DBUG_RETURN(HA_ERR_MRG_TABLE_MISSING_UNION);
+
   if (!(table_names= (const char**)
         thd->alloc((create_info->merge_list.elements+1) * sizeof(char*))))
     DBUG_RETURN(HA_ERR_OUT_OF_MEM);

--- 1.212/sql/handler.cc	2006-04-13 00:25:52 -07:00
+++ 1.213/sql/handler.cc	2006-06-26 18:43:31 -07:00
@@ -426,6 +426,7 @@ static int ha_init_errors(void)
   SETMSG(HA_ERR_NO_CONNECTION,          "Could not connect to storage engine");
   SETMSG(HA_ERR_TABLE_DEF_CHANGED,      ER(ER_TABLE_DEF_CHANGED));
   SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE,    ER(ER_TABLE_NEEDS_UPGRADE));
+  SETMSG(HA_ERR_MRG_TABLE_MISSING_UNION,ER(ER_MRG_TABLE_MISSING_UNION));
 
   /* Register the error messages for use with my_error(). */
   return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);

--- 1.64/sql/share/errmsg.txt	2006-05-14 13:51:02 -07:00
+++ 1.65/sql/share/errmsg.txt	2006-06-26 18:43:31 -07:00
@@ -5619,3 +5619,5 @@ ER_NON_GROUPING_FIELD_USED 42000
 	eng "non-grouping field '%-.64s' is used in %-.64s clause"
 ER_TABLE_CANT_HANDLE_SPKEYS
         eng "The used table type doesn't support SPATIAL indexes"
+ER_MRG_TABLE_MISSING_UNION
+	eng "Incorrect table definition; UNION(<table_list>) must be specified in MERGE
table options"

--- 1.48/mysql-test/r/merge.result	2006-05-30 17:10:50 -07:00
+++ 1.49/mysql-test/r/merge.result	2006-06-26 18:43:31 -07:00
@@ -272,10 +272,6 @@ t3	CREATE TABLE `t3` (
   `othr` int(11) NOT NULL
 ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
 drop table t3,t2,t1;
-create table t1 (a int not null, key(a)) engine=merge;
-select * from t1;
-a
-drop table t1;
 create table t1 (a int not null, b int not null, key(a,b));
 create table t2 (a int not null, b int not null, key(a,b));
 create table t3 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2);
@@ -782,3 +778,6 @@ create table tm (b bit(1)) engine = merg
 select * from tm;
 b
 drop table tm, t1, t2;
+create table t1 (a int) engine = merge;
+ERROR HY000: Can't create table './test/t1.frm' (errno: 161)
+End of 5.0 tests

--- 1.41/mysql-test/t/merge.test	2006-05-30 17:10:50 -07:00
+++ 1.42/mysql-test/t/merge.test	2006-06-26 18:43:31 -07:00
@@ -118,13 +118,6 @@ show create table t3;
 drop table t3,t2,t1;
 
 #
-# Test table without unions
-#
-create table t1 (a int not null, key(a)) engine=merge;
-select * from t1;
-drop table t1;
-
-#
 # Bug in flush tables combined with MERGE tables
 #
 
@@ -399,4 +392,10 @@ create table tm (b bit(1)) engine = merg
 select * from tm;
 drop table tm, t1, t2;
 
-# End of 5.0 tests
+#
+# Bug #17766: The server accepts to create MERGE tables which cannot work
+#
+--error 1005
+create table t1 (a int) engine = merge;
+
+--echo End of 5.0 tests
Thread
bk commit into 5.0 tree (jimw:1.2200) BUG#17766Jim Winstead27 Jun