Current Path : /home/usr.opt/mysql57/mysql-test/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/t/insert.test |
--source include/no_valgrind_without_big.inc # # Test of refering to old values # --disable_warnings drop table if exists t1,t2,t3; --enable_warnings SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; create table t1 (a int not null); insert into t1 values (1); insert into t1 values (a+2); insert into t1 values (a+3),(a+4); insert into t1 values (5),(a+6); select * from t1; drop table t1; # # Test of duplicate key values with packed keys # create table t1 (id int not null auto_increment primary key, username varchar(32) not null, unique (username)); insert into t1 values (0,"mysql"); insert into t1 values (0,"mysql ab"); insert into t1 values (0,"mysql a"); insert into t1 values (0,"r1manic"); insert into t1 values (0,"r1man"); drop table t1; # # Test insert syntax # create table t1 (a int not null auto_increment, primary key (a), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c char(10) default "hello", i int); insert into t1 values (default,default,default,default), (default,default,default,default), (4,0,"a",5),(default,default,default,default); select a,t>0,c,i from t1; truncate table t1; insert into t1 set a=default,t=default,c=default; insert into t1 set a=default,t=default,c=default,i=default; insert into t1 set a=4,t=0,c="a",i=5; insert into t1 set a=5,t=0,c="a",i=null; insert into t1 set a=default,t=default,c=default,i=default; select a,t>0,c,i from t1; drop table t1; # # Test problem with bulk insert and auto_increment on second part keys # create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id)) engine=myisam; insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL); select * from t1; insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); select * from t1; drop table t1; # #Test of behaviour with INSERT VALUES (NULL) # create table t1 (id int NOT NULL DEFAULT 8); -- error 1048 insert into t1 values(NULL); insert into t1 values (1), (NULL), (2); select * from t1; drop table t1; # # Test if insert ... select distinct # create table t1 (email varchar(50)); insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com'); create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2)); insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1; select * from t2; drop table t1,t2; # # Test of mysqld crash with fully qualified column names # --disable_warnings drop database if exists mysqltest; --enable_warnings create database mysqltest; use mysqltest; create table t1 (c int); insert into mysqltest.t1 set mysqltest.t1.c = '1'; drop database mysqltest; use test; # # Test of wrong values for float data (bug #2082) # # PS gives sligthly different numbers for max-float/max-double --disable_ps_protocol create table t1(number int auto_increment primary key, original_value varchar(50), f_double double, f_float float, f_double_7_2 double(7,2), f_float_4_3 float (4,3), f_double_u double unsigned, f_float_u float unsigned, f_double_15_1_u double(15,1) unsigned, f_float_3_1_u float (3,1) unsigned); set @value= "aa"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() set @value= "1aa"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() set @value= "aa1"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() set @value= "1e+1111111111a"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() set @value= "-1e+1111111111a"; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() --error 1367 set @value= 1e+1111111111; --error 1367 set @value= -1e+1111111111; set @value= 1e+111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() set @value= -1e+111; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() set @value= 1; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() set @value= -1; insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --query_vertical select * from t1 where number =last_insert_id() drop table t1; --enable_ps_protocol # End of 4.1 tests # # Test automatic result buffering with INSERT INTO t1 ... SELECT ... FROM t1 # create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); disable_query_log; let $1 = 100; while ($1) { let $2 = 5; eval insert into t1(t) values ('$1'); while ($2) { eval insert into t2(id2,t) values ($1,'$2'); let $3 = 10; while ($3) { eval insert into t3(id3,t) values ($1,'$2'); dec $3; } dec $2; } dec $1; } enable_query_log; select count(*) from t2; insert into t2 select t1.* from t1, t2 t, t3 where t1.id1 = t.id2 and t.id2 = t3.id3; select count(*) from t2; drop table t1,t2,t3; # # Test different cases of duplicate fields # create table t1 (a int, b int); insert into t1 (a,b) values (a,b); insert into t1 SET a=1, b=a+1; insert into t1 (a,b) select 1,2; INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a); --error 1110 prepare stmt1 from ' replace into t1 (a,a) select 100, ''hundred'' '; --error 1110 insert into t1 (a,b,b) values (1,1,1); --error 1136 insert into t1 (a,a) values (1,1,1); --error 1110 insert into t1 (a,a) values (1,1); --error 1110 insert into t1 SET a=1,b=2,a=1; --error 1110 insert into t1 (b,b) select 1,2; --error 1110 INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a); drop table t1; # # Test for values returned by ROW_COUNT() function # (and thus for values returned by mysql_affected_rows()) # for various forms of INSERT # create table t1 (id int primary key, data int); insert into t1 values (1, 1), (2, 2), (3, 3); select row_count(); insert ignore into t1 values (1, 1); #insert ignore gives warnings which resets the row_count. #'select row_count()' will not show the row_count from above statement. select row_count(); # Reports that 2 rows are affected (1 deleted + 1 inserted) replace into t1 values (1, 11); select row_count(); replace into t1 values (4, 4); select row_count(); # Reports that 2 rows are affected. This conforms to documentation. # (Useful for differentiating inserts from updates). insert into t1 values (2, 2) on duplicate key update data= data + 10; select row_count(); insert into t1 values (5, 5) on duplicate key update data= data + 10; select row_count(); drop table t1; # # Bug#25123: ON DUPLICATE KEY clause allows fields not from the insert table # create table t1 (f1 int unique, f2 int); create table t2 (f3 int, f4 int); create view v1 as select * from t1, t2 where f1= f3; insert into t1 values (1,11), (2,22); insert into t2 values (1,12), (2,24); --error 1393 insert into v1 (f1) values (3) on duplicate key update f3= f3 + 10; --error 1393 insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10; select * from t1; --error 1393 insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10; select * from t1; drop view v1; drop table t1,t2; # Test of INSERT IGNORE and re-using auto_increment values create table t1 (id int primary key auto_increment, data int, unique(data)) engine=myisam; insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120); insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90); insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150); select * from t1 order by id; drop table t1; # # Bug #26788: mysqld (debug) aborts when inserting specific numbers into char # fields # CREATE TABLE t1 ( a char(20) NOT NULL, b char(7) DEFAULT NULL, c char(4) DEFAULT NULL ); INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0); INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05); INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04); INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01); INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01); INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01); INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01); INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05); INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10); INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15); INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0); INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78); INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94); INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203); INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175); INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0); INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0); INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0); INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3); INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2); INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0); INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0); SELECT * FROM t1; DROP TABLE t1; CREATE TABLE t1 ( a char(20) NOT NULL, b char(7) DEFAULT NULL, c char(5) ); INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0); INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05); INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04); INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01); INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01); INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01); INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01); INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05); INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10); INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15); INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0); INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78); INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94); INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203); INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175); INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0); INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0); INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0); INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3); INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2); INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0); INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0); SELECT * FROM t1; DROP TABLE t1; SET sql_mode = default; # # Bug #31152: assertion in Field_str::store(double) # CREATE TABLE t (a CHAR(10),b INT); INSERT INTO t VALUES (),(),(); INSERT INTO t(a) SELECT rand() FROM t; DROP TABLE t; # # Bug #30453: String not cast to int correctly # CREATE TABLE t1 (c1 INT NOT NULL); INSERT INTO t1 VALUES(4188.32999999999992724042385816574096679687500), ('4188.32999999999992724042385816574096679687500'), (4188); SELECT * FROM t1; CREATE TABLE t2 (c1 BIGINT); INSERT INTO t2 VALUES('15449237462.0000000000'); SELECT * FROM t2; DROP TABLE t1, t2; # # Bug#43833 Simple INSERT crashes the server # CREATE TABLE t1(f1 FLOAT); INSERT INTO t1 VALUES (1.23); CREATE TABLE t2(f1 CHAR(1)); INSERT INTO t2 SELECT f1 FROM t1; DROP TABLE t1, t2; --echo End of 5.0 tests. --echo # --echo # Bug#34898 "mysql_info() reports 0 warnings while --echo # mysql_warning_count() reports 1" --echo # Check that the number of warnings reported by --echo # mysql_info() is correct. --echo # --disable_warnings drop table if exists t1; --enable_warnings create table t1 (data varchar(4) not null); --echo # --echo # Demonstrate that the number of warnings matches --echo # the information in mysql_info(). --echo # --enable_info insert ignore t1 (data) values ('letter'), (1/0); update ignore t1 set data='envelope' where 1/0 or 1; insert ignore t1 (data) values (default), (1/0), ('dead beef'); --disable_info drop table t1; --echo # --echo # End of 5.4 tests --echo # --echo # --echo # Bug#54106 assert in Protocol::end_statement, --echo # INSERT IGNORE ... SELECT ... UNION SELECT ... --echo # --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1 (a INT); --error ER_FIELD_SPECIFIED_TWICE INSERT INTO t1 (a, a) VALUES (1, 1); # Verify that ER_FIELD_SPECIFIED_TWICE is not ignorable --error ER_FIELD_SPECIFIED_TWICE INSERT IGNORE t1 (a, a) VALUES (1, 1); --error ER_FIELD_SPECIFIED_TWICE INSERT IGNORE t1 (a, a) SELECT 1,1; # Used to cause an assert --error ER_FIELD_SPECIFIED_TWICE INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2; DROP TABLE t1; --echo # --echo # Worklog #6073: Remove INSERT DELAYED --echo # CREATE TABLE t1( a INT ); INSERT DELAYED INTO t1 VALUES ( 1 ); REPLACE DELAYED INTO t1 VALUES ( 1 ); DROP TABLE t1; SET GLOBAL delayed_insert_limit = DEFAULT; SET GLOBAL delayed_insert_timeout = DEFAULT; SET GLOBAL delayed_queue_size = DEFAULT; SET GLOBAL max_insert_delayed_threads = DEFAULT; SET GLOBAL max_delayed_threads = DEFAULT; --echo # --echo # Bug#18064775 Assertion failed: fields.elements == values.elements --echo # CREATE TABLE t1(a INTEGER); --error ER_WRONG_VALUE_COUNT_ON_ROW INSERT INTO t1(a) values(); DROP TABLE t1; --echo # --echo # Bug#11745889 Traditional: INSERT accepts invalid date from default val --echo # SET sql_mode=''; CREATE TABLE default_date(a DATE NOT NULL DEFAULT '0000-00-00'); INSERT INTO default_date VALUES(); SET sql_mode=default; --error ER_TRUNCATED_WRONG_VALUE INSERT INTO default_date VALUES(); --error ER_TRUNCATED_WRONG_VALUE INSERT INTO default_date VALUES('0000-00-00'); SELECT * FROM default_date; DROP TABLE default_date; --echo --echo # Bug#11744960 : INSERT IGNORE SHOULD RETURN WARNINGS --echo # --enable_info CREATE TABLE t (a INT PRIMARY KEY); INSERT IGNORE INTO t VALUES (1); INSERT IGNORE INTO t VALUES (1),(1); DROP TABLE t; --disable_info --echo # --echo # WL#5275 Process subqueries in FROM clause in the same way as view --echo # CREATE TABLE t1(pk INTEGER PRIMARY KEY, a INTEGER); CREATE TABLE t2(pk INTEGER PRIMARY KEY, a INTEGER); CREATE TABLE t3(a INTEGER); CREATE TABLE t4(b INTEGER); INSERT INTO t2 VALUES(1, 10), (2, 20), (3, 30), (4, 40); INSERT INTO t3 VALUES(1), (3); INSERT INTO t4 VALUES(1); CREATE VIEW v1 AS SELECT * FROM t1 WHERE pk IN (SELECT a FROM t3); CREATE VIEW v2 AS SELECT * FROM t2 WHERE pk IN (SELECT a FROM t3); CREATE VIEW v3 AS SELECT t1.pk,t1.a FROM t1 JOIN t4 ON pk IN (SELECT a FROM t3); # Allow semi-join for selected tables, but not for inserted table: let $query= INSERT INTO v1 SELECT * FROM v2; eval EXPLAIN $query; eval $query; DELETE FROM t1; let $query= INSERT INTO v3(pk,a) SELECT * FROM v2; eval EXPLAIN $query; eval $query; DELETE FROM t1; # Allow semi-join and view merging for selected tables: let $query= INSERT INTO v1 SELECT dt.pk, v2.a FROM (SELECT * FROM v2) AS dt JOIN v2 ON dt.pk=v2.pk; eval EXPLAIN $query; eval $query; DROP VIEW v1, v2, v3; DROP TABLE t1, t2, t3, t4; --echo # Bug#20310257 Explain for insert into a view show wrong table for ins. CREATE TABLE t1(a INTEGER); CREATE TABLE t2(b INTEGER); CREATE VIEW v AS SELECT * FROM t1 JOIN t2 ON TRUE; let $query= INSERT INTO v(a) VALUES(1); eval explain $query; eval $query; let $query= INSERT INTO v(b) VALUES(1); eval explain $query; eval $query; let $query= INSERT INTO v(a) SELECT 2; eval explain $query; eval $query; let $query= INSERT INTO v(b) SELECT 2; eval explain $query; eval $query; SELECT * FROM t1; SELECT * FROM t2; DROP VIEW v; DROP TABLE t1, t2; # Check that ON DUPLICATE KEY UPDATE works too: CREATE TABLE t1(a1 INTEGER PRIMARY KEY, b1 INTEGER); CREATE TABLE t2(a2 INTEGER PRIMARY KEY, b2 INTEGER); CREATE VIEW v AS SELECT * FROM t1 JOIN t2 ON TRUE; INSERT INTO v(a1,b1) VALUES (11, 0) ON DUPLICATE KEY UPDATE b1=b1+1; INSERT INTO v(a1,b1) VALUES (11, 0) ON DUPLICATE KEY UPDATE b1=b1+1; INSERT INTO v(a2,b2) VALUES (21, 0) ON DUPLICATE KEY UPDATE b2=b2+1; INSERT INTO v(a2,b2) VALUES (21, 0) ON DUPLICATE KEY UPDATE b2=b2+1; SELECT * FROM v; DELETE FROM t1; DELETE FROM t2; INSERT INTO v(a1,b1) SELECT 11, 0 ON DUPLICATE KEY UPDATE b1=b1+1; INSERT INTO v(a1,b1) SELECT 11, 0 ON DUPLICATE KEY UPDATE b1=b1+1; INSERT INTO v(a2,b2) SELECT 21, 0 ON DUPLICATE KEY UPDATE b2=b2+1; INSERT INTO v(a2,b2) SELECT 21, 0 ON DUPLICATE KEY UPDATE b2=b2+1; SELECT * FROM v; DROP VIEW v; DROP TABLE t1, t2; --echo # Bug#20753569: handle_fatal_signal (sig=11) in --echo # st_select_lex::merge_derived CREATE TABLE t1(a INTEGER); CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a; INSERT INTO v1 SELECT 3; REPLACE INTO v1 SELECT 3; INSERT INTO v1 VALUES(3); REPLACE INTO v1 VALUES(3); DROP VIEW v1; DROP TABLE t1; --echo # --echo # Bug#21696206: ASSERTION `TRANSL->ITEM->FIXED' FAILED IN --echo # SELECT_LEX::DELETE_UNUSED_MERGED_COLUMN --echo # CREATE TABLE t1 ( pk INT, PRIMARY KEY (pk)); CREATE TABLE t2 LIKE t1; INSERT INTO t1 VALUES (2); INSERT INTO t2 VALUES (2); CREATE VIEW v1 AS SELECT * FROM t2 AS a WHERE a.pk IN ( SELECT pk FROM t1 AS b WHERE b.pk = a.pk ); CREATE VIEW v2 AS SELECT * FROM t1 AS a WHERE a.pk IN ( SELECT pk FROM v1 AS b WHERE b.pk = a.pk ); PREPARE st1 FROM 'INSERT INTO v2 (pk) VALUES ( 1 )'; EXECUTE st1; SELECT * FROM t1; SELECT * FROM t2; DROP TABLE t1, t2; DROP VIEW v1, v2; --echo # --echo # Bug#21696641: ASSERTION !(WANT_PRIVILEGE & ~(GRANT->WANT_PRIVILEGE | --echo # GRANT->PRIVILEGE))' --echo # CREATE TABLE t1 (pk INT, PRIMARY KEY (pk)); INSERT INTO t1 VALUES (1); CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT * FROM t1 AS a NATURAL JOIN t1 b WHERE pk BETWEEN 1 AND 2; CREATE ALGORITHM = UNDEFINED VIEW v1 AS SELECT * FROM t1 AS a WHERE a.pk IN ( SELECT pk FROM v2 AS b WHERE b.pk = a.pk ); PREPARE st1 FROM "INSERT INTO v1 (pk) VALUES (2)"; EXECUTE st1; SELECT * FROM t1; DROP VIEW v1, v2; DROP TABLE t1; --echo # --echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE --echo # FOREIGN KEY CONSTRAINT --echo # Setup. CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE=INNODB; CREATE TABLE t2 (fld2 INT, FOREIGN KEY (fld2) REFERENCES t1 (fld1)) ENGINE=INNODB; INSERT INTO t1 VALUES(0); INSERT INTO t2 VALUES(0); --echo # Without fix, an error is reported. --enable_warnings INSERT IGNORE INTO t2 VALUES(1); UPDATE IGNORE t2 SET fld2=20 WHERE fld2=0; UPDATE IGNORE t1 SET fld1=20 WHERE fld1=0; --echo # Test for multi update. UPDATE IGNORE t1, t2 SET t2.fld2= t2.fld2 + 3; UPDATE IGNORE t1, t2 SET t1.fld1= t1.fld1 + 3; --disable_warnings --echo # Reports an error since IGNORE is not used. --error ER_NO_REFERENCED_ROW_2 INSERT INTO t2 VALUES(1); --error ER_NO_REFERENCED_ROW_2 UPDATE t2 SET fld2=20 WHERE fld2=0; --error ER_ROW_IS_REFERENCED_2 UPDATE t1 SET fld1=20 WHERE fld1=0; --error ER_NO_REFERENCED_ROW_2 UPDATE t1, t2 SET t2.fld2= t2.fld2 + 3; --error ER_ROW_IS_REFERENCED_2 UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; DROP TABLE t2, t1; --echo # --echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN --echo # KEY CONSTRAINT CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB; CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL, CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB; --echo # Without patch, reports incorrect error. --error ER_NO_REFERENCED_ROW_2 INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; --error ER_NO_REFERENCED_ROW_2 REPLACE INTO t2 VALUES('abc', 2); --enable_warnings INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; --disable_warnings DROP TABLE t2, t1;