List:Commits« Previous MessageNext Message »
From:Alex Ivanov Notebook Date:January 30 2006 12:17pm
Subject:bk commit into 4.1 tree (aivanov:1.2453) BUG#16387
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of alexi. When alexi 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.2453 06/01/30 15:17:33 aivanov@stripped +3 -0
  Fixed BUG#16387.
    Applied innodb-4.1-ss17 snapshot.
    Do not mistake TABLENAME_ibfk_0 for auto-generated id.

  mysql-test/t/innodb.test
    1.79 06/01/30 15:17:30 aivanov@stripped +13 -0
    Applied innodb-4.1-ss17 snapshot.
      Added test case.

  mysql-test/r/innodb.result
    1.108 06/01/30 15:17:30 aivanov@stripped +13 -0
    Applied innodb-4.1-ss17 snapshot.
      Fixed results for added test case.

  innobase/dict/dict0dict.c
    1.66 06/01/30 15:17:30 aivanov@stripped +2 -1
    Applied innodb-4.1-ss17 snapshot.
      dict_table_get_highest_foreign_id(): Ignore foreign
      constraint identifiers starting with the pattern
      TABLENAME_ibfk_0 (BUG#16387).

# 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:	aivanov
# Host:	mysqld.creware.com
# Root:	/home/alexi/innodb/mysql-4.1-ss17

--- 1.65/innobase/dict/dict0dict.c	2005-12-12 21:06:51 +03:00
+++ 1.66/innobase/dict/dict0dict.c	2006-01-30 15:17:30 +03:00
@@ -2755,7 +2755,8 @@
 		if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len
 		    && 0 == ut_memcmp(foreign->id, table->name, len)
 		    && 0 == ut_memcmp(foreign->id + len,
-				dict_ibfk, (sizeof dict_ibfk) - 1)) {
+				dict_ibfk, (sizeof dict_ibfk) - 1)
+		    && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') {
 			/* It is of the >= 4.0.18 format */
 
 			id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1),

--- 1.107/mysql-test/r/innodb.result	2006-01-15 14:50:04 +03:00
+++ 1.108/mysql-test/r/innodb.result	2006-01-30 15:17:30 +03:00
@@ -1794,3 +1794,16 @@
 7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
 update t1 set b = 'three' where a = 6;
 drop table t1;
+CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2(a INT) ENGINE=InnoDB;
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
+ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
+SHOW CREATE TABLE t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `a` int(11) default NULL,
+  KEY `t2_ibfk_0` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t2,t1;

--- 1.78/mysql-test/t/innodb.test	2006-01-15 14:50:04 +03:00
+++ 1.79/mysql-test/t/innodb.test	2006-01-30 15:17:30 +03:00
@@ -1365,4 +1365,17 @@
 select a,hex(b) from t1 order by b;
 update t1 set b = 'three' where a = 6;
 drop table t1;
+
+# Ensure that <tablename>_ibfk_0 is not mistreated as a
+# generated foreign key identifier.  (Bug #16387)
+
+CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2(a INT) ENGINE=InnoDB;
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
+ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
+SHOW CREATE TABLE t2;
+DROP TABLE t2,t1;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (aivanov:1.2453) BUG#16387Alex Ivanov Notebook30 Jan