Commit 474b4887 authored by jan's avatar jan

Port a change from MySQL:

WL#1563 - Modify MySQL to support fast CREATE/DROP INDEX
Change "duplicate key" message to print key name
instead of key number.
parent a4f9f1d4
......@@ -234,7 +234,7 @@ n after commit
commit;
insert into t1 values (5);
insert into t1 values (4);
ERROR 23000: Duplicate entry '4' for key 1
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
commit;
select n, "after commit" from t1;
n after commit
......@@ -243,7 +243,7 @@ n after commit
set autocommit=1;
insert into t1 values (6);
insert into t1 values (4);
ERROR 23000: Duplicate entry '4' for key 1
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
select n from t1;
n
4
......@@ -318,7 +318,7 @@ drop table t1;
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);
ERROR 23000: Duplicate entry 'pippo' for key 1
ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY'
delete from t1;
delete from t1 where id = 'pippo';
select * from t1;
......@@ -482,9 +482,9 @@ UNIQUE ggid (ggid)
insert into t1 (ggid,passwd) values ('test1','xxx');
insert into t1 (ggid,passwd) values ('test2','yyy');
insert into t1 (ggid,passwd) values ('test2','this will fail');
ERROR 23000: Duplicate entry 'test2' for key 2
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
insert into t1 (ggid,id) values ('this will fail',1);
ERROR 23000: Duplicate entry '1' for key 1
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1 where ggid='test1';
id ggid email passwd
1 test1 xxx
......@@ -497,7 +497,7 @@ id ggid email passwd
replace into t1 (ggid,id) values ('this will work',1);
replace into t1 (ggid,passwd) values ('test2','this will work');
update t1 set id=100,ggid='test2' where id=1;
ERROR 23000: Duplicate entry 'test2' for key 2
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
select * from t1;
id ggid email passwd
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
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
LOCK TABLES t1 WRITE;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
ERROR 23000: Duplicate entry '1-1' for key 1
ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
......@@ -834,7 +834,7 @@ insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJ
LOCK TABLES t1 WRITE;
begin;
insert into t1 values (99,1,2,'D'),(1,1,2,'D');
ERROR 23000: Duplicate entry '1-1' for key 1
ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
select id from t1;
id
0
......@@ -1783,7 +1783,7 @@ Variable_name Value
innodb_sync_spin_loops 20
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 0
innodb_thread_concurrency 20
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
Variable_name Value
......@@ -1791,7 +1791,7 @@ innodb_thread_concurrency 1000
set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 0
innodb_thread_concurrency 1
set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
Variable_name Value
......@@ -1964,7 +1964,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
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry '{ ' for key 1
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
......@@ -2324,16 +2324,16 @@ drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a ');
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a' for key 1
ERROR 23000: Duplicate entry 'a' for key 'a'
alter table t1 modify a varchar(10);
insert into t1 values ('a '),('a '),('a '),('a ');
ERROR 23000: Duplicate entry 'a ' for key 1
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 1
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 1
ERROR 23000: Duplicate entry 'a ' for key 'a'
insert into t1 values ('a ');
ERROR 23000: Duplicate entry 'a ' for key 1
ERROR 23000: Duplicate entry 'a ' for key 'a'
update t1 set a='a ' where a like 'a%';
select concat(a,'.') from t1;
concat(a,'.')
......@@ -2456,7 +2456,7 @@ key (rowid), unique(val)) engine=innodb;
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
insert into t1 (val) values ('1'),('2');
ERROR 23000: Duplicate entry '1' for key 2
ERROR 23000: Duplicate entry '1' for key 'val'
select * from t1;
rowid val
3 1
......@@ -2466,7 +2466,7 @@ create table t1 (a int not null auto_increment primary key, val int) engine=Inno
insert into t1 (val) values (1);
update t1 set a=2 where a=1;
insert into t1 (val) values (1);
ERROR 23000: Duplicate entry '2' for key 1
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
select * from t1;
a val
2 1
......@@ -2943,13 +2943,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)
......@@ -3152,7 +3152,9 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) default NULL,
KEY `t2_ibfk_0` (`a`)
KEY `t2_ibfk_0` (`a`),
CONSTRAINT `t2_ibfk_0` FOREIGN KEY (`a`) REFERENCES `t1` (`a`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2,t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
......
......@@ -121,7 +121,7 @@ id a
begin;
insert into t3 VALUES ( NULL, 1, 1, 2 );
insert into t3 VALUES ( NULL, 1, 1, 2 );
ERROR 23000: Duplicate entry '1-1' for key 2
ERROR 23000: Duplicate entry '1-1' for key 't1_id'
commit;
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
id a
......
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