summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb.test
diff options
context:
space:
mode:
authorunknown <osku@127.(none)>2005-09-23 16:44:25 +0300
committerunknown <osku@127.(none)>2005-09-23 16:44:25 +0300
commitce8af2169414c2d1ac82a6f262c6a1f5455bbfaa (patch)
treeb607cde9e322c1c8dec9f637041869446202be2a /mysql-test/t/innodb.test
parent8acd0fa42239755f026faec2e9a9fd585e1d684a (diff)
parente4b0b0d00cfb7e668f1890bbb050a476e45a1d5d (diff)
downloadmariadb-git-ce8af2169414c2d1ac82a6f262c6a1f5455bbfaa.tar.gz
Merge 127.(none):/home/osku/mysql/5.0/clean
into 127.(none):/home/osku/mysql/5.0/3443 innobase/dict/dict0dict.c: Auto merged innobase/include/trx0trx.h: Auto merged sql/ha_innodb.cc: Auto merged mysql-test/r/innodb.result: Merge fixes. mysql-test/t/innodb.test: Merge fixes.
Diffstat (limited to 'mysql-test/t/innodb.test')
-rw-r--r--mysql-test/t/innodb.test42
1 files changed, 39 insertions, 3 deletions
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index d8c9830a214..9023521c086 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -978,9 +978,9 @@ create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` )
insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
---error 1217
+--error 1451
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
---error 1217
+--error 1451
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
--error 1054
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
@@ -996,7 +996,7 @@ create table t1(
foreign key(pid) references t1(id) on delete cascade) engine=innodb;
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
--- error 1217
+-- error 1451
delete from t1 where id=0;
delete from t1 where id=15;
delete from t1 where id=0;
@@ -1528,3 +1528,39 @@ create table t4 (col1 text, index(col1(768)))
--error 1005
create table t5 (col1 blob, index(col1(768)))
character set = latin1 engine = innodb;
+
+#
+# Test improved foreign key error messages (bug #3443)
+#
+
+CREATE TABLE t1
+(
+ id INT PRIMARY KEY
+) ENGINE=InnoDB;
+
+CREATE TABLE t2
+(
+ v INT,
+ CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
+) ENGINE=InnoDB;
+
+--error 1452
+INSERT INTO t2 VALUES(2);
+
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1);
+
+--error 1451
+DELETE FROM t1 WHERE id = 1;
+
+--error 1217
+DROP TABLE t1;
+
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=1;
+
+--error 1452
+INSERT INTO t2 VALUES(3);
+
+DROP TABLE t2;