Commit 46716503 authored by cmiller@zippy.(none)'s avatar cmiller@zippy.(none)

Merge zippy.(none):/home/cmiller/work/mysql/merge/tmp_merge

into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new

(With hand-merged tests.)
parents b532fca0 62b85c13
...@@ -234,7 +234,7 @@ n after commit ...@@ -234,7 +234,7 @@ n after commit
commit; commit;
insert into t1 values (5); insert into t1 values (5);
insert into t1 values (4); insert into t1 values (4);
ERROR 23000: Duplicate entry '4' for key 'PRIMARY' ERROR 23000: Duplicate entry '4' for key 1
commit; commit;
select n, "after commit" from t1; select n, "after commit" from t1;
n after commit n after commit
...@@ -243,7 +243,7 @@ n after commit ...@@ -243,7 +243,7 @@ n after commit
set autocommit=1; set autocommit=1;
insert into t1 values (6); insert into t1 values (6);
insert into t1 values (4); insert into t1 values (4);
ERROR 23000: Duplicate entry '4' for key 'PRIMARY' ERROR 23000: Duplicate entry '4' for key 1
select n from t1; select n from t1;
n n
4 4
...@@ -318,7 +318,7 @@ drop table t1; ...@@ -318,7 +318,7 @@ drop table t1;
CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
insert into t1 values ('pippo', 12); insert into t1 values ('pippo', 12);
insert into t1 values ('pippo', 12); insert into t1 values ('pippo', 12);
ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY' ERROR 23000: Duplicate entry 'pippo' for key 1
delete from t1; delete from t1;
delete from t1 where id = 'pippo'; delete from t1 where id = 'pippo';
select * from t1; select * from t1;
...@@ -482,9 +482,9 @@ UNIQUE ggid (ggid) ...@@ -482,9 +482,9 @@ UNIQUE ggid (ggid)
insert into t1 (ggid,passwd) values ('test1','xxx'); insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy'); insert into t1 (ggid,passwd) values ('test2','yyy');
insert into t1 (ggid,passwd) values ('test2','this will fail'); insert into t1 (ggid,passwd) values ('test2','this will fail');
ERROR 23000: Duplicate entry 'test2' for key 'ggid' ERROR 23000: Duplicate entry 'test2' for key 2
insert into t1 (ggid,id) values ('this will fail',1); insert into t1 (ggid,id) values ('this will fail',1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 1
select * from t1 where ggid='test1'; select * from t1 where ggid='test1';
id ggid email passwd id ggid email passwd
1 test1 xxx 1 test1 xxx
...@@ -497,7 +497,7 @@ id ggid email passwd ...@@ -497,7 +497,7 @@ id ggid email passwd
replace into t1 (ggid,id) values ('this will work',1); replace into t1 (ggid,id) values ('this will work',1);
replace into t1 (ggid,passwd) values ('test2','this will work'); replace into t1 (ggid,passwd) values ('test2','this will work');
update t1 set id=100,ggid='test2' where id=1; update t1 set id=100,ggid='test2' where id=1;
ERROR 23000: Duplicate entry 'test2' for key 'ggid' ERROR 23000: Duplicate entry 'test2' for key 2
select * from t1; select * from t1;
id ggid email passwd id ggid email passwd
1 this will work 1 this will work
...@@ -816,7 +816,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3 ...@@ -816,7 +816,7 @@ create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(3
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1; select id from t1;
id id
0 0
...@@ -834,7 +834,7 @@ insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJ ...@@ -834,7 +834,7 @@ insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJ
LOCK TABLES t1 WRITE; LOCK TABLES t1 WRITE;
begin; begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1-1' for key 1
select id from t1; select id from t1;
id id
0 0
...@@ -856,7 +856,7 @@ create table t1 (a char(20), index (a(5))) engine=innodb; ...@@ -856,7 +856,7 @@ create table t1 (a char(20), index (a(5))) engine=innodb;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` char(20) DEFAULT NULL, `a` char(20) default NULL,
KEY `a` (`a`(5)) KEY `a` (`a`(5))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1; drop table t1;
...@@ -1587,9 +1587,9 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const ...@@ -1587,9 +1587,9 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL, `id2` int(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id` (`id`,`id2`), KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
...@@ -1598,7 +1598,7 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const ...@@ -1598,7 +1598,7 @@ create table t2 (id int(11) not null auto_increment, id2 int(11) not null, const
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL, `id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`), KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
...@@ -1607,7 +1607,7 @@ alter table t2 add index id_test (id), add index id_test2 (id,id2); ...@@ -1607,7 +1607,7 @@ alter table t2 add index id_test (id), add index id_test2 (id,id2);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL, `id2` int(11) NOT NULL,
KEY `id_test` (`id`), KEY `id_test` (`id`),
KEY `id_test2` (`id`,`id2`), KEY `id_test2` (`id`,`id2`),
...@@ -1615,14 +1615,14 @@ t2 CREATE TABLE `t2` ( ...@@ -1615,14 +1615,14 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2; drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table './test/t2' (errno: 150)
create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb; create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL AUTO_INCREMENT, `a` int(11) NOT NULL auto_increment,
`b` int(11) DEFAULT NULL, `b` int(11) default NULL,
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
UNIQUE KEY `b_2` (`b`), UNIQUE KEY `b_2` (`b`),
KEY `b` (`b`), KEY `b` (`b`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
...@@ -1632,14 +1632,37 @@ create table t2 (a int auto_increment primary key, b int, foreign key (b) refere ...@@ -1632,14 +1632,37 @@ create table t2 (a int auto_increment primary key, b int, foreign key (b) refere
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL AUTO_INCREMENT, `a` int(11) NOT NULL auto_increment,
`b` int(11) DEFAULT NULL, `b` int(11) default NULL,
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
UNIQUE KEY `b` (`b`), UNIQUE KEY `b` (`b`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`), CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t1; drop table t2, t1;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 155
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 0
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 156
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
begin;
delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 157
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
create table t1 (c char(10), index (c,c)) engine=innodb; create table t1 (c char(10), index (c,c)) engine=innodb;
ERROR 42S21: Duplicate column name 'c' ERROR 42S21: Duplicate column name 'c'
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
...@@ -1751,6 +1774,21 @@ select count(*) from t1 where x = 18446744073709551601; ...@@ -1751,6 +1774,21 @@ select count(*) from t1 where x = 18446744073709551601;
count(*) count(*)
1 1
drop table t1; drop table t1;
show status like "Innodb_buffer_pool_pages_total";
Variable_name Value
Innodb_buffer_pool_pages_total 512
show status like "Innodb_page_size";
Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
Innodb_rows_deleted 2070
show status like "Innodb_rows_inserted";
Variable_name Value
Innodb_rows_inserted 31727
show status like "Innodb_rows_updated";
Variable_name Value
Innodb_rows_updated 29530
show status like "Innodb_row_lock_waits"; show status like "Innodb_row_lock_waits";
Variable_name Value Variable_name Value
Innodb_row_lock_waits 0 Innodb_row_lock_waits 0
...@@ -1783,7 +1821,7 @@ Variable_name Value ...@@ -1783,7 +1821,7 @@ Variable_name Value
innodb_sync_spin_loops 20 innodb_sync_spin_loops 20
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
Variable_name Value Variable_name Value
innodb_thread_concurrency 20 innodb_thread_concurrency 8
set global innodb_thread_concurrency=1001; set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
Variable_name Value Variable_name Value
...@@ -1791,7 +1829,7 @@ innodb_thread_concurrency 1000 ...@@ -1791,7 +1829,7 @@ innodb_thread_concurrency 1000
set global innodb_thread_concurrency=0; set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
Variable_name Value Variable_name Value
innodb_thread_concurrency 1 innodb_thread_concurrency 0
set global innodb_thread_concurrency=16; set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
Variable_name Value Variable_name Value
...@@ -1843,40 +1881,40 @@ concat('*',v,'*',c,'*',t,'*') ...@@ -1843,40 +1881,40 @@ concat('*',v,'*',c,'*',t,'*')
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL, `v` varchar(10) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text `t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
create table t2 like t1; create table t2 like t1;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`v` varchar(10) DEFAULT NULL, `v` varchar(10) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text `t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
create table t3 select * from t1; create table t3 select * from t1;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`v` varchar(10) DEFAULT NULL, `v` varchar(10) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text `t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 modify c varchar(10); alter table t1 modify c varchar(10);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL, `v` varchar(10) default NULL,
`c` varchar(10) DEFAULT NULL, `c` varchar(10) default NULL,
`t` text `t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 modify v char(10); alter table t1 modify v char(10);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` char(10) DEFAULT NULL, `v` char(10) default NULL,
`c` varchar(10) DEFAULT NULL, `c` varchar(10) default NULL,
`t` text `t` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10); alter table t1 modify t varchar(10);
...@@ -1885,9 +1923,9 @@ Note 1265 Data truncated for column 't' at row 2 ...@@ -1885,9 +1923,9 @@ Note 1265 Data truncated for column 't' at row 2
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` char(10) DEFAULT NULL, `v` char(10) default NULL,
`c` varchar(10) DEFAULT NULL, `c` varchar(10) default NULL,
`t` varchar(10) DEFAULT NULL `t` varchar(10) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
select concat('*',v,'*',c,'*',t,'*') from t1; select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*') concat('*',v,'*',c,'*',t,'*')
...@@ -1898,8 +1936,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10))); ...@@ -1898,8 +1936,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL, `v` varchar(10) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text, `t` text,
KEY `v` (`v`), KEY `v` (`v`),
KEY `c` (`c`), KEY `c` (`c`),
...@@ -1964,7 +2002,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' ...@@ -1964,7 +2002,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index 1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v); alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 'v_2' ERROR 23000: Duplicate entry '{ ' for key 1
alter table t1 add key(v); alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq qq
...@@ -2117,8 +2155,8 @@ alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v); ...@@ -2117,8 +2155,8 @@ alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL, `v` varchar(300) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text, `t` text,
KEY `c` (`c`), KEY `c` (`c`),
KEY `t` (`t`(10)), KEY `t` (`t`(10)),
...@@ -2197,8 +2235,8 @@ alter table t1 drop key v, add key v (v(30)); ...@@ -2197,8 +2235,8 @@ alter table t1 drop key v, add key v (v(30));
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(300) DEFAULT NULL, `v` varchar(300) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text, `t` text,
KEY `c` (`c`), KEY `c` (`c`),
KEY `t` (`t`(10)), KEY `t` (`t`(10)),
...@@ -2277,8 +2315,8 @@ alter table t1 modify v varchar(600), drop key v, add key v (v); ...@@ -2277,8 +2315,8 @@ alter table t1 modify v varchar(600), drop key v, add key v (v);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(600) DEFAULT NULL, `v` varchar(600) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text, `t` text,
KEY `c` (`c`), KEY `c` (`c`),
KEY `t` (`t`(10)), KEY `t` (`t`(10)),
...@@ -2324,16 +2362,16 @@ drop table t1; ...@@ -2324,16 +2362,16 @@ drop table t1;
create table t1 (a char(10), unique (a)); create table t1 (a char(10), unique (a));
insert into t1 values ('a '); insert into t1 values ('a ');
insert into t1 values ('a '); insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a' for key 'a' ERROR 23000: Duplicate entry 'a' for key 1
alter table t1 modify a varchar(10); alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a '); insert into t1 values ('a '),('a '),('a '),('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a' ERROR 23000: Duplicate entry 'a ' for key 1
insert into t1 values ('a '); insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a' ERROR 23000: Duplicate entry 'a ' for key 1
insert into t1 values ('a '); insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a' ERROR 23000: Duplicate entry 'a ' for key 1
insert into t1 values ('a '); insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 'a' ERROR 23000: Duplicate entry 'a ' for key 1
update t1 set a='a ' where a like 'a%'; update t1 set a='a ' where a like 'a%';
select concat(a,'.') from t1; select concat(a,'.') from t1;
concat(a,'.') concat(a,'.')
...@@ -2355,8 +2393,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t( ...@@ -2355,8 +2393,8 @@ create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL, `v` varchar(10) default NULL,
`c` char(10) DEFAULT NULL, `c` char(10) default NULL,
`t` text, `t` text,
KEY `v` (`v`(5)), KEY `v` (`v`(5)),
KEY `c` (`c`(5)), KEY `c` (`c`(5)),
...@@ -2367,15 +2405,15 @@ create table t1 (v char(10) character set utf8); ...@@ -2367,15 +2405,15 @@ create table t1 (v char(10) character set utf8);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` char(10) CHARACTER SET utf8 DEFAULT NULL `v` char(10) character set utf8 default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (v varchar(10), c char(10)) row_format=fixed; create table t1 (v varchar(10), c char(10)) row_format=fixed;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` varchar(10) DEFAULT NULL, `v` varchar(10) default NULL,
`c` char(10) DEFAULT NULL `c` char(10) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
insert into t1 values('a','a'),('a ','a '); insert into t1 values('a','a'),('a ','a ');
select concat('*',v,'*',c,'*') from t1; select concat('*',v,'*',c,'*') from t1;
...@@ -2417,7 +2455,7 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT ...@@ -2417,7 +2455,7 @@ Note 1246 Converting column 'v' from VARCHAR to TEXT
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`v` mediumtext CHARACTER SET utf8 `v` mediumtext character set utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1; drop table t1;
set storage_engine=MyISAM; set storage_engine=MyISAM;
...@@ -2456,7 +2494,7 @@ key (rowid), unique(val)) engine=innodb; ...@@ -2456,7 +2494,7 @@ key (rowid), unique(val)) engine=innodb;
replace into t1 (val) values ('1'),('2'); replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2'); replace into t1 (val) values ('1'),('2');
insert into t1 (val) values ('1'),('2'); insert into t1 (val) values ('1'),('2');
ERROR 23000: Duplicate entry '1' for key 'val' ERROR 23000: Duplicate entry '1' for key 2
select * from t1; select * from t1;
rowid val rowid val
3 1 3 1
...@@ -2466,7 +2504,7 @@ create table t1 (a int not null auto_increment primary key, val int) engine=Inno ...@@ -2466,7 +2504,7 @@ create table t1 (a int not null auto_increment primary key, val int) engine=Inno
insert into t1 (val) values (1); insert into t1 (val) values (1);
update t1 set a=2 where a=1; update t1 set a=2 where a=1;
insert into t1 (val) values (1); insert into t1 (val) values (1);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 1
select * from t1; select * from t1;
a val a val
2 1 2 1
...@@ -2544,8 +2582,8 @@ character set = latin1 engine = innodb; ...@@ -2544,8 +2582,8 @@ character set = latin1 engine = innodb;
show create table t9; show create table t9;
Table Create Table Table Create Table
t9 CREATE TABLE `t9` ( t9 CREATE TABLE `t9` (
`col1` varchar(512) DEFAULT NULL, `col1` varchar(512) default NULL,
`col2` varchar(512) DEFAULT NULL, `col2` varchar(512) default NULL,
KEY `col1` (`col1`,`col2`) KEY `col1` (`col1`,`col2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
...@@ -2568,7 +2606,7 @@ Warning 1071 Specified key was too long; max key length is 767 bytes ...@@ -2568,7 +2606,7 @@ Warning 1071 Specified key was too long; max key length is 767 bytes
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`col1` varchar(768) DEFAULT NULL, `col1` varchar(768) default NULL,
KEY `col1` (`col1`(767)) KEY `col1` (`col1`(767))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1, t2, t3, t4; drop table t1, t2, t3, t4;
...@@ -2847,13 +2885,13 @@ commit; ...@@ -2847,13 +2885,13 @@ commit;
set foreign_key_checks=0; set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
create table t1(a char(10) primary key, b varchar(20)) engine = innodb; create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
ERROR HY000: Can't create table 'test.t1' (errno: 150) ERROR HY000: Can't create table './test/t1.frm' (errno: 150)
set foreign_key_checks=1; set foreign_key_checks=1;
drop table t2; drop table t2;
set foreign_key_checks=0; set foreign_key_checks=0;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
ERROR HY000: Can't create table 'test.t2' (errno: 150) ERROR HY000: Can't create table './test/t2.frm' (errno: 150)
set foreign_key_checks=1; set foreign_key_checks=1;
drop table t1; drop table t1;
set foreign_key_checks=0; set foreign_key_checks=0;
...@@ -2924,13 +2962,13 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; ...@@ -2924,13 +2962,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; create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
insert into t1 values (0x41),(0x4120),(0x4100); insert into t1 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' ERROR 23000: Duplicate entry 'A' for key 1
insert into t2 values (0x41),(0x4120); insert into t2 values (0x41),(0x4120);
insert into t3 values (0x41),(0x4120),(0x4100); insert into t3 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY' ERROR 23000: Duplicate entry 'A ' for key 1
insert into t3 values (0x41),(0x4100); insert into t3 values (0x41),(0x4100);
insert into t4 values (0x41),(0x4120),(0x4100); insert into t4 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' ERROR 23000: Duplicate entry 'A' for key 1
insert into t4 values (0x41),(0x4100); insert into t4 values (0x41),(0x4100);
select hex(s1) from t1; select hex(s1) from t1;
hex(s1) hex(s1)
...@@ -3132,7 +3170,7 @@ ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; ...@@ -3132,7 +3170,7 @@ ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL, `a` int(11) default NULL,
KEY `t2_ibfk_0` (`a`) KEY `t2_ibfk_0` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2,t1; DROP TABLE t2,t1;
...@@ -3194,52 +3232,12 @@ drop trigger t2t; ...@@ -3194,52 +3232,12 @@ drop trigger t2t;
drop trigger t3t; drop trigger t3t;
drop trigger t4t; drop trigger t4t;
drop table t1, t2, t3, t4, t5; drop table t1, t2, t3, t4, t5;
CREATE TABLE t1 ( create table t1(a date) engine=innodb;
field1 varchar(8) NOT NULL DEFAULT '', create table t2(a date, key(a)) engine=innodb;
field2 varchar(8) NOT NULL DEFAULT '', insert into t1 values('2005-10-01');
PRIMARY KEY (field1, field2) insert into t2 values('2005-10-01');
) ENGINE=InnoDB; select * from t1, t2
CREATE TABLE t2 ( where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY, a a
FOREIGN KEY (field1) REFERENCES t1 (field1) 2005-10-01 2005-10-01
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; drop table t1, t2;
...@@ -1141,6 +1141,40 @@ show create table t2; ...@@ -1141,6 +1141,40 @@ show create table t2;
drop table t2, t1; drop table t2, t1;
#
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
# Actually this test has nothing to do with innodb per se, it just requires
# transactional table.
#
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
create table t1 (a int) engine=innodb;
# Now we are going to create transaction which is long enough so its
# transaction binlog will be flushed to disk...
let $1=2000;
disable_query_log;
begin;
while ($1)
{
eval insert into t1 values( $1 );
dec $1;
}
commit;
enable_query_log;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
# Transaction which should not be flushed to disk and so should not
# increase binlog_cache_disk_use.
begin;
delete from t1;
commit;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
drop table t1;
# #
# Bug #6126: Duplicate columns in keys gives misleading error message # Bug #6126: Duplicate columns in keys gives misleading error message
# #
...@@ -1255,6 +1289,15 @@ select * from t1 where x > -16; ...@@ -1255,6 +1289,15 @@ select * from t1 where x > -16;
select count(*) from t1 where x = 18446744073709551601; select count(*) from t1 where x = 18446744073709551601;
drop table t1; drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
show status like "Innodb_buffer_pool_pages_total";
show status like "Innodb_page_size";
show status like "Innodb_rows_deleted";
show status like "Innodb_rows_inserted";
show status like "Innodb_rows_updated";
# Test for row locks InnoDB status variables. # Test for row locks InnoDB status variables.
show status like "Innodb_row_lock_waits"; show status like "Innodb_row_lock_waits";
show status like "Innodb_row_lock_current_waits"; show status like "Innodb_row_lock_current_waits";
...@@ -2086,55 +2129,13 @@ disconnect a; ...@@ -2086,55 +2129,13 @@ disconnect a;
disconnect b; disconnect b;
# #
# Test that cascading updates leading to duplicate keys give the correct # Bug #14360: problem with intervals
# error message (bug #9680)
# #
CREATE TABLE t1 ( create table t1(a date) engine=innodb;
field1 varchar(8) NOT NULL DEFAULT '', create table t2(a date, key(a)) engine=innodb;
field2 varchar(8) NOT NULL DEFAULT '', insert into t1 values('2005-10-01');
PRIMARY KEY (field1, field2) insert into t2 values('2005-10-01');
) ENGINE=InnoDB; select * from t1, t2
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
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');
--error ER_FOREIGN_DUPLICATE_KEY
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
DROP TABLE t2;
DROP TABLE t1;
#
# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
#
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;
#
alter table t1 drop foreign key c2_fk;
show create table t1;
#
drop table t1, t2; drop table t1, t2;
...@@ -2002,6 +2002,41 @@ longlong Item_date_add_interval::val_int() ...@@ -2002,6 +2002,41 @@ longlong Item_date_add_interval::val_int()
((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second; ((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second;
} }
bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
{
INTERVAL interval, other_interval;
String val= value; // Because of const
if (this == item)
return TRUE;
if ((item->type() != FUNC_ITEM) ||
(arg_count != ((Item_func*) item)->arg_count) ||
(func_name() != ((Item_func*) item)->func_name()))
return FALSE;
Item_date_add_interval *other= (Item_date_add_interval*) item;
if ((int_type != other->int_type) ||
(!args[0]->eq(other->args[0], binary_cmp)) ||
(get_interval_value(args[1], int_type, &val, &interval)))
return FALSE;
val= other->value;
if ((get_interval_value(other->args[1], other->int_type, &val,
&other_interval)) ||
((date_sub_interval ^ interval.neg) ^
(other->date_sub_interval ^ other_interval.neg)))
return FALSE;
// Assume comparing same types here due to earlier check
return memcmp(&interval, &other_interval, sizeof(INTERVAL)) == 0;
}
static const char *interval_names[]= static const char *interval_names[]=
{ {
"year", "quarter", "month", "day", "hour", "year", "quarter", "month", "day", "hour",
......
...@@ -647,6 +647,7 @@ class Item_date_add_interval :public Item_date_func ...@@ -647,6 +647,7 @@ class Item_date_add_interval :public Item_date_func
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); } double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
longlong val_int(); longlong val_int();
bool get_date(TIME *res, uint fuzzy_date); bool get_date(TIME *res, uint fuzzy_date);
bool eq(const Item *item, bool binary_cmp) const;
void print(String *str); void print(String *str);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment