diff options
author | unknown <igor@rurik.mysql.com> | 2006-04-12 18:15:39 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-04-12 18:15:39 -0700 |
commit | b974b7768e16b49d8185ac41f5da3312d85f8822 (patch) | |
tree | bb72deb119cd6201301cd602780278b17cdfaa7e | |
parent | a00a3bb9eb719ad45cca33c7c14e317f2a432788 (diff) | |
download | mariadb-git-b974b7768e16b49d8185ac41f5da3312d85f8822.tar.gz |
Fixes after manual merge.
-rw-r--r-- | mysql-test/r/innodb.result | 57 | ||||
-rw-r--r-- | mysql-test/t/innodb.test | 23 |
2 files changed, 65 insertions, 15 deletions
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 0d76d9fdc7b..0ffcc70ec16 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -2924,13 +2924,13 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; insert into t1 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120),(0x4100); -ERROR 23000: Duplicate entry 'A' for key 1 +ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' insert into t2 values (0x41),(0x4120); insert into t3 values (0x41),(0x4120),(0x4100); -ERROR 23000: Duplicate entry 'A ' for key 1 +ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY' insert into t3 values (0x41),(0x4100); insert into t4 values (0x41),(0x4120),(0x4100); -ERROR 23000: Duplicate entry 'A' for key 1 +ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' insert into t4 values (0x41),(0x4100); select hex(s1) from t1; hex(s1) @@ -3132,7 +3132,7 @@ ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) default NULL, + `a` int(11) DEFAULT NULL, KEY `t2_ibfk_0` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t2,t1; @@ -3203,3 +3203,52 @@ where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; a a 2005-10-01 2005-10-01 drop table t1, t2; +CREATE TABLE t1 ( +field1 varchar(8) NOT NULL DEFAULT '', +field2 varchar(8) NOT NULL DEFAULT '', +PRIMARY KEY (field1, field2) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY, +FOREIGN KEY (field1) REFERENCES t1 (field1) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('old', 'somevalu'); +INSERT INTO t1 VALUES ('other', 'anyvalue'); +INSERT INTO t2 VALUES ('old'); +INSERT INTO t2 VALUES ('other'); +UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu'; +ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry +DROP TABLE t2; +DROP TABLE t1; +create table t1 ( +c1 bigint not null, +c2 bigint not null, +primary key (c1), +unique key (c2) +) engine=innodb; +create table t2 ( +c1 bigint not null, +primary key (c1) +) engine=innodb; +alter table t1 add constraint c2_fk foreign key (c2) +references t2(c1) on delete cascade; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL, + `c2` bigint(20) NOT NULL, + PRIMARY KEY (`c1`), + UNIQUE KEY `c2` (`c2`), + CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +alter table t1 drop foreign key c2_fk; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(20) NOT NULL, + `c2` bigint(20) NOT NULL, + PRIMARY KEY (`c1`), + UNIQUE KEY `c2` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t1, t2; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 9c8c54f2b55..83b167def73 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -2086,6 +2086,18 @@ disconnect a; disconnect b; # +# Bug #14360: problem with intervals +# + +create table t1(a date) engine=innodb; +create table t2(a date, key(a)) engine=innodb; +insert into t1 values('2005-10-01'); +insert into t2 values('2005-10-01'); +select * from t1, t2 + where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; +drop table t1, t2; + +# # Test that cascading updates leading to duplicate keys give the correct # error message (bug #9680) # @@ -2137,14 +2149,3 @@ alter table t1 drop foreign key c2_fk; show create table t1; # drop table t1, t2; - -# Bug #14360: problem with intervals -# - -create table t1(a date) engine=innodb; -create table t2(a date, key(a)) engine=innodb; -insert into t1 values('2005-10-01'); -insert into t2 values('2005-10-01'); -select * from t1, t2 - where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; -drop table t1, t2; |