config root man

Current Path : /home/usr.opt/mysql57/mysql-test/r/

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
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/r/ignore_strict.result

#
# Part 1 : Statements with IGNORE to convert Errors to Warnings.
#

SET @org_mode=@@sql_mode;
#
#For Error Code : ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
#
CREATE TABLE t1 (a int) ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 2;
INSERT INTO t1 VALUES (0), (1), (2), (3);
CREATE VIEW v1 AS SELECT a FROM t1 PARTITION (p0);
SELECT * FROM t1;
a
0
2
1
3
SELECT * FROM v1;
a
0
2
INSERT INTO v1 VALUES (10),(11);
ERROR HY000: Found a row not matching the given partition set
INSERT IGNORE INTO v1 VALUES (10),(11);
Warnings:
Warning	1748	Found a row not matching the given partition set
UPDATE IGNORE v1 SET a=11 WHERE a=2;
Warnings:
Warning	1748	Found a row not matching the given partition set
SELECT * FROM v1;
a
0
2
10
SELECT * from t1;
a
0
2
10
1
3
DROP TABLE t1;
DROP VIEW v1;
#
#For Error Code : ER_NO_PARTITION_FOR_GIVEN_VALUE
#                 ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT
#
CREATE TABLE t1 (a int) ENGINE = InnoDB PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (2,5), PARTITION x2 VALUES IN (3));
INSERT INTO t1 VALUES (2), (3), (5);
INSERT INTO t1 VALUES (2),(4);
ERROR HY000: Table has no partition for value 4
INSERT IGNORE INTO t1 VALUES (2),(4);
Warnings:
Warning	1526	Table has no partition for value 4
SELECT * FROM t1;
a
2
5
2
3
UPDATE t1 SET a=a+1;
ERROR HY000: Table has no partition for value 6
UPDATE IGNORE t1 SET a=a+1;
Warnings:
Warning	1526	Table has no partition for value 6
Warning	1526	Table has no partition for value 4
SELECT * FROM t1;
a
5
3
3
3
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE = InnoDB;
CREATE TABLE t3 (c INT PRIMARY KEY, FOREIGN KEY(c) REFERENCES t2(b)) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1), (2), (5);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1), (2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
INSERT IGNORE INTO t3 VALUES (1), (2);
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE t3 SET c=2 where c=1;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE IGNORE t3 SET c=2 where c=1;
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
DELETE FROM t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
DELETE IGNORE FROM t1;
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
SELECT * FROM t1;
a
1
UPDATE t2 SET b=b+5;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE IGNORE t2 SET b=b+5;
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
SELECT * FROM t2;
b
1
DROP TABLE t3,t2,t1;
CREATE TABLE t1 (a INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1),(NULL),(2);
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
ALTER TABLE t1 CHANGE a a INT NOT NULL;
Warnings:
Warning	1265	Data truncated for column 'a' at row 2
SET sql_mode = default;
SELECT * FROM t1;
a
1
0
2
UPDATE IGNORE t1 SET a=NULL WHERE a=0;
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
1
0
2
DELETE FROM t1;
INSERT INTO t1 VALUES (NULL);
ERROR 23000: Column 'a' cannot be null
INSERT IGNORE INTO t1 VALUES (NULL);
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
0
INSERT IGNORE INTO t1 VALUES (NULL),(3);
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
0
0
3
DROP TABLE t1;
CREATE TABLE t1(a INT, b INT) ENGINE = InnoDB;
CREATE TABLE t2(a INT, b INT NOT NULL) ENGINE = InnoDB;
INSERT INTO t1 VALUES(1, NULL),(2,NULL);
INSERT INTO t2 VALUES (1,3), (2,4);
UPDATE IGNORE t1,t2 SET t2.b=NULL;
Warnings:
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
DROP TABLE t1,t2;
#
# IGNORE keyword in the statement should not affect the errors in the
# trigger execution if trigger statement does not have IGNORE keyword.
# and vice versa.
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE = InnoDB;
CREATE TABLE t3 (c INT PRIMARY KEY) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1),(2),(3),(4),(5);
CREATE TRIGGER post_insert_t1 AFTER INSERT ON t1
FOR EACH ROW BEGIN
INSERT INTO t3 VALUES(5);
END|
CREATE TRIGGER post_update_t1 AFTER UPDATE ON t1
FOR EACH ROW BEGIN
INSERT INTO t3 VALUES(4);
END|
INSERT IGNORE INTO t1 VALUES(3);
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
SELECT * FROM t1;
a
1
2
UPDATE IGNORE t1 SET a=3 WHERE a=2;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
SELECT * FROM t1;
a
1
2
DROP TRIGGER post_insert_t1;
DROP TRIGGER post_update_t1;
CREATE TRIGGER post_insert_t1 AFTER INSERT ON t1
FOR EACH ROW BEGIN
INSERT IGNORE INTO t3 VALUES (5),(6);
END|
CREATE TRIGGER post_update_t1 AFTER UPDATE ON t1
FOR EACH ROW BEGIN
INSERT IGNORE INTO t3 VALUES(4);
END|
INSERT INTO t1 VALUES(2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
SELECT * FROM t3;
c
1
2
3
4
5
INSERT IGNORE INTO t1 VALUES(2),(3);
Warnings:
Warning	1062	Duplicate entry '2' for key 'PRIMARY'
SELECT * FROM t1;
a
1
2
3
SELECT * FROM t3;
c
1
2
3
4
5
6
UPDATE IGNORE t1 SET a=3 WHERE a=2;
Warnings:
Warning	1062	Duplicate entry '3' for key 'PRIMARY'
DROP TRIGGER post_insert_t1;
DROP TRIGGER post_update_t1;
DROP TABLE t2,t1,t3;

#
# Part 2 : Statements with IGNORE + STRICT
#          These statements gives error by default
#           without IGNORE and STRICT mode.
#

SET sql_mode=default;
CREATE TABLE t1 (a INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1),(NULL),(2);
DROP TABLE t1;
CREATE TABLE t1(a INT NOT NULL) ENGINE = InnoDB;
INSERT INTO t1 VALUES (NULL);
ERROR 23000: Column 'a' cannot be null
INSERT IGNORE INTO t1 VALUES(NULL);
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
0
INSERT INTO t1 VALUES (NULL),(3);
ERROR 23000: Column 'a' cannot be null
INSERT IGNORE INTO t1 VALUES (NULL),(1);
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
0
0
1
UPDATE t1 SET a=NULL WHERE a=0;
ERROR 23000: Column 'a' cannot be null
UPDATE IGNORE t1 SET a=NULL WHERE a=0;
Warnings:
Warning	1048	Column 'a' cannot be null
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
0
0
1
DROP TABLE t1;
CREATE TABLE t1(a INT, b INT) ENGINE = InnoDB;
CREATE TABLE t2(a INT, b INT NOT NULL) ENGINE = InnoDB;
INSERT INTO t1 VALUES(1, NULL),(2,NULL);
INSERT INTO t2 VALUES (1,3), (2,4);
UPDATE t1,t2 SET t2.b=NULL;
ERROR 23000: Column 'b' cannot be null
UPDATE IGNORE t1,t2 SET t2.b=NULL;
Warnings:
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
DROP TABLE t1, t2;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE = InnoDB;
CREATE TABLE t3 (c INT PRIMARY KEY, FOREIGN KEY(c) REFERENCES t2(b)) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1), (2), (5);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1), (2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
INSERT IGNORE INTO t3 VALUES (1), (2);
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE t3 SET c=2 where c=1;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE IGNORE t3 SET c=2 where c=1;
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
DELETE FROM t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
DELETE IGNORE FROM t1;
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
SELECT * FROM t1;
a
1
UPDATE t2 SET b=b+5;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE IGNORE t2 SET b=b+5;
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
SELECT * FROM t2;
b
1
DROP TABLE t3,t2,t1;
CREATE TABLE t1 (a int) ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 2;
INSERT INTO t1 VALUES (0), (1), (2), (3);
CREATE VIEW v1 AS SELECT a FROM t1 PARTITION (p0);
SELECT * FROM t1;
a
0
2
1
3
SELECT * FROM v1;
a
0
2
INSERT INTO v1 VALUES (10),(11);
ERROR HY000: Found a row not matching the given partition set
INSERT IGNORE INTO v1 VALUES (10),(11);
Warnings:
Warning	1748	Found a row not matching the given partition set
UPDATE v1 SET a=11 WHERE a=2;
ERROR HY000: Found a row not matching the given partition set
UPDATE IGNORE v1 SET a=11 WHERE a=2;
Warnings:
Warning	1748	Found a row not matching the given partition set
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a int) ENGINE = InnoDB PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (2,5), PARTITION x2 VALUES IN (3));
INSERT INTO t1 VALUES (2), (3),(5);
INSERT INTO t1 VALUES (2),(4);
ERROR HY000: Table has no partition for value 4
INSERT IGNORE INTO t1 VALUES (2),(4);
Warnings:
Warning	1526	Table has no partition for value 4
UPDATE t1 SET a=4 WHERE a=5;
ERROR HY000: Table has no partition for value 4
UPDATE IGNORE t1 SET a=4 WHERE a=5;
Warnings:
Warning	1526	Table has no partition for value 4
DROP TABLE t1;
CREATE TABLE t11 (a INT NOT NULL, b INT, PRIMARY KEY (a)) ENGINE = InnoDB;
CREATE TABLE t2 (a INT NOT NULL, b INT, PRIMARY KEY (a)) ENGINE = InnoDB;
INSERT INTO t11 VALUES (0, 10),(1, 11),(2, 12);
INSERT INTO t2 VALUES (1, 21),(2, 12),(3, 23);
DELETE FROM t11 WHERE t11.b = (SELECT b FROM t2 WHERE t11.a < t2.a);
ERROR 21000: Subquery returns more than 1 row
DELETE IGNORE FROM t11 WHERE t11.b = (SELECT b FROM t2 WHERE t11.a < t2.a);
Warnings:
Warning	1242	Subquery returns more than 1 row
Warning	1242	Subquery returns more than 1 row
DROP TABLE t11, t2;
CREATE TABLE t1 (a INT) ENGINE = InnoDB;
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a < 2 WITH CHECK OPTION;
INSERT INTO v1 VALUES (1), (3);
ERROR HY000: CHECK OPTION failed 'test.v1'
INSERT IGNORE INTO v1 VALUES (1), (3);
Warnings:
Warning	1369	CHECK OPTION failed 'test.v1'
UPDATE v1 SET a=5 WHERE a=1;
ERROR HY000: CHECK OPTION failed 'test.v1'
UPDATE IGNORE v1 SET a=5 WHERE a=1;
Warnings:
Warning	1369	CHECK OPTION failed 'test.v1'
DROP VIEW v1;
DROP TABLE t1;

#
# Part 3 : For the handler errors converted to warning
#             by IGNORE keyword.
#

#
# Test For warning message for unique key constraint violation.
#
CREATE TABLE t1( a INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t2( a INT PRIMARY KEY) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1), (2), (3), (4);
INSERT INTO t2 VALUES (2), (4);
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/wl6614.txt' FROM t1;
SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/wl6614.txt');
LOAD_FILE('MYSQLTEST_VARDIR/tmp/wl6614.txt')
1
2
3
4

LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/wl6614.txt' INTO TABLE t2;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/wl6614.txt' IGNORE INTO TABLE t2;
Warnings:
Warning	1062	Duplicate entry '2' for key 'PRIMARY'
Warning	1062	Duplicate entry '4' for key 'PRIMARY'
SELECT * FROM t2;
a
1
2
3
4
DELETE FROM t2;
INSERT INTO t2 VALUES (2),(4);
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/wl6614.txt' IGNORE INTO TABLE t2;
Warnings:
Warning	1062	Duplicate entry '2' for key 'PRIMARY'
Warning	1062	Duplicate entry '4' for key 'PRIMARY'
SELECT * from t2;
a
1
2
3
4
DROP TABLE t1,t2;

#
# Part 4 : For the error codes affected by STRICT Mode,
#          Using IGNORE + STRICT should give the behavior
#          Warning --->  Warning ( IGNORE+STRICT mode)
#

#
#For Error Code : ER_NO_DEFAULT_FOR_FIELD
#                 ER_NO_DEFAULT_FOR_VIEW_FIELD
#
DROP TABLE IF EXISTS t1;
Warnings:
Note	1051	Unknown table 'test.t1'
CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL) ENGINE = InnoDB;
CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1;
INSERT INTO t1 (col1) VALUES(12);
ERROR HY000: Field 'col2' doesn't have a default value
INSERT IGNORE INTO t1 (col1) VALUES(12);
Warnings:
Warning	1364	Field 'col2' doesn't have a default value
INSERT INTO v1 (vcol1) VALUES(12);
ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value
INSERT IGNORE INTO v1 (vcol1) VALUES(12);
Warnings:
Warning	1423	Field of view 'test.v1' underlying table doesn't have a default value
DROP TABLE t1;
DROP VIEW v1;
#
#For Error Code : ER_WARN_DATA_OUT_OF_RANGE
#
SET sql_mode=default;
CREATE TABLE t1(a INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES(2147483648);
ERROR 22003: Out of range value for column 'a' at row 1
INSERT IGNORE INTO t1 VALUES(2147483648);
Warnings:
Warning	1264	Out of range value for column 'a' at row 1
UPDATE IGNORE t1 SET a=2147483648 WHERE a=0;
DROP TABLE t1;
#
#For Error Code : ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
#
DROP TABLE IF EXISTS t1;
Warnings:
Note	1051	Unknown table 'test.t1'
CREATE TABLE t1(a INT) ENGINE = InnoDB;
INSERT INTO t1 values('a');
ERROR HY000: Incorrect integer value: 'a' for column 'a' at row 1
INSERT IGNORE INTO t1 values('a');
Warnings:
Warning	1366	Incorrect integer value: 'a' for column 'a' at row 1
UPDATE IGNORE t1 SET a='a' WHERE a=0;
Warnings:
Warning	1366	Incorrect integer value: 'a' for column 'a' at row 1
DROP TABLE t1;
#
#For Error Code : ER_DATA_TOO_LONG
#
DROP TABLE IF EXISTS t3;
Warnings:
Note	1051	Unknown table 'test.t3'
CREATE TABLE t3(c1 CHAR(10) NOT NULL) ENGINE = InnoDB;
INSERT INTO t3 VALUES('a');
INSERT INTO t3 (c1) VALUES('12345678901.x');
ERROR 22001: Data too long for column 'c1' at row 1
INSERT IGNORE INTO t3 (c1) VALUES('12345678901.x');
Warnings:
Warning	1265	Data truncated for column 'c1' at row 1
UPDATE IGNORE t3 SET c1='12345678901.x' WHERE c1='a';
Warnings:
Warning	1265	Data truncated for column 'c1' at row 1
DROP TABLE t3;
#
#For Error Code : ER_WRONG_VALUE_FOR_TYPE
#
CREATE TABLE t1 (col1 DATETIME) ENGINE = InnoDB;
INSERT INTO t1 VALUES('1000-01-01 00:00:00');
INSERT INTO t1 VALUES(STR_TO_DATE('32.10.2004 15.30','%D.%D.%Y %H.%I'));
ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
INSERT IGNORE INTO t1 VALUES(STR_TO_DATE('32.10.2004 15.30','%D.%D.%Y %H.%I'));
Warnings:
Warning	1411	Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
Warning	1411	Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
UPDATE IGNORE t1 SET col1=STR_TO_DATE('32.10.2004 15.30','%D.%D.%Y %H.%I') WHERE col1='1000-01-01 00:00:00';
Warnings:
Warning	1411	Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
Warning	1411	Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
DROP TABLE t1;
#
#For Error Code : ER_DATETIME_FUNCTION_OVERFLOW
#
CREATE TABLE t1 (d DATE) ENGINE = InnoDB;
INSERT INTO t1 (d) SELECT DATE_SUB('2000-01-01', INTERVAL 2001 YEAR);
ERROR 22008: Datetime function: datetime field overflow
INSERT IGNORE INTO t1 (d) SELECT DATE_SUB('2000-01-01',INTERVAL 2001 YEAR);
Warnings:
Warning	1441	Datetime function: datetime field overflow
DROP TABLE t1;
#
#For Error Code : ER_TRUNCATED_WRONG_VALUE
#
CREATE TABLE t1 (col1 CHAR(3), col2 INT) ENGINE = InnoDB;
INSERT INTO t1 (col1) VALUES (CAST(1000 as CHAR(3)));
ERROR 22007: Truncated incorrect CHAR(3) value: '1000'
SELECT * FROM t1;
col1	col2
INSERT IGNORE into t1 (col1) VALUES (CAST(1000 as CHAR(3)));
Warnings:
Warning	1292	Truncated incorrect CHAR(3) value: '1000'
SELECT * FROM t1;
col1	col2
100	NULL
INSERT INTO t1 (col1) VALUES (CAST(1000 as CHAR(3)));
ERROR 22007: Truncated incorrect CHAR(3) value: '1000'
SELECT * FROM t1;
col1	col2
100	NULL
INSERT IGNORE into t1 (col1) VALUES (CAST(1000 as CHAR(3)));
Warnings:
Warning	1292	Truncated incorrect CHAR(3) value: '1000'
SELECT * FROM t1;
col1	col2
100	NULL
100	NULL
DROP TABLE t1;
#
#For Error Code : ER_DIVISION_BY_ZERO
#For Error Code : WARN_DATA_TRUNCATED
#
SET sql_mode='ERROR_FOR_DIVISION_BY_ZERO,STRICT_ALL_TABLES';
Warnings:
Warning	3135	'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
CREATE TABLE t1(a TINYINT);
INSERT INTO t1 VALUES(2/0);
ERROR 22012: Division by 0
INSERT IGNORE INTO t1 VALUES(2/0);
Warnings:
Warning	1365	Division by 0
SELECT * FROM t1;
a
NULL
DELETE FROM t1;
INSERT INTO t1 VALUES ('a59b');
ERROR HY000: Incorrect integer value: 'a59b' for column 'a' at row 1
INSERT IGNORE INTO t1 VALUES ('a59b');
Warnings:
Warning	1366	Incorrect integer value: 'a59b' for column 'a' at row 1
INSERT INTO t1 VALUES ('1a');
ERROR 01000: Data truncated for column 'a' at row 1
INSERT IGNORE INTO t1 VALUES ('1a');
Warnings:
Warning	1265	Data truncated for column 'a' at row 1
DROP TABLE t1;
#
#For Error Code : ER_WRONG_ARGUMENTS
#
CREATE TABLE t1(a INT) ENGINE = InnoDB;
INSERT INTO t1(SELECT SLEEP(NULL));
ERROR HY000: Incorrect arguments to sleep.
INSERT IGNORE into t1(SELECT SLEEP(NULL));
Warnings:
Warning	1210	Incorrect arguments to sleep.
SELECT * FROM t1;
a
0
DROP TABLE t1;
#
#For Error Code : ER_WARN_NULL_TO_NOTNULL
#
CREATE TABLE t1(a INT, b INT NOT NULL, c INT NOT NULL, d INT NOT NULL) ENGINE = InnoDB;
LOAD DATA INFILE '../../std_data/wl6030_2.dat' INTO TABLE t1 FIELDS TERMINATED BY ',' ENCLOSED BY '"';
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 3
SELECT * FROM t1;
a	b	c	d
LOAD DATA INFILE '../../std_data/wl6030_2.dat' IGNORE INTO TABLE t1 FIELDS TERMINATED BY ',' ENCLOSED BY '"';
Warnings:
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'b' at row 3
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'c' at row 4
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'd' at row 5
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'b' at row 6
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'c' at row 6
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'd' at row 6
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'b' at row 7
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'c' at row 8
Warning	1263	Column set to default value; NULL supplied to NOT NULL column 'd' at row 9
SELECT * FROM t1;
a	b	c	d
11	12	13	14
NULL	22	23	24
31	0	33	34
41	42	0	44
51	52	53	0
NULL	0	0	0
NULL	0	73	74
NULL	82	0	84
NULL	92	93	0
DROP TABLE t1;
SET sql_mode=@org_mode;
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.

#
# Part 5 : Test cases for the non transactional (MyIsam) engine.
#
CREATE TABLE t1 (a int) ENGINE = MyISAM PARTITION BY HASH (a) PARTITIONS 2;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
INSERT INTO t1 VALUES (0), (1), (2), (3);
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
CREATE VIEW v1 AS SELECT a FROM t1 PARTITION (p0);
SHOW CREATE VIEW v1;
View	Create View	character_set_client	collation_connection
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` PARTITION (`p0`)	latin1	latin1_swedish_ci
SELECT * FROM t1;
a
0
2
1
3
SELECT * FROM v1;
a
0
2
INSERT INTO v1 VALUES (10),(11);
ERROR HY000: Found a row not matching the given partition set
SELECT * from t1;
a
0
2
10
1
3
INSERT IGNORE INTO v1 VALUES (10),(11);
Warnings:
Warning	1748	Found a row not matching the given partition set
UPDATE IGNORE v1 SET a=11 WHERE a=2;
Warnings:
Warning	1748	Found a row not matching the given partition set
SELECT * FROM v1;
a
0
2
10
10
SELECT * from t1;
a
0
2
10
10
1
3
DROP TABLE t1;
DROP VIEW v1;
CREATE TABLE t1 (a int) ENGINE = MyISAM PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (2,5), PARTITION x2 VALUES IN (3));
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
INSERT INTO t1 VALUES (2), (3),(5);
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
INSERT INTO t1 VALUES (2),(4);
ERROR HY000: Table has no partition for value 4
INSERT IGNORE INTO t1 VALUES (2),(4);
Warnings:
Warning	1526	Table has no partition for value 4
SELECT * FROM t1;
a
2
5
2
2
3
UPDATE t1 SET a=a+1;
ERROR HY000: Table has no partition for value 6
UPDATE IGNORE t1 SET a=a+1;
Warnings:
Warning	1526	Table has no partition for value 6
Warning	1526	Table has no partition for value 4
Warning	1526	Table has no partition for value 4
SELECT * FROM t1;
a
5
3
3
3
3
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE = InnoDB;
CREATE TABLE t3 (c INT PRIMARY KEY, FOREIGN KEY(c) REFERENCES t2(b)) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1), (2), (5);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1), (2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
INSERT IGNORE INTO t3 VALUES (1), (2);
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE t3 SET c=2 where c=1;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE IGNORE t3 SET c=2 where c=1;
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
DELETE FROM t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
DELETE IGNORE FROM t1;
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
SELECT * FROM t1;
a
1
UPDATE t2 SET b=b+5;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
UPDATE IGNORE t2 SET b=b+5;
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
SELECT * FROM t2;
b
1
DROP TABLE t3,t2,t1;
CREATE TABLE t1 (a INT) ENGINE = MyISAM;
INSERT INTO t1 VALUES (1),(NULL),(2);
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
ALTER TABLE t1 CHANGE a a INT NOT NULL;
Warnings:
Warning	1265	Data truncated for column 'a' at row 2
SET sql_mode = default;
SELECT * FROM t1;
a
1
0
2
UPDATE IGNORE t1 SET a=NULL WHERE a=0;
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
1
0
2
DELETE FROM t1;
INSERT INTO t1 VALUES (NULL);
ERROR 23000: Column 'a' cannot be null
INSERT IGNORE INTO t1 VALUES (NULL);
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
0
INSERT IGNORE INTO t1 VALUES (NULL),(3);
Warnings:
Warning	1048	Column 'a' cannot be null
SELECT * FROM t1;
a
0
0
3
DROP TABLE t1;
CREATE TABLE t1(a INT, b INT) ENGINE = MyISAM;
CREATE TABLE t2(a INT, b INT NOT NULL) ENGINE = MyISAM;
INSERT INTO t1 VALUES(1, NULL),(2,NULL);
INSERT INTO t2 VALUES (1,3), (2,4);
UPDATE IGNORE t1,t2 SET t2.b=NULL;
Warnings:
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
UPDATE IGNORE t2,t1 SET t2.b=NULL;
Warnings:
Warning	1048	Column 'b' cannot be null
Warning	1048	Column 'b' cannot be null
DROP TABLE t1,t2;

#
# Part 6 : Miscellaneous Test cases
#

# This case checks that the number of warnings returned
# after multiupdate is correct.
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE = InnoDB;
CREATE TABLE t3 (c INT PRIMARY KEY) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1);
UPDATE IGNORE t1,t3 SET t1.a=5 where t1.a=t3.c;
affected rows: 0
info: Rows matched: 1  Changed: 0  Warnings: 1
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
UPDATE IGNORE t2,t3 SET t2.b=5 where t2.b=t3.c;
affected rows: 0
info: Rows matched: 1  Changed: 0  Warnings: 1
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
DROP TABLE t3,t2,t1;
# Test cases to increase Code Coverage
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t2 (b INT PRIMARY KEY) ENGINE = InnoDB;
CREATE TABLE t3 (c INT PRIMARY KEY, FOREIGN KEY(c) REFERENCES t2(b)) ENGINE = InnoDB;
INSERT INTO t1 VALUES(1),(2);
INSERT INTO t2 VALUES (3),(4);
INSERT INTO t3 VALUES(3),(4);
DELETE t1.*,t2.* FROM t1,t2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
DELETE IGNORE t1.*,t2.* FROM t1,t2;
Warnings:
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
Warning	1451	Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t3`, CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t2` (`b`))
SELECT * FROM t1;
a
SELECT * FROM t2;
b
3
4
DROP TABLE t3,t2,t1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(2) ON DUPLICATE KEY UPDATE b=b-1;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
INSERT IGNORE INTO t2 VALUES(2) ON DUPLICATE KEY UPDATE b=b-1;
Warnings:
Warning	1452	Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
DROP table t2,t1;
#
# Bug#14786621 ASSERTION FAILED: THD->IS_ERROR() || KILL:
#              FILESORT + DISCARDED TABLESPACE
#
CREATE TABLE t(a int) engine=innodb;
ALTER TABLE t DISCARD TABLESPACE;
DELETE IGNORE FROM t ;
ERROR HY000: Tablespace has been discarded for table 't'
DELETE IGNORE FROM t ORDER BY 0 + 1 ;
ERROR HY000: Tablespace has been discarded for table 't'
DROP TABLE t;
#
# BUG#18526888 - STRICT MODE DOES NOT APPLY TO MULTI DELETE STATEMENT
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(5);
CREATE TABLE t2(b int);
INSERT INTO t2 VALUES(7);
#
# STRICT MODE and IGNORE test case for DELETE
#
DELETE FROM t1 where a <=> ln(0);
ERROR 2201E: Invalid argument for logarithm
DELETE IGNORE FROM t1 where a <=> ln(0);
Warnings:
Warning	3020	Invalid argument for logarithm
SHOW WARNINGS;
Level	Code	Message
Warning	3020	Invalid argument for logarithm
#
# STRICT MODE and IGNORE test case for MULTI DELETE
# An error ER_INVALID_ARGUMENT_FOR_LOGARITHM is expected here.
#
DELETE t1, t2 FROM t1 INNER JOIN t2 WHERE t1.a <=> ln(0) AND t2.b <=> ln(0);
ERROR 2201E: Invalid argument for logarithm
# Warnings are expected here and works fine.
DELETE IGNORE t1, t2 FROM t1 INNER JOIN t2 WHERE t1.a <=> ln(0) AND t2.b <=> ln(0);
Warnings:
Warning	3020	Invalid argument for logarithm
SHOW WARNINGS;
Level	Code	Message
Warning	3020	Invalid argument for logarithm
# Clean-up
DROP TABLE t1,t2;
# Restore the orginal sql_mode
SET sql_mode= @org_mode;
#
# BUG 18662121 - ASSERT IN PROTOCOL::END_STATEMENT() IN LOAD DATA STATEMENT
#
SET sql_mode='STRICT_TRANS_TABLES';
Warnings:
Warning	3135	'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
CREATE TABLE t2 (a int default 0, b int primary key) engine=innodb;
INSERT INTO t2 VALUES (0, 17);
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t2 (a, @b) SET b= @b + 2;
ERROR 23000: Duplicate entry '17' for key 'PRIMARY'
DROP TABLE t2;
SET sql_mode= @org_mode;
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
#
# BUG#18662043 - ASSERT IN MY_OK() IN SQL_CMD_SIGNAL::EXECUTE
#
SET sql_mode='STRICT_TRANS_TABLES';
Warnings:
Warning	3135	'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
CREATE PROCEDURE p1()
BEGIN
# warning
DECLARE too_few_records CONDITION FOR SQLSTATE '01000';
SIGNAL too_few_records SET MYSQL_ERRNO = 1261;
END |
# This statement should pass with the fix.
CALL p1();
Warnings:
Warning	1261	Unhandled user-defined warning condition
# Clean-up
DROP PROCEDURE p1;
# Restore the orginal sql_mode
SET sql_mode= @org_mode;
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
#
# Bug #19873291 : MYSQL_EXECUTE_COMMAND(THD*): ASSERTION
#                 `THD->IS_ERROR() || THD->KILLED' FAILED
#
CREATE TABLE t1(a INT);
SET @org_safe_updates= @@sql_safe_updates;
SET SESSION sql_safe_updates=ON;
DELETE IGNORE FROM t1 WHERE a=1;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. 
DROP TABLE t1;
SET sql_safe_updates= @org_safe_updates;

Man Man