mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
b4f80eedf3
Changed error message to be compatible with old error file Added new error message for new DUP_ENTRY syntax BUILD/SETUP.sh: Give warnings for unused objects mysql-test/extra/binlog_tests/insert_select-binlog.test: Changed to use new error message mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_auto_increment.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_foreign_key.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_insert_id.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_insert_id_pk.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_loaddata.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_row_basic.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test: Changed to use new error message mysql-test/extra/rpl_tests/rpl_trig004.test: Changed to use new error message mysql-test/include/mix1.inc: Changed to use new error message mysql-test/include/mix2.inc: Changed to use new error message mysql-test/include/ps_modify.inc: Changed to use new error message mysql-test/include/query_cache.inc: Changed to use new error message mysql-test/include/varchar.inc: Changed to use new error message mysql-test/r/create.result: Changed to use new error message mysql-test/r/rpl_sp.result: Changed to use new error message mysql-test/r/sp.result: Changed to use new error message mysql-test/r/view.result: Changed to use new error message mysql-test/t/auto_increment.test: Changed to use new error message mysql-test/t/create.test: Changed to use new error message mysql-test/t/create_select_tmp.test: Changed to use new error message mysql-test/t/ctype_utf8.test: Changed to use new error message mysql-test/t/delayed.test: Changed to use new error message mysql-test/t/heap.test: Changed to use new error message mysql-test/t/heap_btree.test: Changed to use new error message mysql-test/t/heap_hash.test: Changed to use new error message mysql-test/t/innodb.test: Changed to use new error message mysql-test/t/insert_select.test: Changed to use new error message mysql-test/t/insert_update.test: Changed to use new error message mysql-test/t/join_outer.test: Changed to use new error message mysql-test/t/key.test: Changed to use new error message mysql-test/t/merge.test: Changed to use new error message mysql-test/t/myisam.test: Changed to use new error message mysql-test/t/ndb_charset.test: Changed to use new error message mysql-test/t/ndb_index_unique.test: Changed to use new error message mysql-test/t/ndb_insert.test: Changed to use new error message mysql-test/t/ndb_replace.test: Changed to use new error message mysql-test/t/ndb_update.test: Changed to use new error message mysql-test/t/replace.test: Changed to use new error message mysql-test/t/rpl_err_ignoredtable.test: Changed to use new error message mysql-test/t/rpl_row_create_table.test: Changed to use new error message mysql-test/t/rpl_skip_error-slave.opt: Changed to use new error message mysql-test/t/rpl_sp.test: Changed to use new error message mysql-test/t/show_check.test: Changed to use new error message mysql-test/t/sp-error.test: Changed to use new error message mysql-test/t/sp.test: Changed to use new error message mysql-test/t/sp_trans.test: Changed to use new error message mysql-test/t/temp_table.test: Changed to use new error message mysql-test/t/type_binary.test: Changed to use new error message mysql-test/t/type_bit.test: Changed to use new error message mysql-test/t/type_bit_innodb.test: Changed to use new error message mysql-test/t/type_blob.test: Changed to use new error message mysql-test/t/type_varchar.test: Changed to use new error message mysql-test/t/view.test: Changed to use new error message sql/handler.cc: ER_DUP_ENTRY -> ER_DUP_ENTRY_WITH_KEY_NAME sql/share/errmsg.txt: Changed error message to be compatible with old error file Added new error message for new DUP_ENTRY syntax sql/sql_table.cc: ER_DUP_ENTRY -> ER_DUP_ENTRY_WITH_KEY_NAME sql-bench/example: Example file for how to run tests
141 lines
4.4 KiB
Text
141 lines
4.4 KiB
Text
--disable_warnings
|
|
DROP TABLE IF EXISTS t1, t2;
|
|
--enable_warnings
|
|
|
|
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
|
|
INSERT t1 VALUES (1,2,10), (3,4,20);
|
|
INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100;
|
|
SELECT * FROM t1;
|
|
INSERT t1 VALUES (5,7,40) ON DUPLICATE KEY UPDATE c=c+100;
|
|
SELECT * FROM t1;
|
|
INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE c=c+1000;
|
|
SELECT * FROM t1;
|
|
INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000;
|
|
SELECT * FROM t1;
|
|
-- error ER_DUP_ENTRY_WITH_KEY_NAME
|
|
INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
|
|
SELECT * FROM t1;
|
|
TRUNCATE TABLE t1;
|
|
INSERT t1 VALUES (1,2,10), (3,4,20);
|
|
INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE c=c+100;
|
|
SELECT * FROM t1;
|
|
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
|
|
SELECT * FROM t1;
|
|
INSERT t1 VALUES (2,1,11), (7,4,40) ON DUPLICATE KEY UPDATE c=c+VALUES(a);
|
|
SELECT *, VALUES(a) FROM t1;
|
|
explain extended SELECT *, VALUES(a) FROM t1;
|
|
explain extended select * from t1 where values(a);
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# test for Bug #2709 "Affected Rows for ON DUPL.KEY undocumented,
|
|
# perhaps illogical"
|
|
#
|
|
create table t1(a int primary key, b int);
|
|
insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
|
|
select * from t1;
|
|
|
|
--enable_info
|
|
insert into t1 values(4,14),(5,15),(6,16),(7,17),(8,18)
|
|
on duplicate key update b=b+10;
|
|
--disable_info
|
|
|
|
select * from t1;
|
|
|
|
enable_info;
|
|
replace into t1 values(5,25),(6,26),(7,27),(8,28),(9,29);
|
|
disable_info;
|
|
|
|
select * from t1;
|
|
drop table t1;
|
|
|
|
# WorkLog #2274 - enable INSERT .. SELECT .. UPDATE syntax
|
|
# Same tests as beginning of this test except that insert source
|
|
# is a result from a select statement
|
|
#
|
|
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
|
|
INSERT t1 VALUES (1,2,10), (3,4,20);
|
|
INSERT t1 SELECT 5,6,30 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
|
|
SELECT * FROM t1;
|
|
INSERT t1 SELECT 5,7,40 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
|
|
SELECT * FROM t1;
|
|
INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
|
|
SELECT * FROM t1;
|
|
INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
|
|
SELECT * FROM t1;
|
|
-- error ER_DUP_ENTRY_WITH_KEY_NAME
|
|
INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
|
|
SELECT * FROM t1;
|
|
TRUNCATE TABLE t1;
|
|
INSERT t1 VALUES (1,2,10), (3,4,20);
|
|
CREATE TABLE t2 (a INT, b INT, c INT, d INT);
|
|
# column names deliberately clash with columns in t1 (Bug#8147)
|
|
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
|
|
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
|
|
INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=t1.c+100;
|
|
SELECT * FROM t1;
|
|
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
|
|
SELECT * FROM t1;
|
|
--error 1052
|
|
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
|
|
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a);
|
|
SELECT *, VALUES(a) FROM t1;
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
|
|
#
|
|
# Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update"
|
|
# INSERT INGORE...UPDATE gives bad error or breaks protocol.
|
|
#
|
|
create table t1 (a int not null unique) engine=myisam;
|
|
insert into t1 values (1),(2);
|
|
insert ignore into t1 select 1 on duplicate key update a=2;
|
|
select * from t1;
|
|
insert ignore into t1 select a from t1 as t2 on duplicate key update a=t1.a+1 ;
|
|
select * from t1;
|
|
insert into t1 select 1 on duplicate key update a=2;
|
|
select * from t1;
|
|
--error 1052
|
|
insert into t1 select a from t1 on duplicate key update a=a+1 ;
|
|
--error 1052
|
|
insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ;
|
|
drop table t1;
|
|
|
|
#
|
|
# Bug#10109 - INSERT .. SELECT ... ON DUPLICATE KEY UPDATE fails
|
|
# Bogus "Duplicate columns" error message
|
|
#
|
|
|
|
CREATE TABLE t1 (
|
|
a BIGINT(20) NOT NULL DEFAULT 0,
|
|
PRIMARY KEY (a)
|
|
) ENGINE=MyISAM;
|
|
|
|
INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a) ;
|
|
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
|
|
#
|
|
|
|
|
|
# End of 4.1 tests
|
|
CREATE TABLE t1
|
|
(
|
|
a BIGINT UNSIGNED,
|
|
b BIGINT UNSIGNED,
|
|
PRIMARY KEY (a)
|
|
);
|
|
|
|
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
|
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES (45, 2) ON DUPLICATE KEY UPDATE b =
|
|
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
|
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
|
SELECT * FROM t1;
|
|
|
|
DROP TABLE t1;
|