summaryrefslogtreecommitdiff
path: root/mysql-test/include/mix1.inc
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.(none)>2007-10-08 02:05:10 +0400
committerunknown <kostja@bodhi.(none)>2007-10-08 02:05:10 +0400
commitded7fe7fd16d35b0a63a7a417b67fdd31df5033d (patch)
treef4b4f76a55ded111308cad01bf89cd645eae2663 /mysql-test/include/mix1.inc
parent03bef972d3b508013cfcad2de294569ecdf16158 (diff)
parentc215e78d1607a9afc55df3df3d5499d283ffed63 (diff)
downloadmariadb-git-ded7fe7fd16d35b0a63a7a417b67fdd31df5033d.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into bodhi.(none):/opt/local/work/mysql-5.1-runtime mysql-test/include/mix1.inc: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/sp.test: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged libmysql/libmysql.c: Manual merge.
Diffstat (limited to 'mysql-test/include/mix1.inc')
-rw-r--r--mysql-test/include/mix1.inc34
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index e2a22303d9d..aee5613ff35 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -1146,4 +1146,38 @@ select @b:=f2 from t1;
select if(@a=@b,"ok","wrong");
drop table t1;
+#
+# Bug#30747 Create table with identical constraint names behaves incorrectly
+#
+
+if ($test_foreign_keys)
+{
+ CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b)) engine=innodb;
+ --error ER_WRONG_FK_DEF
+ CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+ CONSTRAINT c2 FOREIGN KEY f2 (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb;
+ --error ER_WRONG_FK_DEF
+ CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+ CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a,b) ON UPDATE NO ACTION) engine=innodb;
+ CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+ CONSTRAINT c1 FOREIGN KEY c2 (c) REFERENCES t1 (a) ON DELETE NO ACTION,
+ CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb;
+ ALTER TABLE t2 DROP FOREIGN KEY c2;
+ DROP TABLE t2;
+ --error ER_WRONG_FK_DEF
+ CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+ FOREIGN KEY (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb;
+ --error ER_WRONG_FK_DEF
+ CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+ FOREIGN KEY f1 (c) REFERENCES t1 (a,k) ON UPDATE NO ACTION) engine=innodb;
+ CREATE TABLE t2 (c INT NOT NULL, d INT NOT NULL, PRIMARY KEY (c,d),
+ CONSTRAINT c1 FOREIGN KEY f1 (c) REFERENCES t1 (a) ON DELETE NO ACTION,
+ CONSTRAINT c2 FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION,
+ FOREIGN KEY f3 (c) REFERENCES t1 (a) ON UPDATE NO ACTION,
+ FOREIGN KEY (c) REFERENCES t1 (a) ON UPDATE NO ACTION) engine=innodb;
+ SHOW CREATE TABLE t2;
+ DROP TABLE t2;
+ DROP TABLE t1;
+}
+
--echo End of 5.1 tests