Give warnings for unused objects

Changed error message to be compatible with old error file
Added new error message for new DUP_ENTRY syntax
This commit is contained in:
monty@mysql.com/narttu.mysql.fi 2007-01-22 18:42:52 +02:00
parent 693b906f6e
commit 2dcc7110c9
60 changed files with 282 additions and 251 deletions

View File

@ -92,9 +92,9 @@ if [ "x$warning_mode" != "xpedantic" ]; then
# Both C and C++ warnings # Both C and C++ warnings
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W" warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare" warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
warnings="$warnings -Wwrite-strings" warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wshadow"
# C warnings # C warnings
c_warnings="$warnings -Wunused" c_warnings="$warnings -Wunused-parameter"
# C++ warnings # C++ warnings
cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder" cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"

View File

@ -13,7 +13,7 @@ insert into t1 values(2);
create table t2(a int); create table t2(a int);
insert into t2 values(1),(2); insert into t2 values(1),(2);
reset master; reset master;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 select * from t2; insert into t1 select * from t2;
# The above should produce an error, but still be in the binlog; # The above should produce an error, but still be in the binlog;
# verify the binlog : # verify the binlog :
@ -29,7 +29,7 @@ drop table t1, t2;
create table t1(a int); create table t1(a int);
insert into t1 values(1),(1); insert into t1 values(1),(1);
reset master; reset master;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
create table t2(unique(a)) select a from t1; create table t2(unique(a)) select a from t1;
# The above should produce an error, *and* not appear in the binlog # The above should produce an error, *and* not appear in the binlog
let $VERSION=`select version()`; let $VERSION=`select version()`;

View File

@ -273,12 +273,12 @@ set autocommit=0;
CREATE TABLE t1 (a int, b int) engine=myisam; CREATE TABLE t1 (a int, b int) engine=myisam;
reset master; reset master;
INSERT INTO t1 values (1,1),(1,2); INSERT INTO t1 values (1,1),(1,2);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t2 (primary key (a)) engine=innodb select * from t1; CREATE TABLE t2 (primary key (a)) engine=innodb select * from t1;
# This should give warning # This should give warning
DROP TABLE if exists t2; DROP TABLE if exists t2;
INSERT INTO t1 values (3,3); INSERT INTO t1 values (3,3);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1; CREATE TEMPORARY TABLE t2 (primary key (a)) engine=innodb select * from t1;
ROLLBACK; ROLLBACK;
# This should give warning # This should give warning
@ -286,12 +286,12 @@ DROP TABLE IF EXISTS t2;
CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb;
INSERT INTO t1 VALUES (4,4); INSERT INTO t1 VALUES (4,4);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
SELECT * from t2; SELECT * from t2;
TRUNCATE table t2; TRUNCATE table t2;
INSERT INTO t1 VALUES (5,5); INSERT INTO t1 VALUES (5,5);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t2 select * from t1; INSERT INTO t2 select * from t1;
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t2; DROP TABLE t2;
@ -301,25 +301,25 @@ CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb ;
INSERT INTO t1 values (7,7); INSERT INTO t1 values (7,7);
ROLLBACK; ROLLBACK;
INSERT INTO t1 values (8,8); INSERT INTO t1 values (8,8);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
COMMIT; COMMIT;
INSERT INTO t1 values (9,9); INSERT INTO t1 values (9,9);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
ROLLBACK; ROLLBACK;
SELECT * from t2; SELECT * from t2;
TRUNCATE table t2; TRUNCATE table t2;
INSERT INTO t1 values (10,10); INSERT INTO t1 values (10,10);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t2 select * from t1; INSERT INTO t2 select * from t1;
SELECT * from t1; SELECT * from t1;
INSERT INTO t2 values (100,100); INSERT INTO t2 values (100,100);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
COMMIT; COMMIT;
INSERT INTO t2 values (101,101); INSERT INTO t2 values (101,101);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1;
ROLLBACK; ROLLBACK;
SELECT * from t2; SELECT * from t2;

View File

@ -76,7 +76,7 @@ insert into t1 values (NULL),(5),(NULL),(NULL);
insert into t1 values (500),(NULL),(502),(NULL),(NULL); insert into t1 values (500),(NULL),(502),(NULL),(NULL);
select * from t1; select * from t1;
set @@insert_id=600; set @@insert_id=600;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(600),(NULL),(NULL); insert into t1 values(600),(NULL),(NULL);
set @@insert_id=600; set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL); insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
@ -119,7 +119,7 @@ set auto_increment_increment=11;
set auto_increment_offset=4; set auto_increment_offset=4;
insert into t1 values(null); insert into t1 values(null);
insert into t1 values(null); insert into t1 values(null);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(null); insert into t1 values(null);
select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a; select a, mod(a-@@auto_increment_offset,@@auto_increment_increment) from t1 order by a;

View File

@ -22,8 +22,8 @@ SET TIMESTAMP=1000000000;
CREATE TABLE t3 ( a INT UNIQUE ); CREATE TABLE t3 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
# Had to add 1022 for run with ndb as ndb uses different # Had to add 1022 for run with ndb as ndb uses different
# error and error code for 1062. Bug 16677 # error and error code for error ER_DUP_ENTRY_WITH_KEY_NAME. Bug 16677
--error 1022, 1062 --error 1022, ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t3 VALUES (1),(1); INSERT INTO t3 VALUES (1),(1);
sync_slave_with_master; sync_slave_with_master;

View File

@ -97,7 +97,7 @@ SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
# Duplicate Key Errors # Duplicate Key Errors
--error 1022, 1062 --error 1022, ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES (1),(1); INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master; sync_slave_with_master;
connection master; connection master;

View File

@ -80,7 +80,7 @@ SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
# Duplicate Key Errors codes # Duplicate Key Errors codes
--error 1022, 1062 --error 1022, ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES (1),(1); INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master; sync_slave_with_master;
connection master; connection master;

View File

@ -130,7 +130,7 @@ connection master;
reset master; reset master;
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=$engine_type; # no transactions unique(day)) engine=$engine_type; # no transactions
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines; '\n##\n' starting by '>' ignore 1 lines;
@ -146,7 +146,7 @@ select * from t2;
alter table t2 drop key day; alter table t2 drop key day;
connection master; connection master;
delete from t2; delete from t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines; '\n##\n' starting by '>' ignore 1 lines;

View File

@ -196,11 +196,11 @@ eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $t
# First we make sure that the constraints are correctly set. # First we make sure that the constraints are correctly set.
INSERT INTO t8 VALUES (99,99,99); INSERT INTO t8 VALUES (99,99,99);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t8 VALUES (99,22,33); INSERT INTO t8 VALUES (99,22,33);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t8 VALUES (11,99,33); INSERT INTO t8 VALUES (11,99,33);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t8 VALUES (11,22,99); INSERT INTO t8 VALUES (11,22,99);
SELECT * FROM t8 ORDER BY a; SELECT * FROM t8 ORDER BY a;

View File

@ -19,7 +19,7 @@ set sql_log_bin=0;
insert into t1 values(2); insert into t1 values(2);
set sql_log_bin=1; set sql_log_bin=1;
save_master_pos; save_master_pos;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(1),(2); insert into t1 values(1),(2);
drop table t1; drop table t1;
save_master_pos; save_master_pos;

View File

@ -29,7 +29,7 @@ delimiter ;//
INSERT INTO test.t2 VALUES (1, 0.0); INSERT INTO test.t2 VALUES (1, 0.0);
# Expect duplicate error 1022 == ndb # Expect duplicate error 1022 == ndb
--error 1022,1062 --error 1022,error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO test.t2 VALUES (1, 0.0); INSERT INTO test.t2 VALUES (1, 0.0);
#show binlog events; #show binlog events;

View File

@ -393,24 +393,24 @@ DROP TABLE t1;
CREATE TABLE t1 (a int, b int); CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2); insert into t1 values (1,1),(1,2);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t2 (primary key (a)) select * from t1; CREATE TABLE t2 (primary key (a)) select * from t1;
# This should give warning # This should give warning
drop table if exists t2; drop table if exists t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1; CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
# This should give warning # This should give warning
drop table if exists t2; drop table if exists t2;
CREATE TABLE t2 (a int, b int, primary key (a)); CREATE TABLE t2 (a int, b int, primary key (a));
BEGIN; BEGIN;
INSERT INTO t2 values(100,100); INSERT INTO t2 values(100,100);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2; SELECT * from t2;
ROLLBACK; ROLLBACK;
SELECT * from t2; SELECT * from t2;
TRUNCATE table t2; TRUNCATE table t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t2 select * from t1; INSERT INTO t2 select * from t1;
SELECT * from t2; SELECT * from t2;
drop table t2; drop table t2;
@ -418,19 +418,19 @@ drop table t2;
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)); CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
BEGIN; BEGIN;
INSERT INTO t2 values(100,100); INSERT INTO t2 values(100,100);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2; SELECT * from t2;
COMMIT; COMMIT;
BEGIN; BEGIN;
INSERT INTO t2 values(101,101); INSERT INTO t2 values(101,101);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2; SELECT * from t2;
ROLLBACK; ROLLBACK;
SELECT * from t2; SELECT * from t2;
TRUNCATE table t2; TRUNCATE table t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t2 select * from t1; INSERT INTO t2 select * from t1;
SELECT * from t2; SELECT * from t2;
drop table t1,t2; drop table t1,t2;

View File

@ -96,7 +96,7 @@ INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),
update t1 set parent_id=parent_id+100; update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102; select * from t1 where parent_id=102;
update t1 set id=id+1000; update t1 set id=id+1000;
-- error 1062,1022 -- error ER_DUP_ENTRY_WITH_KEY_NAME,1022
update t1 set id=1024 where id=1009; update t1 set id=1024 where id=1009;
select * from t1; select * from t1;
update ignore t1 set id=id+1; # This will change all rows update ignore t1 set id=id+1; # This will change all rows
@ -179,13 +179,13 @@ commit;
select n, "after commit" from t1; select n, "after commit" from t1;
commit; commit;
insert into t1 values (5); insert into t1 values (5);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (4); insert into t1 values (4);
commit; commit;
select n, "after commit" from t1; select n, "after commit" from t1;
set autocommit=1; set autocommit=1;
insert into t1 values (6); insert into t1 values (6);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (4); insert into t1 values (4);
select n from t1; select n from t1;
set autocommit=0; set autocommit=0;
@ -259,7 +259,7 @@ drop table t1;
eval CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=$engine_type; eval CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=$engine_type;
insert into t1 values ('pippo', 12); insert into t1 values ('pippo', 12);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('pippo', 12); # Gives error insert into t1 values ('pippo', 12); # Gives error
delete from t1; delete from t1;
delete from t1 where id = 'pippo'; delete from t1 where id = 'pippo';
@ -390,9 +390,9 @@ eval CREATE TABLE t1 (
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');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (ggid,passwd) values ('test2','this will fail'); insert into t1 (ggid,passwd) values ('test2','this will fail');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (ggid,id) values ('this will fail',1); insert into t1 (ggid,id) values ('this will fail',1);
select * from t1 where ggid='test1'; select * from t1 where ggid='test1';
@ -401,7 +401,7 @@ select * from t1 where id=2;
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');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
update t1 set id=100,ggid='test2' where id=1; update t1 set id=100,ggid='test2' where id=1;
select * from t1; select * from t1;
select * from t1 where id=1; select * from t1 where id=1;
@ -572,7 +572,7 @@ drop table t1;
eval create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=$engine_type; eval create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=$engine_type;
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;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
select id from t1; select id from t1;
@ -583,7 +583,7 @@ eval create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 c
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;
begin; begin;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
@ -1513,7 +1513,7 @@ eval create table t1 (rowid int not null auto_increment, val int not null,primar
key (rowid), unique(val)) engine=$engine_type; key (rowid), unique(val)) engine=$engine_type;
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');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (val) values ('1'),('2'); insert into t1 (val) values ('1'),('2');
select * from t1; select * from t1;
drop table t1; drop table t1;
@ -1528,7 +1528,7 @@ eval create table t1 (a int not null auto_increment primary key, val int) engine
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;
# We should get the following error because InnoDB does not update the counter # We should get the following error because InnoDB does not update the counter
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (val) values (1); insert into t1 (val) values (1);
select * from t1; select * from t1;
drop table t1; drop table t1;
@ -2027,13 +2027,13 @@ eval create table t3 (s1 varchar(2) binary,primary key (s1)) engine=$engine_type
eval create table t4 (s1 char(2) binary,primary key (s1)) engine=$engine_type; eval create table t4 (s1 char(2) binary,primary key (s1)) engine=$engine_type;
insert into t1 values (0x41),(0x4120),(0x4100); insert into t1 values (0x41),(0x4120),(0x4100);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t2 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120); insert into t2 values (0x41),(0x4120);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t3 values (0x41),(0x4120),(0x4100); insert into t3 values (0x41),(0x4120),(0x4100);
insert into t3 values (0x41),(0x4100); insert into t3 values (0x41),(0x4100);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t4 values (0x41),(0x4120),(0x4100); insert into t4 values (0x41),(0x4120),(0x4100);
insert into t4 values (0x41),(0x4100); insert into t4 values (0x41),(0x4100);
select hex(s1) from t1; select hex(s1) from t1;

View File

@ -193,7 +193,7 @@ prepare stmt1 from 'insert into t1 values(6, ? )';
execute stmt1 using @arg00; execute stmt1 using @arg00;
select a,b from t1 where b = @arg00; select a,b from t1 where b = @arg00;
# the second insert fails, because the first column is primary key # the second insert fails, because the first column is primary key
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
execute stmt1 using @arg00; execute stmt1 using @arg00;
set @arg00=NULL ; set @arg00=NULL ;
prepare stmt1 from 'insert into t1 values(0, ? )'; prepare stmt1 from 'insert into t1 values(0, ? )';
@ -272,7 +272,7 @@ execute stmt1 using @arg00, @arg01;
select * from t1 order by a; select * from t1 order by a;
set @arg00=81 ; set @arg00=81 ;
set @arg01=1 ; set @arg01=1 ;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
execute stmt1 using @arg00, @arg01; execute stmt1 using @arg00, @arg01;
## insert, autoincrement column and ' SELECT LAST_INSERT_ID() ' ## insert, autoincrement column and ' SELECT LAST_INSERT_ID() '

View File

@ -90,7 +90,7 @@ delete from t3 where t1_id = 1 and t2_id = 1;
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; 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;
begin; begin;
insert into t3 VALUES ( NULL, 1, 1, 2 ); insert into t3 VALUES ( NULL, 1, 1, 2 );
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t3 VALUES ( NULL, 1, 1, 2 ); insert into t3 VALUES ( NULL, 1, 1, 2 );
commit; 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; 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;

View File

@ -81,7 +81,7 @@ explain select count(*) from t1 where v between 'a' and 'a ';
--replace_column 9 # --replace_column 9 #
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add unique(v); alter table t1 add unique(v);
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';
@ -179,17 +179,17 @@ 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 ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
alter table t1 modify a varchar(10); alter table t1 modify a varchar(10);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '),('a '),('a '),('a '); insert into t1 values ('a '),('a '),('a '),('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
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;

View File

@ -285,7 +285,7 @@ ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
show warnings; show warnings;
Level Code Message Level Code Message
Note 1050 Table 't1' already exists Note 1050 Table 't1' already exists
Error 1062 Duplicate entry '3' for key 'PRIMARY' Error 1579 Duplicate entry '3' for key 'PRIMARY'
show status like "Opened_tables"; show status like "Opened_tables";
Variable_name Value Variable_name Value
Opened_tables 2 Opened_tables 2

View File

@ -107,7 +107,7 @@ call foo4();
ERROR 23000: Duplicate entry '20' for key 1 ERROR 23000: Duplicate entry '20' for key 1
show warnings; show warnings;
Level Code Message Level Code Message
Error 1062 Duplicate entry '20' for key 1 Error 1579 Duplicate entry '20' for key 1
select * from t2; select * from t2;
a a
20 20
@ -241,7 +241,7 @@ return 10;
end| end|
do fn1(100); do fn1(100);
Warnings: Warnings:
Error 1062 Duplicate entry '100' for key 1 Error 1579 Duplicate entry '100' for key 1
select fn1(20); select fn1(20);
ERROR 23000: Duplicate entry '20' for key 1 ERROR 23000: Duplicate entry '20' for key 1
select * from t2; select * from t2;

View File

@ -1493,10 +1493,10 @@ insert into t3 (a) values (1)|
create procedure h_ee() create procedure h_ee()
deterministic deterministic
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Outer (bad)' as 'h_ee'; select 'Outer (bad)' as 'h_ee';
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Inner (good)' as 'h_ee'; select 'Inner (good)' as 'h_ee';
insert into t3 values (1); insert into t3 values (1);
end; end;
@ -1504,7 +1504,7 @@ end|
create procedure h_es() create procedure h_es()
deterministic deterministic
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Outer (good)' as 'h_es'; select 'Outer (good)' as 'h_es';
begin begin
-- integrity constraint violation -- integrity constraint violation
@ -1541,7 +1541,7 @@ end|
create procedure h_ex() create procedure h_ex()
deterministic deterministic
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Outer (good)' as 'h_ex'; select 'Outer (good)' as 'h_ex';
begin begin
declare continue handler for sqlexception declare continue handler for sqlexception
@ -1556,7 +1556,7 @@ begin
declare continue handler for sqlstate '23000' declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_se'; select 'Outer (bad)' as 'h_se';
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Inner (good)' as 'h_se'; select 'Inner (good)' as 'h_se';
insert into t3 values (1); insert into t3 values (1);
end; end;
@ -1696,7 +1696,7 @@ begin
declare continue handler for sqlexception declare continue handler for sqlexception
select 'Outer (bad)' as 'h_xe'; select 'Outer (bad)' as 'h_xe';
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Inner (good)' as 'h_xe'; select 'Inner (good)' as 'h_xe';
insert into t3 values (1); insert into t3 values (1);
end; end;
@ -4701,10 +4701,10 @@ insert into t3 values (1)|
create procedure bug15011() create procedure bug15011()
deterministic deterministic
begin begin
declare continue handler for 1062 declare continue handler for 1579
select 'Outer' as 'Handler'; select 'Outer' as 'Handler';
begin begin
declare continue handler for 1062 declare continue handler for 1579
select 'Inner' as 'Handler'; select 'Inner' as 'Handler';
insert into t3 values (1); insert into t3 values (1);
end; end;

View File

@ -2684,10 +2684,12 @@ FROM t1 HAVING Age < 75;
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75)
set timestamp=1136066400;
SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
Age Age
42 42
38 38
set timestamp=1136066400;
SELECT * FROM v1; SELECT * FROM v1;
Age Age
42 42

View File

@ -101,10 +101,10 @@ insert into t1 set i = 254;
insert into t1 set i = null; insert into t1 set i = null;
select last_insert_id(); select last_insert_id();
explain extended select last_insert_id(); explain extended select last_insert_id();
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 set i = 254; insert into t1 set i = 254;
select last_insert_id(); select last_insert_id();
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 set i = null; insert into t1 set i = null;
select last_insert_id(); select last_insert_id();
drop table t1; drop table t1;
@ -122,7 +122,7 @@ insert into t1 values (NULL, 10);
select last_insert_id(); select last_insert_id();
insert into t1 values (NULL, 15); insert into t1 values (NULL, 15);
select last_insert_id(); select last_insert_id();
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (NULL, 10); insert into t1 values (NULL, 10);
select last_insert_id(); select last_insert_id();
@ -277,7 +277,7 @@ create table t1 (rowid int not null auto_increment, val int not null,primary
key (rowid), unique(val)); key (rowid), unique(val));
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');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (val) values ('1'),('2'); insert into t1 (val) values ('1'),('2');
select * from t1; select * from t1;
drop table t1; drop table t1;
@ -300,7 +300,7 @@ drop table t1;
CREATE TABLE t1 (t1 INT(10) PRIMARY KEY, t2 INT(10)); CREATE TABLE t1 (t1 INT(10) PRIMARY KEY, t2 INT(10));
INSERT INTO t1 VALUES(0, 0); INSERT INTO t1 VALUES(0, 0);
INSERT INTO t1 VALUES(1, 1); INSERT INTO t1 VALUES(1, 1);
--error ER_DUP_ENTRY --error ER_DUP_ENTRY_WITH_KEY_NAME
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment; ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
DROP TABLE t1; DROP TABLE t1;

View File

@ -153,7 +153,7 @@ drop table if exists t1,t2;
CREATE TABLE t1 (a int not null); CREATE TABLE t1 (a int not null);
INSERT INTO t1 values (1),(2),(1); INSERT INTO t1 values (1),(2),(1);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1; CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
--error 1146 --error 1146
SELECT * from t2; SELECT * from t2;
@ -232,7 +232,7 @@ insert into t1 values (1,1);
create table if not exists t1 select 2; create table if not exists t1 select 2;
select * from t1; select * from t1;
create table if not exists t1 select 3 as 'a',4 as 'b'; create table if not exists t1 select 3 as 'a',4 as 'b';
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
create table if not exists t1 select 3 as 'a',3 as 'b'; create table if not exists t1 select 3 as 'a',3 as 'b';
show warnings; show warnings;
show status like "Opened_tables"; show status like "Opened_tables";
@ -684,30 +684,30 @@ drop table t1;
CREATE TABLE t1 (a int, b int); CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2); insert into t1 values (1,1),(1,2);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t2 (primary key (a)) select * from t1; CREATE TABLE t2 (primary key (a)) select * from t1;
# This should give warning # This should give warning
drop table if exists t2; drop table if exists t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1; CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
# This should give warning # This should give warning
drop table if exists t2; drop table if exists t2;
CREATE TABLE t2 (a int, b int, primary key (a)); CREATE TABLE t2 (a int, b int, primary key (a));
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2; SELECT * from t2;
TRUNCATE table t2; TRUNCATE table t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t2 select * from t1; INSERT INTO t2 select * from t1;
SELECT * from t2; SELECT * from t2;
drop table t2; drop table t2;
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)); CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1; CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
SELECT * from t2; SELECT * from t2;
TRUNCATE table t2; TRUNCATE table t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t2 select * from t1; INSERT INTO t2 select * from t1;
SELECT * from t2; SELECT * from t2;
drop table t1,t2; drop table t1,t2;

View File

@ -14,19 +14,19 @@ drop table if exists t1, t2;
--enable_warnings --enable_warnings
CREATE TABLE t1 ( a int ); CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1); INSERT INTO t1 VALUES (1),(2),(1);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146 --error 1146
select * from t2; select * from t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146 --error 1146
select * from t2; select * from t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146 --error 1146
select * from t2; select * from t2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146 --error 1146
select * from t2; select * from t2;

View File

@ -210,9 +210,9 @@ drop table t2;
create table t1 (c varchar(30) character set utf8, unique(c(10))); create table t1 (c varchar(30) character set utf8, unique(c(10)));
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa'); insert into t1 values ('aaaaaaaaaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaaa');
insert into t1 values (repeat('b',20)); insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1'; select c c1 from t1 where c='1';
@ -234,9 +234,9 @@ create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
--enable_warnings --enable_warnings
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa'); insert into t1 values ('aaaaaaaaaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaaa');
insert into t1 values (repeat('b',20)); insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1'; select c c1 from t1 where c='1';
@ -256,23 +256,23 @@ create table t1 (c char(3) character set utf8, unique (c(2)));
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a'); insert into t1 values ('a');
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('b'); insert into t1 values ('b');
insert into t1 values ('bb'); insert into t1 values ('bb');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('bbb'); insert into t1 values ('bbb');
insert into t1 values ('а'); insert into t1 values ('а');
insert into t1 values ('аа'); insert into t1 values ('аа');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ааа'); insert into t1 values ('ааа');
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
insert into t1 values ('ꪪ'); insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ꪪꪪꪪ'); insert into t1 values ('ꪪꪪꪪ');
drop table t1; drop table t1;
# #
@ -285,23 +285,23 @@ create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a'); insert into t1 values ('a');
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('b'); insert into t1 values ('b');
insert into t1 values ('bb'); insert into t1 values ('bb');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('bbb'); insert into t1 values ('bbb');
insert into t1 values ('а'); insert into t1 values ('а');
insert into t1 values ('аа'); insert into t1 values ('аа');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ааа'); insert into t1 values ('ааа');
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
insert into t1 values ('ꪪ'); insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ꪪꪪꪪ'); insert into t1 values ('ꪪꪪꪪ');
drop table t1; drop table t1;
# #
@ -314,14 +314,14 @@ unique key a using hash (c(1))
) engine=heap; ) engine=heap;
show create table t1; show create table t1;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('б'); insert into t1 values ('б');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
select c as c_a from t1 where c='a'; select c as c_a from t1 where c='a';
@ -338,14 +338,14 @@ unique key a using btree (c(1))
) engine=heap; ) engine=heap;
show create table t1; show create table t1;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('б'); insert into t1 values ('б');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
select c as c_a from t1 where c='a'; select c as c_a from t1 where c='a';
@ -363,14 +363,14 @@ unique key a (c(1))
) engine=innodb; ) engine=innodb;
--enable_warnings --enable_warnings
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('б'); insert into t1 values ('б');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
select c as c_a from t1 where c='a'; select c as c_a from t1 where c='a';
@ -384,9 +384,9 @@ drop table t1;
create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10))); create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)));
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa'); insert into t1 values ('aaaaaaaaaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaaaaaaaaaaa'); insert into t1 values ('aaaaaaaaaaaa');
insert into t1 values (repeat('b',20)); insert into t1 values (repeat('b',20));
select c c1 from t1 where c='1'; select c c1 from t1 where c='1';
@ -407,23 +407,23 @@ create table t1 (c char(3) character set utf8 collate utf8_bin, unique (c(2)));
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a'); insert into t1 values ('a');
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('b'); insert into t1 values ('b');
insert into t1 values ('bb'); insert into t1 values ('bb');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('bbb'); insert into t1 values ('bbb');
insert into t1 values ('а'); insert into t1 values ('а');
insert into t1 values ('аа'); insert into t1 values ('аа');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ааа'); insert into t1 values ('ааа');
insert into t1 values ('б'); insert into t1 values ('б');
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
insert into t1 values ('ꪪ'); insert into t1 values ('ꪪ');
insert into t1 values ('ꪪꪪ'); insert into t1 values ('ꪪꪪ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ꪪꪪꪪ'); insert into t1 values ('ꪪꪪꪪ');
drop table t1; drop table t1;
@ -437,14 +437,14 @@ unique key a using hash (c(1))
) engine=heap; ) engine=heap;
show create table t1; show create table t1;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('б'); insert into t1 values ('б');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
select c as c_a from t1 where c='a'; select c as c_a from t1 where c='a';
@ -461,14 +461,14 @@ unique key a using btree (c(1))
) engine=heap; ) engine=heap;
show create table t1; show create table t1;
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('б'); insert into t1 values ('б');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
select c as c_a from t1 where c='a'; select c as c_a from t1 where c='a';
@ -486,14 +486,14 @@ unique key a (c(1))
) engine=innodb; ) engine=innodb;
--enable_warnings --enable_warnings
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aa'); insert into t1 values ('aa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('aaa'); insert into t1 values ('aaa');
insert into t1 values ('б'); insert into t1 values ('б');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('бб'); insert into t1 values ('бб');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('ббб'); insert into t1 values ('ббб');
select c as c_all from t1 order by c; select c as c_all from t1 order by c;
select c as c_a from t1 where c='a'; select c as c_a from t1 where c='a';

View File

@ -185,7 +185,7 @@ INSERT INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83); INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
# Create a duplicate value. # Create a duplicate value.
SET insert_id= 114; SET insert_id= 114;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES(NULL, 91); INSERT INTO t1 VALUES(NULL, 91);
INSERT INTO t1 VALUES (NULL, 92), (NULL, 93); INSERT INTO t1 VALUES (NULL, 92), (NULL, 93);
# Check what we have now # Check what we have now

View File

@ -128,7 +128,7 @@ SELECT * FROM t1 WHERE b=NULL;
explain SELECT * FROM t1 WHERE b IS NULL; explain SELECT * FROM t1 WHERE b IS NULL;
SELECT * FROM t1 WHERE b<=>NULL; SELECT * FROM t1 WHERE b<=>NULL;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES (1,3); INSERT INTO t1 VALUES (1,3);
DROP TABLE t1; DROP TABLE t1;
@ -270,7 +270,7 @@ explain select count(*) from t1 where v like 'a%';
explain select count(*) from t1 where v between 'a' and 'a '; explain select count(*) from t1 where v between 'a' and 'a ';
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add unique(v); alter table t1 add unique(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*')); select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
explain select * from t1 where v='a'; explain select * from t1 where v='a';
@ -296,17 +296,17 @@ 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');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
alter table t1 modify a varchar(10); alter table t1 modify a varchar(10);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '),('a '),('a '),('a '); insert into t1 values ('a '),('a '),('a '),('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
update t1 set a='a ' where a like 'a '; update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a '; update t1 set a='a ' where a like 'a ';
@ -357,7 +357,7 @@ explain select count(*) from t1 where v between 'a' and 'a ';
--replace_column 9 # --replace_column 9 #
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add unique(v); alter table t1 add unique(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*')); select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*'));
# Number of rows is not constant for b-trees keys # Number of rows is not constant for b-trees keys
@ -372,17 +372,17 @@ drop table t1;
create table t1 (a char(10), unique using btree (a)) engine=heap; create table t1 (a char(10), unique using btree (a)) engine=heap;
insert into t1 values ('a'); insert into t1 values ('a');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
alter table t1 modify a varchar(10); alter table t1 modify a varchar(10);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '),('a '),('a '),('a '); insert into t1 values ('a '),('a '),('a '),('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('a '); insert into t1 values ('a ');
update t1 set a='a ' where a like 'a '; update t1 set a='a ' where a like 'a ';
update t1 set a='a ' where a like 'a '; update t1 set a='a ' where a like 'a ';
@ -432,7 +432,7 @@ create table t1 (a int not null, b int not null auto_increment,
# #
create table t1 (c char(255), primary key(c(90))); create table t1 (c char(255), primary key(c(90)));
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
drop table t1; drop table t1;

View File

@ -143,7 +143,7 @@ SELECT * FROM t1 WHERE b=NULL;
explain SELECT * FROM t1 WHERE b IS NULL; explain SELECT * FROM t1 WHERE b IS NULL;
SELECT * FROM t1 WHERE b<=>NULL; SELECT * FROM t1 WHERE b<=>NULL;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES (1,3); INSERT INTO t1 VALUES (1,3);
DROP TABLE t1; DROP TABLE t1;

View File

@ -128,7 +128,7 @@ SELECT * FROM t1 WHERE b=NULL;
explain SELECT * FROM t1 WHERE b IS NULL; explain SELECT * FROM t1 WHERE b IS NULL;
SELECT * FROM t1 WHERE b<=>NULL; SELECT * FROM t1 WHERE b<=>NULL;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES (1,3); INSERT INTO t1 VALUES (1,3);
DROP TABLE t1; DROP TABLE t1;

View File

@ -52,7 +52,7 @@ INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),
update t1 set parent_id=parent_id+100; update t1 set parent_id=parent_id+100;
select * from t1 where parent_id=102; select * from t1 where parent_id=102;
update t1 set id=id+1000; update t1 set id=id+1000;
-- error 1062,1022 -- error ER_DUP_ENTRY_WITH_KEY_NAME,1022
update t1 set id=1024 where id=1009; update t1 set id=1024 where id=1009;
select * from t1; select * from t1;
update ignore t1 set id=id+1; # This will change all rows update ignore t1 set id=id+1; # This will change all rows
@ -133,13 +133,13 @@ commit;
select n, "after commit" from t1; select n, "after commit" from t1;
commit; commit;
insert into t1 values (5); insert into t1 values (5);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (4); insert into t1 values (4);
commit; commit;
select n, "after commit" from t1; select n, "after commit" from t1;
set autocommit=1; set autocommit=1;
insert into t1 values (6); insert into t1 values (6);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (4); insert into t1 values (4);
select n from t1; select n from t1;
set autocommit=0; set autocommit=0;
@ -213,7 +213,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);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values ('pippo', 12); # Gives error insert into t1 values ('pippo', 12); # Gives error
delete from t1; delete from t1;
delete from t1 where id = 'pippo'; delete from t1 where id = 'pippo';
@ -341,9 +341,9 @@ CREATE TABLE t1 (
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');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (ggid,passwd) values ('test2','this will fail'); insert into t1 (ggid,passwd) values ('test2','this will fail');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (ggid,id) values ('this will fail',1); insert into t1 (ggid,id) values ('this will fail',1);
select * from t1 where ggid='test1'; select * from t1 where ggid='test1';
@ -352,7 +352,7 @@ select * from t1 where id=2;
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');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
update t1 set id=100,ggid='test2' where id=1; update t1 set id=100,ggid='test2' where id=1;
select * from t1; select * from t1;
select * from t1 where id=1; select * from t1 where id=1;
@ -523,7 +523,7 @@ drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
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;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
select id from t1; select id from t1;
@ -534,7 +534,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;
begin; begin;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (99,1,2,'D'),(1,1,2,'D'); insert into t1 values (99,1,2,'D'),(1,1,2,'D');
select id from t1; select id from t1;
insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
@ -1407,7 +1407,7 @@ create table t1 (rowid int not null auto_increment, val int not null,primary
key (rowid), unique(val)) engine=innodb; 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');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (val) values ('1'),('2'); insert into t1 (val) values ('1'),('2');
select * from t1; select * from t1;
drop table t1; drop table t1;
@ -1420,7 +1420,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;
# We should get the following error because InnoDB does not update the counter # We should get the following error because InnoDB does not update the counter
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (val) values (1); insert into t1 (val) values (1);
select * from t1; select * from t1;
drop table t1; drop table t1;
@ -1876,13 +1876,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);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t2 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120); insert into t2 values (0x41),(0x4120);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t3 values (0x41),(0x4120),(0x4100); insert into t3 values (0x41),(0x4120),(0x4100);
insert into t3 values (0x41),(0x4100); insert into t3 values (0x41),(0x4100);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t4 values (0x41),(0x4120),(0x4100); insert into t4 values (0x41),(0x4120),(0x4100);
insert into t4 values (0x41),(0x4100); insert into t4 values (0x41),(0x4100);
select hex(s1) from t1; select hex(s1) from t1;

View File

@ -10,7 +10,7 @@ create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLI
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12); insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY); create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1; insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t2 (payoutID) SELECT payoutID+10 FROM t1; insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1; insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
select * from t2; select * from t2;
@ -101,7 +101,7 @@ create table t1 (a int not null primary key, b char(10));
create table t2 (a int not null, b char(10)); create table t2 (a int not null, b char(10));
insert into t1 values (1,"t1:1"),(3,"t1:3"); insert into t1 values (1,"t1:1"),(3,"t1:3");
insert into t2 values (2,"t2:2"), (3,"t2:3"); insert into t2 values (2,"t2:2"), (3,"t2:3");
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 select * from t2; insert into t1 select * from t2;
select * from t1; select * from t1;
# REPLACE .. SELECT is not yet supported by PS # REPLACE .. SELECT is not yet supported by PS

View File

@ -12,7 +12,7 @@ INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE c=c+1000;
SELECT * FROM t1; SELECT * FROM t1;
INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000; INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000;
SELECT * FROM t1; SELECT * FROM t1;
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4; INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
SELECT * FROM t1; SELECT * FROM t1;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
@ -63,7 +63,7 @@ INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
SELECT * FROM t1; SELECT * FROM t1;
INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000; INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
SELECT * FROM t1; SELECT * FROM t1;
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4; INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
SELECT * FROM t1; SELECT * FROM t1;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;

View File

@ -97,7 +97,7 @@ WHERE t1.uniq_id = 4
ORDER BY t2.c_amount; ORDER BY t2.c_amount;
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes'); INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes'); INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes'); INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');

View File

@ -150,7 +150,7 @@ create table t1
); );
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a'); INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
INSERT INTO t1 VALUES (1, 1, 1, 1, 'b'); INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES (1, 1, 1, 1, 'a'); INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
drop table t1; drop table t1;
@ -243,13 +243,13 @@ show create table t1;
insert t1 values ('cccc', 'tttt'), insert t1 values ('cccc', 'tttt'),
(0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1), (0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
(0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1); (0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert t1 (c) values ('cc22'); insert t1 (c) values ('cc22');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert t1 (t) values ('ttt22'); insert t1 (t) values ('ttt22');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1); insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1); insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
select c from t1 where c='cccc'; select c from t1 where c='cccc';
select t from t1 where t='tttt'; select t from t1 where t='tttt';
@ -438,7 +438,7 @@ insert into t1 values(1, 'b', 'b', NULL);
# Drop some indexes for new adds. # Drop some indexes for new adds.
alter table t1 drop index i3, drop index i2, drop index i1; alter table t1 drop index i3, drop index i2, drop index i1;
# Add indexes, one is unique on non-unique values. # Add indexes, one is unique on non-unique values.
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1); alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
drop table t1; drop table t1;

View File

@ -195,9 +195,9 @@ select * from t6 order by a,b;
insert into t1 values (99,NULL); insert into t1 values (99,NULL);
select * from t4 where a+0 > 90; select * from t4 where a+0 > 90;
# bug#4008 - cannot determine a unique key that caused "dupl. key error" # bug#4008 - cannot determine a unique key that caused "dupl. key error"
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert t5 values (1,1); insert t5 values (1,1);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert t6 values (2,1); insert t6 values (2,1);
insert t5 values (1,1) on duplicate key update b=b+10; insert t5 values (1,1) on duplicate key update b=b+10;
insert t6 values (2,1) on duplicate key update b=b+20; insert t6 values (2,1) on duplicate key update b=b+20;

View File

@ -453,9 +453,9 @@ create table t1 (a int not null auto_increment primary key, b text not null, uni
insert into t1 (b) values ('a'),('b'),('c'); insert into t1 (b) values ('a'),('b'),('c');
select concat(b,'.') from t1; select concat(b,'.') from t1;
update t1 set b='b ' where a=2; update t1 set b='b ' where a=2;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
update t1 set b='b ' where a > 1; update t1 set b='b ' where a > 1;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (b) values ('b'); insert into t1 (b) values ('b');
select * from t1; select * from t1;
delete from t1 where b='b'; delete from t1 where b='b';

View File

@ -38,9 +38,9 @@ create table t1 (
# ok # ok
insert into t1 values('aAa'); insert into t1 values('aAa');
# fail # fail
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values('aaa'); insert into t1 values('aaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values('AAA'); insert into t1 values('AAA');
# 1 # 1
select * from t1 order by a; select * from t1 order by a;
@ -61,9 +61,9 @@ create table t1 (
) engine=ndb; ) engine=ndb;
# #
insert into t1 values ('A'),('b '),('C '),('d '),('E'),('f'); insert into t1 values ('A'),('b '),('C '),('d '),('E'),('f');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values('b'); insert into t1 values('b');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values('a '); insert into t1 values('a ');
# #
select a,length(a) from t1 order by a; select a,length(a) from t1 order by a;
@ -106,9 +106,9 @@ create table t1 (
# ok # ok
insert into t1 values(1, 'aAa'); insert into t1 values(1, 'aAa');
# fail # fail
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(2, 'aaa'); insert into t1 values(2, 'aaa');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(3, 'AAA'); insert into t1 values(3, 'AAA');
# 1 # 1
select * from t1 order by p; select * from t1 order by p;
@ -131,9 +131,9 @@ create table t1 (
) engine=ndb; ) engine=ndb;
# #
insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f'); insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(99,'b'); insert into t1 values(99,'b');
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(99,'a '); insert into t1 values(99,'a ');
# #
select a,length(a) from t1 order by a; select a,length(a) from t1 order by a;
@ -231,7 +231,7 @@ drop table t1;
# ('a','A '),('B ','b'),('c','C '),('D','d'),('e ','E'),('F','f '), # ('a','A '),('B ','b'),('c','C '),('D','d'),('e ','E'),('F','f '),
# ('A','b '),('b ','C'),('C','d '),('d','E'),('E ','f'), # ('A','b '),('b ','C'),('C','d '),('d','E'),('E ','f'),
# ('a','C '),('B ','d'),('c','E '),('D','f'); # ('a','C '),('B ','d'),('c','E '),('D','f');
#-- error 1062 #-- error ER_DUP_ENTRY_WITH_KEY_NAME
#insert into t1 values('d','f'); #insert into t1 values('d','f');
# #
#select a,b,length(a),length(b) from t1 order by a,b limit 3; #select a,b,length(a),length(b) from t1 order by a,b limit 3;

View File

@ -22,7 +22,7 @@ select * from t1 where b = 4 order by b;
insert into t1 values(7,8,3); insert into t1 values(7,8,3);
select * from t1 where b = 4 order by a; select * from t1 where b = 4 order by a;
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(8, 2, 3); insert into t1 values(8, 2, 3);
select * from t1 order by a; select * from t1 order by a;
delete from t1 where a = 1; delete from t1 where a = 1;
@ -59,7 +59,7 @@ select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
select * from t1 use index (bc) where b IS NULL and c = 2 order by a; select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
select * from t1 use index (bc) where b < 4 order by a; select * from t1 use index (bc) where b < 4 order by a;
select * from t1 use index (bc) where b IS NOT NULL order by a; select * from t1 use index (bc) where b IS NOT NULL order by a;
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values(5,1,1); insert into t1 values(5,1,1);
drop table t1; drop table t1;
@ -82,7 +82,7 @@ select * from t2 where c = 6;
insert into t2 values(7,8,3); insert into t2 values(7,8,3);
select * from t2 where b = 4 order by a; select * from t2 where b = 4 order by a;
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t2 values(8, 2, 3); insert into t2 values(8, 2, 3);
select * from t2 order by a; select * from t2 order by a;
delete from t2 where a = 1; delete from t2 where a = 1;
@ -133,7 +133,7 @@ insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
select * from t1 order by pk; select * from t1 order by pk;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (5,0); insert into t1 values (5,0);
select * from t1 order by pk; select * from t1 order by pk;
delete from t1 where a = 0; delete from t1 where a = 0;
@ -152,7 +152,7 @@ insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
select * from t2 order by pk; select * from t2 order by pk;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t2 values(2,3,19,'abc'); insert into t2 values(2,3,19,'abc');
select * from t2 order by pk; select * from t2 order by pk;
delete from t2 where c IS NOT NULL; delete from t2 where c IS NOT NULL;
@ -321,7 +321,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
engine=ndb charset=utf8; engine=ndb charset=utf8;
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200)); insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200)); insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
select a, sha1(b) from t1; select a, sha1(b) from t1;

View File

@ -433,7 +433,7 @@ SELECT COUNT(*) FROM t1;
# #
# Insert duplicate rows # Insert duplicate rows
# #
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t1 VALUES (1,1,1); INSERT INTO t1 VALUES (1,1,1);
--error 1022 --error 1022

View File

@ -21,7 +21,7 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
insert into t1 (gesuchnr, benutzer_id) value (3,2); insert into t1 (gesuchnr, benutzer_id) value (3,2);
replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (gesuchnr,benutzer_id) values (1,1); insert into t1 (gesuchnr,benutzer_id) values (1,1);
replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1);
select * from t1 order by gesuchnr; select * from t1 order by gesuchnr;

View File

@ -23,7 +23,7 @@ UPDATE t1 set b = c;
select * from t1 order by pk1; select * from t1 order by pk1;
UPDATE t1 set pk1 = 4 where pk1 = 1; UPDATE t1 set pk1 = 4 where pk1 = 1;
select * from t1 order by pk1; select * from t1 order by pk1;
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4; UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4;
select * from t1 order by pk1; select * from t1 order by pk1;
UPDATE t1 set pk1 = pk1 + 10; UPDATE t1 set pk1 = pk1 + 10;

View File

@ -25,9 +25,9 @@ drop table t1;
create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value"); create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
insert into t1 values (126,"first"),(63, "middle"),(0,"last"); insert into t1 values (126,"first"),(63, "middle"),(0,"last");
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (0,"error"); insert into t1 values (0,"error");
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
replace into t1 values (0,"error"); replace into t1 values (0,"error");
replace into t1 values (126,"first updated"); replace into t1 values (126,"first updated");
replace into t1 values (63,default); replace into t1 values (63,default);

View File

@ -11,7 +11,7 @@ connection master;
create table t1 (a int primary key); create table t1 (a int primary key);
create table t4 (a int primary key); create table t4 (a int primary key);
# generate an error that goes to the binlog # generate an error that goes to the binlog
--error 1022, 1062 --error 1022, ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (1),(1); insert into t1 values (1),(1);
insert into t4 values (1),(2); insert into t4 values (1),(2);
save_master_pos; save_master_pos;

View File

@ -63,7 +63,7 @@ SELECT * FROM t6 ORDER BY a,b,c;
connection master; connection master;
# Test for erroneous constructions # Test for erroneous constructions
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
# Shouldn't be written to the binary log # Shouldn't be written to the binary log
--replace_regex /table_id: [0-9]+/table_id: #/ --replace_regex /table_id: [0-9]+/table_id: #/
@ -71,7 +71,7 @@ SHOW BINLOG EVENTS FROM 1256;
# Test that INSERT-SELECT works the same way as for SBR. # Test that INSERT-SELECT works the same way as for SBR.
CREATE TABLE t7 (a INT, b INT UNIQUE); CREATE TABLE t7 (a INT, b INT UNIQUE);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
INSERT INTO t7 SELECT a,b FROM tt3; INSERT INTO t7 SELECT a,b FROM tt3;
SELECT * FROM t7 ORDER BY a,b; SELECT * FROM t7 ORDER BY a,b;
# Should be written to the binary log # Should be written to the binary log

View File

@ -1 +1 @@
--slave-skip-error=1053,1062 --slave-skip-error=1053,1579

View File

@ -152,7 +152,7 @@ create procedure foo4()
delimiter ;| delimiter ;|
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
call foo4(); call foo4();
show warnings; show warnings;
@ -307,7 +307,7 @@ delimiter ;|
do fn1(100); do fn1(100);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
select fn1(20); select fn1(20);
select * from t2; select * from t2;

View File

@ -30,7 +30,7 @@ check table t1 changed;
check table t1 medium; check table t1 medium;
check table t1 extended; check table t1 extended;
show index from t1; show index from t1;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (5,5,5); insert into t1 values (5,5,5);
optimize table t1; optimize table t1;
optimize table t1; optimize table t1;

View File

@ -586,7 +586,7 @@ begin
end| end|
set @x = 0| set @x = 0|
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
call bug3279(@x)| call bug3279(@x)|
select @x| select @x|
drop procedure bug3279| drop procedure bug3279|

View File

@ -1763,11 +1763,11 @@ insert into t3 (a) values (1)|
create procedure h_ee() create procedure h_ee()
deterministic deterministic
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Outer (bad)' as 'h_ee'; select 'Outer (bad)' as 'h_ee';
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Inner (good)' as 'h_ee'; select 'Inner (good)' as 'h_ee';
insert into t3 values (1); insert into t3 values (1);
@ -1777,7 +1777,7 @@ end|
create procedure h_es() create procedure h_es()
deterministic deterministic
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Outer (good)' as 'h_es'; select 'Outer (good)' as 'h_es';
begin begin
@ -1823,7 +1823,7 @@ end|
create procedure h_ex() create procedure h_ex()
deterministic deterministic
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Outer (good)' as 'h_ex'; select 'Outer (good)' as 'h_ex';
begin begin
@ -1842,7 +1842,7 @@ begin
select 'Outer (bad)' as 'h_se'; select 'Outer (bad)' as 'h_se';
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Inner (good)' as 'h_se'; select 'Inner (good)' as 'h_se';
insert into t3 values (1); insert into t3 values (1);
@ -2015,7 +2015,7 @@ begin
select 'Outer (bad)' as 'h_xe'; select 'Outer (bad)' as 'h_xe';
begin begin
declare continue handler for 1062 -- ER_DUP_ENTRY declare continue handler for 1579 -- ER_DUP_ENTRY_WITH_KEY_NAME
select 'Inner (good)' as 'h_xe'; select 'Inner (good)' as 'h_xe';
insert into t3 values (1); insert into t3 values (1);
@ -4507,7 +4507,7 @@ begin
select bug12379(); select bug12379();
end| end|
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
select bug12379()| select bug12379()|
select 1| select 1|
# statement-based binlogging will show warning which row-based won't; # statement-based binlogging will show warning which row-based won't;
@ -4518,7 +4518,7 @@ select 2|
call bug12379_2()| call bug12379_2()|
--enable_warnings --enable_warnings
select 3| select 3|
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
call bug12379_3()| call bug12379_3()|
select 4| select 4|
@ -4600,7 +4600,7 @@ end|
call bug6127()| call bug6127()|
select * from t3| select * from t3|
--error ER_DUP_ENTRY --error ER_DUP_ENTRY_WITH_KEY_NAME
call bug6127()| call bug6127()|
select * from t3| select * from t3|
set sql_mode=@sm| set sql_mode=@sm|
@ -5528,11 +5528,11 @@ insert into t3 values (1)|
create procedure bug15011() create procedure bug15011()
deterministic deterministic
begin begin
declare continue handler for 1062 declare continue handler for 1579
select 'Outer' as 'Handler'; select 'Outer' as 'Handler';
begin begin
declare continue handler for 1062 declare continue handler for 1579
select 'Inner' as 'Handler'; select 'Inner' as 'Handler';
insert into t3 values (1); insert into t3 values (1);

View File

@ -89,7 +89,7 @@ create function bug10015_5(i int) returns int
end if; end if;
return i; return i;
end| end|
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (bug10015_5(4)), (bug10015_5(5))| insert into t1 values (bug10015_5(4)), (bug10015_5(5))|
select * from t1| select * from t1|
drop function bug10015_5| drop function bug10015_5|

View File

@ -73,7 +73,7 @@ drop table t1,t2;
# #
create temporary table t1 (a int not null); create temporary table t1 (a int not null);
insert into t1 values (1),(1); insert into t1 values (1),(1);
-- error 1062 -- error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add primary key (a); alter table t1 add primary key (a);
drop table t1; drop table t1;

View File

@ -31,7 +31,7 @@ drop table t1;
create table t1 (s1 binary(2) primary key); create table t1 (s1 binary(2) primary key);
insert into t1 values (0x01); insert into t1 values (0x01);
insert into t1 values (0x0120); insert into t1 values (0x0120);
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 values (0x0100); insert into t1 values (0x0100);
select hex(s1) from t1 order by s1; select hex(s1) from t1 order by s1;
# check index search # check index search

View File

@ -39,7 +39,7 @@ drop table t1;
create table t1 (a bit); create table t1 (a bit);
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001'); insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
select hex(a) from t1; select hex(a) from t1;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add unique (a); alter table t1 add unique (a);
drop table t1; drop table t1;

View File

@ -40,7 +40,7 @@ drop table t1;
create table t1 (a bit) engine=innodb; create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001'); insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
select hex(a) from t1; select hex(a) from t1;
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add unique (a); alter table t1 add unique (a);
drop table t1; drop table t1;

View File

@ -334,9 +334,9 @@ drop table t1;
# #
create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20))); create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (txt) values ('Chevy'), ('Chevy '); insert into t1 (txt) values ('Chevy'), ('Chevy ');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
insert into t1 (txt) values ('Chevy'), ('CHEVY'); insert into t1 (txt) values ('Chevy'), ('CHEVY');
alter table t1 drop index txt_index, add index txt_index (txt(20)); alter table t1 drop index txt_index, add index txt_index (txt(20));
insert into t1 (txt) values ('Chevy '); insert into t1 (txt) values ('Chevy ');

View File

@ -25,7 +25,7 @@ select v='a' from t1;
select binary v='a' from t1; select binary v='a' from t1;
select binary v='a ' from t1; select binary v='a ' from t1;
insert into t1 values('a'); insert into t1 values('a');
--error 1062 --error ER_DUP_ENTRY_WITH_KEY_NAME
alter table t1 add primary key (v); alter table t1 add primary key (v);
drop table t1; drop table t1;
create table t1 (v varbinary(20)); create table t1 (v varbinary(20));

View File

@ -2553,7 +2553,9 @@ CREATE VIEW v1 AS
FROM t1 HAVING Age < 75; FROM t1 HAVING Age < 75;
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
set timestamp=1136066400;
SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
set timestamp=1136066400;
SELECT * FROM v1; SELECT * FROM v1;
DROP VIEW v1; DROP VIEW v1;

3
sql-bench/example Normal file
View File

@ -0,0 +1,3 @@
#/bin/sh
run-all-tests --prefix=-innodb --hw="AMD Athlon 4000+; 2400 MHz 1M cache, 3G memory" --optimization="gcc 4.0.2 -O3" --comments="Engine=InnoDB" --create-options="ENGINE=InnoDB"

View File

@ -2029,7 +2029,7 @@ void handler::print_keydup_error(uint key_nr, const char *msg)
{ {
/* Key is unknown */ /* Key is unknown */
str.copy("", 0, system_charset_info); str.copy("", 0, system_charset_info);
my_printf_error(ER_DUP_ENTRY, msg, my_printf_error(ER_DUP_ENTRY_WITH_KEY_NAME, msg,
MYF(0), str.c_ptr(), "*UNKNOWN*"); MYF(0), str.c_ptr(), "*UNKNOWN*");
} }
else else
@ -2042,7 +2042,7 @@ void handler::print_keydup_error(uint key_nr, const char *msg)
str.length(max_length-4); str.length(max_length-4);
str.append(STRING_WITH_LEN("...")); str.append(STRING_WITH_LEN("..."));
} }
my_printf_error(ER_DUP_ENTRY, msg, my_printf_error(ER_DUP_ENTRY_WITH_KEY_NAME, msg,
MYF(0), str.c_ptr(), table->key_info[key_nr].name); MYF(0), str.c_ptr(), table->key_info[key_nr].name);
} }
} }
@ -2087,7 +2087,7 @@ void handler::print_error(int error, myf errflag)
uint key_nr=get_dup_key(error); uint key_nr=get_dup_key(error);
if ((int) key_nr >= 0) if ((int) key_nr >= 0)
{ {
print_keydup_error(key_nr, ER(ER_DUP_ENTRY)); print_keydup_error(key_nr, ER(ER_DUP_ENTRY_WITH_KEY_NAME));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
textno=ER_DUP_KEY; textno=ER_DUP_KEY;

View File

@ -1479,30 +1479,30 @@ ER_DUP_KEYNAME 42000 S1009
swe "Nyckelnamn '%-.64s' finns flera gånger" swe "Nyckelnamn '%-.64s' finns flera gånger"
ukr "äÕÂÌÀÀÞÅ ¦Í'Ñ ËÌÀÞÁ '%-.64s'" ukr "äÕÂÌÀÀÞÅ ¦Í'Ñ ËÌÀÞÁ '%-.64s'"
ER_DUP_ENTRY 23000 S1009 ER_DUP_ENTRY 23000 S1009
cze "Zvojen-Bý klíè '%-.64s' (èíslo klíèe '%-.64s')" cze "Zvojen-Bý klíè '%-.64s' (èíslo klíèe %d)"
dan "Ens værdier '%-.64s' for indeks '%-.64s'" dan "Ens værdier '%-.64s' for indeks %d"
nla "Dubbele ingang '%-.64s' voor zoeksleutel '%-.64s'" nla "Dubbele ingang '%-.64s' voor zoeksleutel %d"
eng "Duplicate entry '%-.64s' for key '%-.64s'" eng "Duplicate entry '%-.64s' for key %d"
jps "'%-.64s' ‚Í key '%-.64s' ɨ¢Ä<E2809A>d•¡µÄ¢Ü·", jps "'%-.64s' ‚Í key %d ɨ¢Ä<E2809A>d•¡µÄ¢Ü·",
est "Kattuv väärtus '%-.64s' võtmele '%-.64s'" est "Kattuv väärtus '%-.64s' võtmele %d"
fre "Duplicata du champ '%-.64s' pour la clef '%-.64s'" fre "Duplicata du champ '%-.64s' pour la clef %d"
ger "Doppelter Eintrag '%-.64s' für Schlüssel '%-.64s'" ger "Doppelter Eintrag '%-.64s' für Schlüssel %d"
greek "ÄéðëÞ åããñáöÞ '%-.64s' ãéá ôï êëåéäß '%-.64s'" greek "ÄéðëÞ åããñáöÞ '%-.64s' ãéá ôï êëåéäß %d"
hun "Duplikalt bejegyzes '%-.64s' a '%-.64s' kulcs szerint." hun "Duplikalt bejegyzes '%-.64s' a %d kulcs szerint."
ita "Valore duplicato '%-.64s' per la chiave '%-.64s'" ita "Valore duplicato '%-.64s' per la chiave %d"
jpn "'%-.64s' ¤Ï key '%-.64s' ¤Ë¤ª¤¤¤Æ½ÅÊ£¤·¤Æ¤¤¤Þ¤¹" jpn "'%-.64s' ¤Ï key %d ¤Ë¤ª¤¤¤Æ½ÅÊ£¤·¤Æ¤¤¤Þ¤¹"
kor "Áߺ¹µÈ ÀÔ·Â °ª '%-.64s': key '%-.64s'" kor "Áߺ¹µÈ ÀÔ·Â °ª '%-.64s': key %d"
nor "Like verdier '%-.64s' for nøkkel '%-.64s'" nor "Like verdier '%-.64s' for nøkkel %d"
norwegian-ny "Like verdiar '%-.64s' for nykkel '%-.64s'" norwegian-ny "Like verdiar '%-.64s' for nykkel %d"
pol "Powtórzone wyst?pienie '%-.64s' dla klucza '%-.64s'" pol "Powtórzone wyst?pienie '%-.64s' dla klucza %d"
por "Entrada '%-.64s' duplicada para a chave '%-.64s'" por "Entrada '%-.64s' duplicada para a chave %d"
rum "Cimpul '%-.64s' e duplicat pentru cheia '%-.64s'" rum "Cimpul '%-.64s' e duplicat pentru cheia %d"
rus "äÕÂÌÉÒÕÀÝÁÑÓÑ ÚÁÐÉÓØ '%-.64s' ÐÏ ËÌÀÞÕ '%-.64s'" rus "äÕÂÌÉÒÕÀÝÁÑÓÑ ÚÁÐÉÓØ '%-.64s' ÐÏ ËÌÀÞÕ %d"
serbian "Dupliran unos '%-.64s' za kljuè '%-.64s'" serbian "Dupliran unos '%-.64s' za kljuè '%d'"
slo "Opakovaný kµúè '%-.64s' (èíslo kµúèa '%-.64s')" slo "Opakovaný kµúè '%-.64s' (èíslo kµúèa %d)"
spa "Entrada duplicada '%-.64s' para la clave '%-.64s'" spa "Entrada duplicada '%-.64s' para la clave %d"
swe "Dubbel nyckel '%-.64s' för nyckel '%-.64s'" swe "Dubbel nyckel '%-.64s' för nyckel %d"
ukr "äÕÂÌÀÀÞÉÊ ÚÁÐÉÓ '%-.64s' ÄÌÑ ËÌÀÞÁ '%-.64s'" ukr "äÕÂÌÀÀÞÉÊ ÚÁÐÉÓ '%-.64s' ÄÌÑ ËÌÀÞÁ %d"
ER_WRONG_FIELD_SPEC 42000 S1009 ER_WRONG_FIELD_SPEC 42000 S1009
cze "Chybn-Bá specifikace sloupce '%-.64s'" cze "Chybn-Bá specifikace sloupce '%-.64s'"
dan "Forkert kolonnespecifikaton for felt '%-.64s'" dan "Forkert kolonnespecifikaton for felt '%-.64s'"
@ -6012,4 +6012,28 @@ ER_WRONG_PARAMETERS_TO_NATIVE_FCT 42000
eng "Incorrect parameters in the call to native function '%-.64s'" eng "Incorrect parameters in the call to native function '%-.64s'"
ER_NATIVE_FCT_NAME_COLLISION ER_NATIVE_FCT_NAME_COLLISION
eng "This function '%-.64s' has the same name as a native function." eng "This function '%-.64s' has the same name as a native function."
ER_DUP_ENTRY_WITH_KEY_NAME 23000 S1009
cze "Zvojen-Bý klíè '%-.64s' (èíslo klíèe '%-.64s')"
dan "Ens værdier '%-.64s' for indeks '%-.64s'"
nla "Dubbele ingang '%-.64s' voor zoeksleutel '%-.64s'"
eng "Duplicate entry '%-.64s' for key '%-.64s'"
jps "'%-.64s' ‚Í key '%-.64s' ɨ¢Ä<E2809A>d•¡µÄ¢Ü·",
est "Kattuv väärtus '%-.64s' võtmele '%-.64s'"
fre "Duplicata du champ '%-.64s' pour la clef '%-.64s'"
ger "Doppelter Eintrag '%-.64s' für Schlüssel '%-.64s'"
greek "ÄéðëÞ åããñáöÞ '%-.64s' ãéá ôï êëåéäß '%-.64s'"
hun "Duplikalt bejegyzes '%-.64s' a '%-.64s' kulcs szerint."
ita "Valore duplicato '%-.64s' per la chiave '%-.64s'"
jpn "'%-.64s' ¤Ï key '%-.64s' ¤Ë¤ª¤¤¤Æ½ÅÊ£¤·¤Æ¤¤¤Þ¤¹"
kor "Áߺ¹µÈ ÀÔ·Â °ª '%-.64s': key '%-.64s'"
nor "Like verdier '%-.64s' for nøkkel '%-.64s'"
norwegian-ny "Like verdiar '%-.64s' for nykkel '%-.64s'"
pol "Powtórzone wyst?pienie '%-.64s' dla klucza '%-.64s'"
por "Entrada '%-.64s' duplicada para a chave '%-.64s'"
rum "Cimpul '%-.64s' e duplicat pentru cheia '%-.64s'"
rus "äÕÂÌÉÒÕÀÝÁÑÓÑ ÚÁÐÉÓØ '%-.64s' ÐÏ ËÌÀÞÕ '%-.64s'"
serbian "Dupliran unos '%-.64s' za kljuè '%-.64s'"
slo "Opakovaný kµúè '%-.64s' (èíslo kµúèa '%-.64s')"
spa "Entrada duplicada '%-.64s' para la clave '%-.64s'"
swe "Dubbel nyckel '%-.64s' för nyckel '%-.64s'"
ukr "äÕÂÌÀÀÞÉÊ ÚÁÐÉÓ '%-.64s' ÄÌÑ ËÌÀÞÁ '%-.64s'"

View File

@ -6660,7 +6660,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
uint key_nr= to->file->get_dup_key(error); uint key_nr= to->file->get_dup_key(error);
if ((int) key_nr >= 0) if ((int) key_nr >= 0)
{ {
const char *err_msg= ER(ER_DUP_ENTRY); const char *err_msg= ER(ER_DUP_ENTRY_WITH_KEY_NAME);
if (key_nr == 0 && if (key_nr == 0 &&
(to->key_info[0].key_part[0].field->flags & (to->key_info[0].key_part[0].field->flags &
AUTO_INCREMENT_FLAG)) AUTO_INCREMENT_FLAG))