MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:gluh Date:December 14 2006 1:35pm
Subject:bk commit into 5.1 tree (gluh:1.2359) BUG#25026
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of gluh. When gluh 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, 2006-12-14 17:35:28+04:00, gluh@stripped +3 -0
  Fix for bug#25026 `information_schema.KEY_COLUMN_USAGE`.`REFERENCED_TABLE_NAME` returns garbage
  unencode referenced table name

  mysql-test/r/information_schema_inno.result@stripped, 2006-12-14 17:35:22+04:00, gluh@stripped +18 -0
    test case

  mysql-test/t/information_schema_inno.test@stripped, 2006-12-14 17:35:23+04:00, gluh@stripped +20 -0
    test case

  sql/sql_show.cc@stripped, 2006-12-14 17:35:23+04:00, gluh@stripped +5 -3
    unencode referenced table name

# 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:	gluh
# Host:	gluh.(none)
# Root:	/home/gluh/MySQL/Bugs/5.1.25026

--- 1.379/sql/sql_show.cc	2006-12-14 17:35:39 +04:00
+++ 1.380/sql/sql_show.cc	2006-12-14 17:35:39 +04:00
@@ -3865,6 +3865,8 @@ static int get_schema_key_column_usage_r
       uint f_idx= 0;
       while ((f_info= it++))
       {
+        char uname[NAME_LEN*3+1];           /* Unencoded name */
+        uint ulen;
         r_info= it1++;
         f_idx++;
         restore_record(table, s->default_values);
@@ -3879,9 +3881,9 @@ static int get_schema_key_column_usage_r
                                f_key_info->referenced_db->length,
                                system_charset_info);
         table->field[9]->set_notnull();
-        table->field[10]->store(f_key_info->referenced_table->str,
-                                f_key_info->referenced_table->length, 
-                                system_charset_info);
+        ulen= filename_to_tablename(f_key_info->referenced_table->str,
+                                    uname, sizeof(uname));
+        table->field[10]->store(uname, ulen, system_charset_info);
         table->field[10]->set_notnull();
         table->field[11]->store(r_info->str, r_info->length,
                                 system_charset_info);

--- 1.9/mysql-test/r/information_schema_inno.result	2006-12-14 17:35:39 +04:00
+++ 1.10/mysql-test/r/information_schema_inno.result	2006-12-14 17:35:39 +04:00
@@ -56,3 +56,21 @@ test	t3	FOREIGN KEY	A2	test	t2	NONE	SET 
 test	t4	FOREIGN KEY	A3	test	t3	NONE	NO ACTION	SET NULL
 test	t5	FOREIGN KEY	A4	test	t4	NONE	RESTRICT	CASCADE
 drop tables t5, t4, t3, t2, t1;
+create table t2 (
+id int(10) unsigned not null auto_increment,
+primary key (id)
+) engine=innodb;
+create table t1 (
+id int(10) unsigned not null auto_increment,
+idtype int(10) unsigned not null,
+primary key (id),
+key fk_t1_1 (idtype),
+constraint fk_t1_1 foreign key (idtype) references t2 (id)
+) engine=innodb;
+select referenced_table_name from information_schema.key_column_usage 
+where constraint_schema = 'test';
+referenced_table_name
+NULL
+t2
+NULL
+drop table t1,t2;

--- 1.6/mysql-test/t/information_schema_inno.test	2006-12-14 17:35:39 +04:00
+++ 1.7/mysql-test/t/information_schema_inno.test	2006-12-14 17:35:39 +04:00
@@ -53,3 +53,23 @@ from information_schema.TABLE_CONSTRAINT
 where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
 a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
 drop tables t5, t4, t3, t2, t1;
+
+#
+# Bug#25026  `information_schema.KEY_COLUMN_USAGE`.`REFERENCED_TABLE_NAME` returns garbage
+#
+create table t2 (
+  id int(10) unsigned not null auto_increment,
+  primary key (id)
+) engine=innodb;
+
+create table t1 (
+  id int(10) unsigned not null auto_increment,
+  idtype int(10) unsigned not null,
+  primary key (id),
+  key fk_t1_1 (idtype),
+  constraint fk_t1_1 foreign key (idtype) references t2 (id)
+) engine=innodb;
+
+select referenced_table_name from information_schema.key_column_usage 
+where constraint_schema = 'test';
+drop table t1,t2;
Thread
bk commit into 5.1 tree (gluh:1.2359) BUG#25026gluh14 Dec