List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:May 24 2012 8:20am
Subject:bzr push into mysql-5.5-cluster-7.3-fk branch (pekka.nousiainen:3903 to
3904) Bug#14095785 WL#6244
View as plain text  
 3904 Pekka Nousiainen	2012-05-23
      wl#6244 bug14095785a.diff
      bug#14095785: (a) fix via ha_ndb

    added:
      mysql-test/suite/ndb/r/ndb_fk_bugs.result
      mysql-test/suite/ndb/t/ndb_fk_bugs.test
    modified:
      sql/ha_ndb_ddl_fk.cc
 3903 Pekka Nousiainen	2012-05-23 [merge]
      merge 7.2 into 7.3-fk

    modified:
      mysql-test/suite/ndb/r/ndb_condition_pushdown.result
      mysql-test/suite/ndb/t/ndb_condition_pushdown.test
      sql/ha_ndbcluster_cond.cc
      storage/ndb/src/common/util/SocketClient.cpp
      storage/ndb/src/kernel/vm/mt.cpp
      support-files/mysql.spec.sh
=== added file 'mysql-test/suite/ndb/r/ndb_fk_bugs.result'
--- a/mysql-test/suite/ndb/r/ndb_fk_bugs.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_fk_bugs.result	2012-05-23 18:35:12 +0000
@@ -0,0 +1,19 @@
+drop table if exists t2, t1;
+create table t1 (
+a int not null,
+b int not null,
+primary key using hash (a),
+unique key using hash (b)
+) engine ndb;
+create table t2 (
+a int not null,
+b int not null,
+primary key using hash (a),
+key (b)
+) engine ndb;
+alter table t2
+add constraint foreign key (b) references t1 (b);
+alter table t2
+drop foreign key;
+ERROR 42000: Drop foreign key must specify key name
+drop table t2, t1;

=== added file 'mysql-test/suite/ndb/t/ndb_fk_bugs.test'
--- a/mysql-test/suite/ndb/t/ndb_fk_bugs.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_fk_bugs.test	2012-05-23 18:35:12 +0000
@@ -0,0 +1,31 @@
+-- source include/have_ndb.inc
+-- source have_ndb_fk.inc
+
+# BUG 14095785 - DROPPING FK WITHOUT LABEL CAUSED MYSQLD TO CRASH
+
+-- disable_warnings
+drop table if exists t2, t1;
+-- enable_warnings
+
+create table t1 (
+  a int not null,
+  b int not null,
+  primary key using hash (a),
+  unique key using hash (b)
+) engine ndb;
+
+create table t2 (
+  a int not null,
+  b int not null,
+  primary key using hash (a),
+  key (b)
+) engine ndb;
+
+alter table t2
+  add constraint foreign key (b) references t1 (b);
+
+-- error ER_SYNTAX_ERROR
+alter table t2
+  drop foreign key;
+
+drop table t2, t1;

=== modified file 'sql/ha_ndb_ddl_fk.cc'
--- a/sql/ha_ndb_ddl_fk.cc	2012-05-16 09:50:51 +0000
+++ b/sql/ha_ndb_ddl_fk.cc	2012-05-23 18:35:12 +0000
@@ -964,6 +964,18 @@ ha_ndbcluster::drop_fk_for_online_alter(
       char db_and_name[FN_LEN + 1];
       const char * name= fk_split_name(db_and_name,obj_list.elements[i].name);
 
+      /*
+       * sql_yacc allows "..drop foreign key;" with no FK name
+       * (or column list) and passes NULL name here from opt_ident
+       */
+      if (drop_item->name == 0)
+      {
+        my_printf_error(ER_SYNTAX_ERROR,
+                        "Drop foreign key must specify key name",
+                        MYF(0));
+        DBUG_RETURN(1);
+      }
+
       if (strcmp(drop_item->name, name) == 0)
       {
         found= true;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.3-fk branch (pekka.nousiainen:3903 to3904) Bug#14095785 WL#6244Pekka Nousiainen24 May