List:Commits« Previous MessageNext Message »
From:gluh Date:March 13 2008 1:06pm
Subject:bk commit into 5.1 tree (gluh:1.2583) BUG#35108
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, 2008-03-13 17:06:04+04:00, gluh@stripped +3 -0
  Bug#35108 SELECT FROM REFERENTIAL_CONSTRAINTS crashes
  referenced_key_name field can be uninitialized in the case when
  referenced table is dropped.
  Added codition which allows to handle this situation.

  mysql-test/r/information_schema_inno.result@stripped, 2008-03-13 17:06:01+04:00, gluh@stripped +10 -0
    test result

  mysql-test/t/information_schema_inno.test@stripped, 2008-03-13 17:06:01+04:00, gluh@stripped +12 -0
    test case

  sql/sql_show.cc@stripped, 2008-03-13 17:06:01+04:00, gluh@stripped +9 -3
    referenced_key_name field can be uninitialized in the case when
    referenced table is dropped.
    Added codition which allows to handle this situation.

diff -Nrup a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result
--- a/mysql-test/r/information_schema_inno.result	2007-01-15 13:39:26 +04:00
+++ b/mysql-test/r/information_schema_inno.result	2008-03-13 17:06:01 +04:00
@@ -78,3 +78,13 @@ NULL	NULL
 db-1	t-2
 NULL	NULL
 drop database `db-1`;
+create table t1(id int primary key) engine = Innodb;
+create table t2(pid int, foreign key (pid) references t1(id)) engine = Innodb;
+set foreign_key_checks = 0;
+drop table t1;
+select UNIQUE_CONSTRAINT_NAME
+from information_schema.referential_constraints
+where constraint_schema = schema();
+UNIQUE_CONSTRAINT_NAME
+NULL
+drop table t2;
diff -Nrup a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test
--- a/mysql-test/t/information_schema_inno.test	2007-01-15 13:39:26 +04:00
+++ b/mysql-test/t/information_schema_inno.test	2008-03-13 17:06:01 +04:00
@@ -76,3 +76,15 @@ select referenced_table_schema, referenc
 from information_schema.key_column_usage
 where constraint_schema = 'db-1';
 drop database `db-1`;
+
+#
+# Bug#35108 SELECT FROM REFERENTIAL_CONSTRAINTS crashes
+#
+create table t1(id int primary key) engine = Innodb;
+create table t2(pid int, foreign key (pid) references t1(id)) engine = Innodb;
+set foreign_key_checks = 0;
+drop table t1;
+select UNIQUE_CONSTRAINT_NAME
+from information_schema.referential_constraints
+where constraint_schema = schema();
+drop table t2;
diff -Nrup a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc	2008-02-01 14:50:18 +04:00
+++ b/sql/sql_show.cc	2008-03-13 17:06:01 +04:00
@@ -5276,8 +5276,14 @@ get_referential_constraints_record(THD *
                              f_key_info->referenced_db->length, cs);
       table->field[10]->store(f_key_info->referenced_table->str, 
                              f_key_info->referenced_table->length, cs);
-      table->field[5]->store(f_key_info->referenced_key_name->str, 
-                             f_key_info->referenced_key_name->length, cs);
+      if (f_key_info->referenced_key_name)
+      {
+        table->field[5]->store(f_key_info->referenced_key_name->str, 
+                               f_key_info->referenced_key_name->length, cs);
+        table->field[5]->set_notnull();
+      }
+      else
+        table->field[5]->set_null();
       table->field[6]->store(STRING_WITH_LEN("NONE"), cs);
       table->field[7]->store(f_key_info->update_method->str, 
                              f_key_info->update_method->length, cs);
@@ -6478,7 +6484,7 @@ ST_FIELD_INFO referential_constraints_fi
    OPEN_FULL_TABLE},
   {"UNIQUE_CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
    OPEN_FULL_TABLE},
-  {"UNIQUE_CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+  {"UNIQUE_CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
    OPEN_FULL_TABLE},
   {"MATCH_OPTION", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
   {"UPDATE_RULE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
Thread
bk commit into 5.1 tree (gluh:1.2583) BUG#35108gluh13 Mar