List:Commits« Previous MessageNext Message »
From:Magne Mahre Date:December 5 2008 1:01pm
Subject:bzr commit into mysql-6.0-runtime branch (magne.mahre:2766) Bug#31031
View as plain text  
#At file:///export/home/tmp/z/mysql-6.0-runtime-fix31031/ based on revid:alik@stripped

 2766 Magne Mahre	2008-12-05
      Bug #31031  	ALTER TABLE regression in 5.0
      
      Certain ALTER TABLE statements failed with Error 1089,
      with no appearant reason.  In particular if you combined
      a DROP and an ADD in the same statement.
      
      The problem was in a check introduced to fix 26794, which
      was slightly wrong (a logical OR that should have been a
      logical AND).
modified:
  mysql-test/r/alter_table.result
  mysql-test/t/alter_table.test
  sql/sql_table.cc

=== modified file 'mysql-test/r/alter_table.result'

=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result	2008-11-06 18:39:27 +0000
+++ b/mysql-test/r/alter_table.result	2008-12-05 13:01:13 +0000
@@ -1253,3 +1253,10 @@
 5	a
 DROP TABLE t1;
 End of 5.1 tests
+CREATE TABLE t1(c CHAR(10), 
+i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES('a',2),('b',4),('c',6);
+ALTER TABLE t1
+DROP i,
+ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
+AUTO_INCREMENT = 1;

=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test	2008-11-06 18:39:27 +0000
+++ b/mysql-test/t/alter_table.test	2008-12-05 13:01:13 +0000
@@ -988,3 +988,17 @@
 DROP TABLE t1;
 
 --echo End of 5.1 tests
+
+#
+# Bug #31031 ALTER TABLE regression in 5.0
+#
+#  The ALTER TABLE operation failed with 
+#  ERROR 1089 (HY000): Incorrect sub part key; ...
+#
+CREATE TABLE t1(c CHAR(10), 
+  i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES('a',2),('b',4),('c',6);
+ALTER TABLE t1
+  DROP i,
+  ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
+  AUTO_INCREMENT = 1;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2008-12-04 16:50:07 +0000
+++ b/sql/sql_table.cc	2008-12-05 13:01:13 +0000
@@ -2972,7 +2972,7 @@
 	  }
 	}
 	else if (!f_is_geom(sql_field->pack_flag) &&
-		  (column->length > length ||
+		  (column->length > length &&
                    !Field::type_can_have_key_part (sql_field->sql_type) ||
 		   ((f_is_packed(sql_field->pack_flag) ||
 		     ((file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&

Thread
bzr commit into mysql-6.0-runtime branch (magne.mahre:2766) Bug#31031Magne Mahre5 Dec