summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-06-25 14:52:38 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-06-25 14:52:38 +0530
commit88aaf590ac9fa8c8030a5831cebd867a7f35478f (patch)
tree98292a41dce622c8f7de750c067ac87ea6613e98 /mysql-test
parent1abd877e2df9e83bc1c2f5195796f427a35bd3f1 (diff)
downloadmariadb-git-88aaf590ac9fa8c8030a5831cebd867a7f35478f.tar.gz
MDEV-16365 Setting a column NOT NULL fails to return error for
NULL values when there is no DEFAULT Copy and inplace algorithm works similarly for NULL to NOT NULL conversion for the following cases: (1) strict sql mode - Should give error. (2) non-strict sql mode - Should give warnings alone (3) alter ignore table command. - Should give warnings alone.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/selectivity_innodb.result1
-rw-r--r--mysql-test/main/statistics.result10
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_innodb.result4
-rw-r--r--mysql-test/suite/innodb/include/alter_non_null.inc71
-rw-r--r--mysql-test/suite/innodb/include/alter_non_null_debug.inc63
-rw-r--r--mysql-test/suite/innodb/r/alter_non_null,COPY,NON-STRICT.rdiff42
-rw-r--r--mysql-test/suite/innodb/r/alter_non_null,COPY,STRICT.rdiff72
-rw-r--r--mysql-test/suite/innodb/r/alter_non_null,INPLACE,STRICT.rdiff66
-rw-r--r--mysql-test/suite/innodb/r/alter_non_null.result95
-rw-r--r--mysql-test/suite/innodb/r/alter_non_null_debug,STRICT.rdiff15
-rw-r--r--mysql-test/suite/innodb/r/alter_non_null_debug.result78
-rw-r--r--mysql-test/suite/innodb/r/alter_not_null.result74
-rw-r--r--mysql-test/suite/innodb/r/alter_not_null_debug.result68
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-timestamp.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb-table-online.result4
-rw-r--r--mysql-test/suite/innodb/t/alter_non_null.combinations5
-rw-r--r--mysql-test/suite/innodb/t/alter_non_null.inc2
-rw-r--r--mysql-test/suite/innodb/t/alter_non_null.test10
-rw-r--r--mysql-test/suite/innodb/t/alter_non_null_debug.test10
-rw-r--r--mysql-test/suite/innodb/t/alter_not_null.test56
-rw-r--r--mysql-test/suite/innodb/t/alter_not_null_debug.test68
-rw-r--r--mysql-test/suite/innodb/t/alter_sql_mode.combinations5
-rw-r--r--mysql-test/suite/innodb/t/alter_sql_mode.inc2
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-timestamp.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-table-online.test4
25 files changed, 562 insertions, 275 deletions
diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result
index 236647c6091..332cc947a6b 100644
--- a/mysql-test/main/selectivity_innodb.result
+++ b/mysql-test/main/selectivity_innodb.result
@@ -1150,6 +1150,7 @@ alter table t1 change column a a int;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t1 analyze status OK
flush table t1;
explain extended select * from t1 where a between 5 and 7;
diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result
index 8f87b166e8d..b710bc0e51a 100644
--- a/mysql-test/main/statistics.result
+++ b/mysql-test/main/statistics.result
@@ -1086,6 +1086,9 @@ test t2 idx4 3 1.1304
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -1146,6 +1149,11 @@ test t2 idx4 4 1.0000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze Note Data truncated for column 'avg_length' at row 1
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -1171,6 +1179,8 @@ test t2 idx3 1 8.5000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
+test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
index fadbb3b8031..577b3255620 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
@@ -691,9 +691,13 @@ a b c
1 127 0
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
ALTER TABLE t ADD UNIQUE INDEX (c(1));
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
SELECT * FROM t WHERE c = '0';
a b c
1 127 0
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
DROP TABLE t;
#
# Bug#21688115 VIRTUAL COLUMN COMPUTATION SAVE_IN_FIELD()
diff --git a/mysql-test/suite/innodb/include/alter_non_null.inc b/mysql-test/suite/innodb/include/alter_non_null.inc
new file mode 100644
index 00000000000..8acecfb08dc
--- /dev/null
+++ b/mysql-test/suite/innodb/include/alter_non_null.inc
@@ -0,0 +1,71 @@
+--source include/have_innodb.inc
+
+CREATE TABLE t1(f1 INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 TEXT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc';
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(2, 2, NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2);
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(10, NULL);
+SELECT * FROM t1;
+--enable_info
+--error $error_code
+ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Alter ignore should work irrespective of sql mode
+
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, NULL);
+--enable_info
+ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/include/alter_non_null_debug.inc b/mysql-test/suite/innodb/include/alter_non_null_debug.inc
new file mode 100644
index 00000000000..f5989391723
--- /dev/null
+++ b/mysql-test/suite/innodb/include/alter_non_null_debug.inc
@@ -0,0 +1,63 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+# Alter table should fail for strict sql mode
+
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 1);
+--enable_info
+SET DEBUG_SYNC= 'row_merge_after_scan
+SIGNAL opened WAIT_FOR flushed';
+send ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+connect (con1,localhost,root);
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+INSERT INTO t1 VALUES(2, NULL);
+UPDATE t1 SET c1 = 3 WHERE c2 = 1;
+SET DEBUG_SYNC= 'now SIGNAL flushed';
+connection default;
+--error $error_code
+reap;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Alter table should successfully apply the log for the alter operation
+
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 1);
+--enable_info
+SET DEBUG_SYNC= 'row_merge_after_scan
+SIGNAL opened WAIT_FOR flushed';
+send ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+connection con1;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+INSERT INTO t1 VALUES(2, 3);
+UPDATE t1 SET c1 = 3 WHERE c2 = 1;
+SET DEBUG_SYNC= 'now SIGNAL flushed';
+connection default;
+reap;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Alter ignore should not give error
+
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, c3 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 2, 3);
+--enable_info
+SET DEBUG_SYNC= 'row_merge_after_scan
+SIGNAL opened WAIT_FOR flushed';
+send ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+connection con1;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+UPDATE t1 SET c2= 2 WHERE c1 = 1;
+INSERT INTO t1 VALUES (2, NULL, 4);
+SET DEBUG_SYNC= 'now SIGNAL flushed';
+connection default;
+reap;
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+disconnect con1;
+SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/suite/innodb/r/alter_non_null,COPY,NON-STRICT.rdiff b/mysql-test/suite/innodb/r/alter_non_null,COPY,NON-STRICT.rdiff
new file mode 100644
index 00000000000..ee1ee3fd8d7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_non_null,COPY,NON-STRICT.rdiff
@@ -0,0 +1,42 @@
+7,8c7,8
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
+21,22c21,22
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
+35,36c35,36
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
+49,50c49,50
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
+63,64c63,64
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
+77,78c77,78
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
+88,89c88,89
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
diff --git a/mysql-test/suite/innodb/r/alter_non_null,COPY,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_non_null,COPY,STRICT.rdiff
new file mode 100644
index 00000000000..d8094c4d2be
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_non_null,COPY,STRICT.rdiff
@@ -0,0 +1,72 @@
+7,10c7
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+13c10
+< 0
+---
+> NULL
+21,24c18
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+27c21
+<
+---
+> NULL
+35,38c29
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+41c32
+<
+---
+> NULL
+49,52c40
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+55c43
+<
+---
+> NULL
+63,66c51
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f3' at row 1
+---
+> ERROR 01000: Data truncated for column 'f3' at row 1
+69c54
+< 2 2 0
+---
+> 2 2 NULL
+77,80c62
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'b' at row 1
+---
+> ERROR 01000: Data truncated for column 'b' at row 1
+83c65
+< 10 0
+---
+> 10 NULL
+88,89c70,71
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+---
+> affected rows: 1
+> info: Records: 1 Duplicates: 0 Warnings: 1
diff --git a/mysql-test/suite/innodb/r/alter_non_null,INPLACE,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_non_null,INPLACE,STRICT.rdiff
new file mode 100644
index 00000000000..ec97b174bdf
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_non_null,INPLACE,STRICT.rdiff
@@ -0,0 +1,66 @@
+7,10c7
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+13c10
+< 0
+---
+> NULL
+21,24c18
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+27c21
+<
+---
+> NULL
+35,38c29
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+41c32
+<
+---
+> NULL
+49,52c40
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f1' at row 1
+---
+> ERROR 01000: Data truncated for column 'f1' at row 1
+55c43
+<
+---
+> NULL
+63,66c51
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'f3' at row 1
+---
+> ERROR 01000: Data truncated for column 'f3' at row 1
+69c54
+< 2 2 0
+---
+> 2 2 NULL
+77,80c62
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'b' at row 1
+---
+> ERROR 01000: Data truncated for column 'b' at row 1
+83c65
+< 10 0
+---
+> 10 NULL
diff --git a/mysql-test/suite/innodb/r/alter_non_null.result b/mysql-test/suite/innodb/r/alter_non_null.result
new file mode 100644
index 00000000000..15ea6a38b5b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_non_null.result
@@ -0,0 +1,95 @@
+CREATE TABLE t1(f1 INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+f1
+NULL
+ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+SELECT * FROM t1;
+f1
+0
+DROP TABLE t1;
+CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+f1
+NULL
+ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+SELECT * FROM t1;
+f1
+
+DROP TABLE t1;
+CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+f1
+NULL
+ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+SELECT * FROM t1;
+f1
+
+DROP TABLE t1;
+CREATE TABLE t1(f1 TEXT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+f1
+NULL
+ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc';
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+SELECT * FROM t1;
+f1
+
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(2, 2, NULL);
+SELECT * FROM t1;
+f1 f2 f3
+2 2 NULL
+ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2);
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'f3' at row 1
+SELECT * FROM t1;
+f1 f2 f3
+2 2 0
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(10, NULL);
+SELECT * FROM t1;
+f1 b
+10 NULL
+ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 1
+SELECT * FROM t1;
+f1 b
+10 0
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, NULL);
+ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 1
+SELECT * FROM t1;
+c1 c2
+1 0
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/alter_non_null_debug,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_non_null_debug,STRICT.rdiff
new file mode 100644
index 00000000000..2865c5d7f71
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_non_null_debug,STRICT.rdiff
@@ -0,0 +1,15 @@
+18,21c18
+< affected rows: 0
+< info: Records: 0 Duplicates: 0 Warnings: 1
+< Warnings:
+< Warning 1265 Data truncated for column 'c2' at row 3
+---
+> ERROR 01000: Data truncated for column 'c2' at row 3
+24c21
+< 2 0
+---
+> 2 NULL
+71c68
+< Warning 1265 Data truncated for column 'c2' at row 7
+---
+> Warning 1265 Data truncated for column 'c2' at row 6
diff --git a/mysql-test/suite/innodb/r/alter_non_null_debug.result b/mysql-test/suite/innodb/r/alter_non_null_debug.result
new file mode 100644
index 00000000000..e4c42241f5d
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_non_null_debug.result
@@ -0,0 +1,78 @@
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 1);
+SET DEBUG_SYNC= 'row_merge_after_scan
+SIGNAL opened WAIT_FOR flushed';
+affected rows: 0
+ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+connect con1,localhost,root;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+affected rows: 0
+INSERT INTO t1 VALUES(2, NULL);
+affected rows: 1
+UPDATE t1 SET c1 = 3 WHERE c2 = 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+SET DEBUG_SYNC= 'now SIGNAL flushed';
+affected rows: 0
+connection default;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 3
+SELECT * FROM t1;
+c1 c2
+2 0
+3 1
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 1);
+SET DEBUG_SYNC= 'row_merge_after_scan
+SIGNAL opened WAIT_FOR flushed';
+affected rows: 0
+ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+connection con1;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+affected rows: 0
+INSERT INTO t1 VALUES(2, 3);
+affected rows: 1
+UPDATE t1 SET c1 = 3 WHERE c2 = 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+SET DEBUG_SYNC= 'now SIGNAL flushed';
+affected rows: 0
+connection default;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+SELECT * FROM t1;
+c1 c2
+2 3
+3 1
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT, c3 INT, PRIMARY KEY(c1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 2, 3);
+SET DEBUG_SYNC= 'row_merge_after_scan
+SIGNAL opened WAIT_FOR flushed';
+affected rows: 0
+ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2;
+connection con1;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+affected rows: 0
+UPDATE t1 SET c2= 2 WHERE c1 = 1;
+affected rows: 0
+info: Rows matched: 1 Changed: 0 Warnings: 0
+INSERT INTO t1 VALUES (2, NULL, 4);
+affected rows: 1
+SET DEBUG_SYNC= 'now SIGNAL flushed';
+affected rows: 0
+connection default;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'c2' at row 7
+SELECT * FROM t1;
+c1 c2 c3
+1 2 3
+2 0 4
+DROP TABLE t1;
+disconnect con1;
+SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/suite/innodb/r/alter_not_null.result b/mysql-test/suite/innodb/r/alter_not_null.result
index 8380378593d..aab9ffa0592 100644
--- a/mysql-test/suite/innodb/r/alter_not_null.result
+++ b/mysql-test/suite/innodb/r/alter_not_null.result
@@ -1,78 +1,4 @@
set @@sql_mode = 'STRICT_TRANS_TABLES';
-CREATE TABLE t1(f1 INT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
-f1
-NULL
-ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-SELECT * FROM t1;
-f1
-0
-DROP TABLE t1;
-CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
-f1
-NULL
-ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-SELECT * FROM t1;
-f1
-
-DROP TABLE t1;
-CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
-f1
-NULL
-ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-SELECT * FROM t1;
-f1
-
-DROP TABLE t1;
-CREATE TABLE t1(f1 TEXT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
-f1
-NULL
-ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc';
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
-SELECT * FROM t1;
-f1
-abc
-DROP TABLE t1;
-CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(2, 2, NULL);
-SELECT * FROM t1;
-f1 f2 f3
-2 2 NULL
-ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2), ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: cannot convert NULL to non-constant DEFAULT. Try ALGORITHM=COPY
-UPDATE t1 SET f3 = 0;
-SELECT * FROM t1;
-f1 f2 f3
-2 2 0
-ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2);
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
-SELECT * FROM t1;
-f1 f2 f3
-2 2 0
-DROP TABLE t1;
-CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB;
-INSERT INTO t1 VALUES(10, NULL);
-SELECT * FROM t1;
-f1 b
-10 NULL
-ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), algorithm=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: cannot convert NULL to non-constant DEFAULT. Try ALGORITHM=COPY
-DROP TABLE t1;
CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/alter_not_null_debug.result b/mysql-test/suite/innodb/r/alter_not_null_debug.result
deleted file mode 100644
index 788eef6420b..00000000000
--- a/mysql-test/suite/innodb/r/alter_not_null_debug.result
+++ /dev/null
@@ -1,68 +0,0 @@
-CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
-INSERT INTO t1 VALUES(1, NULL);
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
-ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-connect con1,localhost,root;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-INSERT INTO t1 VALUES(2, NULL);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
-ERROR 22004: Invalid use of NULL value
-SELECT * FROM t1;
-c1 c2
-1 NULL
-2 NULL
-UPDATE t1 SET c2 = 0 WHERE c1 = 2;
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
-# Alter ignore can convert the NULL values from
-# CONCURRENT DML to constants
-ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-connection con1;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-UPDATE t1 SET c2 = NULL WHERE c1 = 2;
-INSERT INTO t1 VALUES (3, NULL);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
-SELECT * FROM t1;
-c1 c2
-1 2
-2 2
-3 2
-DROP TABLE t1;
-CREATE TABLE t1(c1 INT NOT NULL, c2 INT, c3 INT, PRIMARY KEY(c1))ENGINE=INNODB;
-INSERT INTO t1 VALUES(1, NULL, NULL);
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
-# Alter Successfully converts from null to not null
-ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-connection con1;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-UPDATE t1 SET c2= 2 WHERE c1 = 1;
-INSERT INTO t1 VALUES (2, 3, 4);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
-SELECT * FROM t1;
-c1 c2 c3
-1 2 NULL
-2 3 4
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
-# Alter fails because concurrent dml inserts null value
-ALTER TABLE t1 CHANGE c3 c3 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-connection con1;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-UPDATE t1 SET c3= 2 WHERE c1 = 2;
-INSERT INTO t1 VALUES (4, 3, NULL);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
-ERROR 22004: Invalid use of NULL value
-SELECT * FROM t1;
-c1 c2 c3
-1 2 NULL
-2 3 2
-4 3 NULL
-DROP TABLE t1;
-disconnect con1;
-SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/suite/innodb/r/innodb-alter-timestamp.result b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result
index b8686d6812e..d4c0aa6a50e 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-timestamp.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-timestamp.result
@@ -2,16 +2,18 @@ CREATE TABLE t1 (i1 INT UNSIGNED NULL DEFAULT 42) ENGINE=innodb;
INSERT INTO t1 VALUES(NULL);
ALTER TABLE t1 CHANGE i1 i1 INT UNSIGNED NOT NULL DEFAULT rand(),
ALGORITHM=INPLACE;
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: cannot convert NULL to non-constant DEFAULT. Try ALGORITHM=COPY
+ERROR 01000: Data truncated for column 'i1' at row 1
ALTER TABLE t1 CHANGE i1 i1 INT UNSIGNED NOT NULL DEFAULT rand(),
ALGORITHM=COPY;
ERROR 01000: Data truncated for column 'i1' at row 1
ALTER TABLE t1 CHANGE i1 id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ADD PRIMARY KEY(id), ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY
-ALTER TABLE t1 ADD PRIMARY KEY(i1), ALGORITHM=INPLACE;
+ALTER IGNORE TABLE t1 ADD PRIMARY KEY(i1), ALGORITHM=INPLACE;
affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1265 Data truncated for column 'i1' at row 1
ALTER TABLE t1 CHANGE i1 id INT UNSIGNED NOT NULL AUTO_INCREMENT;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result
index d8482ebb23a..dc7e7e4538f 100644
--- a/mysql-test/suite/innodb/r/innodb-table-online.result
+++ b/mysql-test/suite/innodb/r/innodb-table-online.result
@@ -409,7 +409,7 @@ ALTER TABLE t1 DROP COLUMN c22f, ADD PRIMARY KEY c3p5(c3(5));
ERROR 42000: Key column 'c22f' doesn't exist in table
SET @old_sql_mode = @@sql_mode;
SET @@sql_mode = 'STRICT_TRANS_TABLES';
-ALTER TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
+ALTER IGNORE TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
ALGORITHM = INPLACE;
ERROR 23000: Duplicate entry '' for key 'PRIMARY'
SET @@sql_mode = @old_sql_mode;
@@ -428,7 +428,7 @@ INSERT INTO t1 VALUES(33101,347,NULL,'');
SET DEBUG_SYNC = 'now SIGNAL ins_done0';
# session con1
connection con1;
-ERROR 22004: Invalid use of NULL value
+ERROR 01000: Data truncated for column 'c3' at row 1
SET @@sql_mode = @old_sql_mode;
# session default
connection default;
diff --git a/mysql-test/suite/innodb/t/alter_non_null.combinations b/mysql-test/suite/innodb/t/alter_non_null.combinations
new file mode 100644
index 00000000000..815223ce1cb
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_non_null.combinations
@@ -0,0 +1,5 @@
+[COPY]
+--alter_algorithm=copy
+
+[INPLACE]
+--alter_algorithm=inplace
diff --git a/mysql-test/suite/innodb/t/alter_non_null.inc b/mysql-test/suite/innodb/t/alter_non_null.inc
new file mode 100644
index 00000000000..3d26aab5ab1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_non_null.inc
@@ -0,0 +1,2 @@
+# See also alter_non_null.combinations
+--source include/have_innodb.inc
diff --git a/mysql-test/suite/innodb/t/alter_non_null.test b/mysql-test/suite/innodb/t/alter_non_null.test
new file mode 100644
index 00000000000..bfa159922b4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_non_null.test
@@ -0,0 +1,10 @@
+--source alter_sql_mode.inc
+
+let $sql_mode = `SELECT @@SQL_MODE`;
+let $error_code = 0;
+
+if ($sql_mode == "STRICT_TRANS_TABLES") {
+ let $error_code = WARN_DATA_TRUNCATED;
+}
+
+--source include/alter_non_null.inc
diff --git a/mysql-test/suite/innodb/t/alter_non_null_debug.test b/mysql-test/suite/innodb/t/alter_non_null_debug.test
new file mode 100644
index 00000000000..8bfa7a4bee4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_non_null_debug.test
@@ -0,0 +1,10 @@
+--source alter_sql_mode.inc
+
+let $sql_mode = `SELECT @@SQL_MODE`;
+let $error_code = 0;
+
+if ($sql_mode == "STRICT_TRANS_TABLES") {
+ let $error_code = WARN_DATA_TRUNCATED;
+}
+
+--source include/alter_non_null_debug.inc
diff --git a/mysql-test/suite/innodb/t/alter_not_null.test b/mysql-test/suite/innodb/t/alter_not_null.test
index f4606dfa6c5..696df34df68 100644
--- a/mysql-test/suite/innodb/t/alter_not_null.test
+++ b/mysql-test/suite/innodb/t/alter_not_null.test
@@ -1,62 +1,6 @@
--source include/have_innodb.inc
set @@sql_mode = 'STRICT_TRANS_TABLES';
-CREATE TABLE t1(f1 INT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
-ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL;
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
-ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL;
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
-ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL;
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 TEXT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(NULL);
-SELECT * FROM t1;
---enable_info
-ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc';
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB;
-INSERT INTO t1 VALUES(2, 2, NULL);
-SELECT * FROM t1;
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2), ALGORITHM=INPLACE;
-UPDATE t1 SET f3 = 0;
-SELECT * FROM t1;
---enable_info
-ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2);
---disable_info
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB;
-INSERT INTO t1 VALUES(10, NULL);
-SELECT * FROM t1;
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), algorithm=INPLACE;
-DROP TABLE t1;
-
CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/alter_not_null_debug.test b/mysql-test/suite/innodb/t/alter_not_null_debug.test
deleted file mode 100644
index 9c1500dc829..00000000000
--- a/mysql-test/suite/innodb/t/alter_not_null_debug.test
+++ /dev/null
@@ -1,68 +0,0 @@
---source include/have_innodb.inc
---source include/have_debug.inc
---source include/have_debug_sync.inc
-
-CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB;
-INSERT INTO t1 VALUES(1, NULL);
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
-send ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-connect (con1,localhost,root);
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-INSERT INTO t1 VALUES(2, NULL);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
---error ER_INVALID_USE_OF_NULL
-reap;
-SELECT * FROM t1;
-UPDATE t1 SET c2 = 0 WHERE c1 = 2;
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
---echo # Alter ignore can convert the NULL values from
---echo # CONCURRENT DML to constants
-send ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-connection con1;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-UPDATE t1 SET c2 = NULL WHERE c1 = 2;
-INSERT INTO t1 VALUES (3, NULL);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
-reap;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1(c1 INT NOT NULL, c2 INT, c3 INT, PRIMARY KEY(c1))ENGINE=INNODB;
-INSERT INTO t1 VALUES(1, NULL, NULL);
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
---echo # Alter Successfully converts from null to not null
-
-send ALTER TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-
-connection con1;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-UPDATE t1 SET c2= 2 WHERE c1 = 1;
-INSERT INTO t1 VALUES (2, 3, 4);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
-reap;
-SELECT * FROM t1;
-
-SET DEBUG_SYNC= 'row_merge_after_scan
-SIGNAL opened WAIT_FOR flushed';
---echo # Alter fails because concurrent dml inserts null value
-
-send ALTER TABLE t1 CHANGE c3 c3 INT NOT NULL DEFAULT 2, ALGORITHM=INPLACE;
-connection con1;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-UPDATE t1 SET c3= 2 WHERE c1 = 2;
-INSERT INTO t1 VALUES (4, 3, NULL);
-SET DEBUG_SYNC= 'now SIGNAL flushed';
-connection default;
---error ER_INVALID_USE_OF_NULL
-reap;
-SELECT * FROM t1;
-DROP TABLE t1;
-disconnect con1;
-SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/suite/innodb/t/alter_sql_mode.combinations b/mysql-test/suite/innodb/t/alter_sql_mode.combinations
new file mode 100644
index 00000000000..2749bd1077c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_sql_mode.combinations
@@ -0,0 +1,5 @@
+[STRICT]
+--sql_mode=STRICT_TRANS_TABLES
+
+[NON-STRICT]
+--sql_mode=
diff --git a/mysql-test/suite/innodb/t/alter_sql_mode.inc b/mysql-test/suite/innodb/t/alter_sql_mode.inc
new file mode 100644
index 00000000000..d51208502a7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_sql_mode.inc
@@ -0,0 +1,2 @@
+# See also alter_sql_mode.combinations
+--source include/have_innodb.inc
diff --git a/mysql-test/suite/innodb/t/innodb-alter-timestamp.test b/mysql-test/suite/innodb/t/innodb-alter-timestamp.test
index 32a54354016..8b56fb5be5d 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-timestamp.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-timestamp.test
@@ -3,7 +3,7 @@
CREATE TABLE t1 (i1 INT UNSIGNED NULL DEFAULT 42) ENGINE=innodb;
INSERT INTO t1 VALUES(NULL);
--enable_info
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+--error WARN_DATA_TRUNCATED
ALTER TABLE t1 CHANGE i1 i1 INT UNSIGNED NOT NULL DEFAULT rand(),
ALGORITHM=INPLACE;
--error WARN_DATA_TRUNCATED
@@ -12,7 +12,7 @@ ALGORITHM=COPY;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE i1 id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ADD PRIMARY KEY(id), ALGORITHM=INPLACE;
-ALTER TABLE t1 ADD PRIMARY KEY(i1), ALGORITHM=INPLACE;
+ALTER IGNORE TABLE t1 ADD PRIMARY KEY(i1), ALGORITHM=INPLACE;
ALTER TABLE t1 CHANGE i1 id INT UNSIGNED NOT NULL AUTO_INCREMENT;
--disable_info
SELECT * FROM t1;
diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test
index 538e4b68762..edf83247142 100644
--- a/mysql-test/suite/innodb/t/innodb-table-online.test
+++ b/mysql-test/suite/innodb/t/innodb-table-online.test
@@ -359,7 +359,7 @@ SET @old_sql_mode = @@sql_mode;
# And adding a PRIMARY KEY will also add NOT NULL implicitly!
SET @@sql_mode = 'STRICT_TRANS_TABLES';
--error ER_DUP_ENTRY
-ALTER TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
+ALTER IGNORE TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
ALGORITHM = INPLACE;
SET @@sql_mode = @old_sql_mode;
@@ -384,7 +384,7 @@ SET DEBUG_SYNC = 'now SIGNAL ins_done0';
--echo # session con1
connection con1;
---error ER_INVALID_USE_OF_NULL
+--error WARN_DATA_TRUNCATED
reap;
SET @@sql_mode = @old_sql_mode;