List:Commits« Previous MessageNext Message »
From:konstantin Date:July 18 2007 12:02pm
Subject:bk commit into 5.0 tree (kostja:1.2531) BUG#26104
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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, 2007-07-18 16:01:58+04:00, kostja@bodhi.(none) +3 -0
  A fix and a test case for Bug#26104 Bug on foreign key class constructor.
  
  Fix the typo in the constructor. Cover a semantic check that previously
  never worked with a test.

  mysql-test/r/create.result@stripped, 2007-07-18 16:01:56+04:00, kostja@bodhi.(none) +16 -0
    Update results (Bug#26104)

  mysql-test/t/create.test@stripped, 2007-07-18 16:01:56+04:00, kostja@bodhi.(none) +19 -0
    Add a test case for Bug#26104 Bug on foreign key class constructor

  sql/sql_class.h@stripped, 2007-07-18 16:01:56+04:00, kostja@bodhi.(none) +1 -1
    A fix for Bug#26104 Bug on foreign key class constructor -- fix
    the typo in the constructor

diff -Nrup a/mysql-test/r/create.result b/mysql-test/r/create.result
--- a/mysql-test/r/create.result	2007-06-27 15:35:48 +04:00
+++ b/mysql-test/r/create.result	2007-07-18 16:01:56 +04:00
@@ -1503,4 +1503,20 @@ t1	CREATE TABLE `t1` (
   `c17` int(11) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+
+Bug #26104 Bug on foreign key class constructor
+
+Check that ref_columns is initalized correctly in the constructor
+and semantic checks in mysql_prepare_table work.
+
+We do not need a storage engine that supports foreign keys
+for this test, as the checks are purely syntax-based, and the
+syntax is supported for all engines.
+
+drop table if exists t1,t2;
+create table t1(a int not null, b int not null, primary key (a, b));
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+ERROR 42000: Incorrect foreign key definition for 'fk_bug26104': Key reference and table reference don't match
+drop table t1;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/create.test b/mysql-test/t/create.test
--- a/mysql-test/t/create.test	2007-06-27 15:35:48 +04:00
+++ b/mysql-test/t/create.test	2007-07-18 16:01:56 +04:00
@@ -1118,5 +1118,24 @@ show create table t1;
 
 drop table t1;
 
+--echo
+--echo Bug #26104 Bug on foreign key class constructor
+--echo
+--echo Check that ref_columns is initalized correctly in the constructor
+--echo and semantic checks in mysql_prepare_table work.
+--echo
+--echo We do not need a storage engine that supports foreign keys
+--echo for this test, as the checks are purely syntax-based, and the
+--echo syntax is supported for all engines.
+--echo
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1(a int not null, b int not null, primary key (a, b));
+--error ER_WRONG_FK_DEF
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+drop table t1;
 
 --echo End of 5.0 tests
diff -Nrup a/sql/sql_class.h b/sql/sql_class.h
--- a/sql/sql_class.h	2007-07-06 02:42:56 +04:00
+++ b/sql/sql_class.h	2007-07-18 16:01:56 +04:00
@@ -450,7 +450,7 @@ public:
 	      Table_ident *table,   List<key_part_spec> &ref_cols,
 	      uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg)
     :Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, 0, cols),
-    ref_table(table), ref_columns(cols),
+    ref_table(table), ref_columns(ref_cols),
     delete_opt(delete_opt_arg), update_opt(update_opt_arg),
     match_opt(match_opt_arg)
   {}
Thread
bk commit into 5.0 tree (kostja:1.2531) BUG#26104konstantin18 Jul