1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
--- alter_not_null.result
+++ alter_not_null,COPY,STRICT.result~
@@ -4,13 +4,10 @@
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
+ERROR 01000: Data truncated for column 'f1' at row 1
SELECT * FROM t1;
f1
-0
+NULL
DROP TABLE t1;
CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB;
INSERT INTO t1 VALUES(NULL);
@@ -18,13 +15,10 @@
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
+ERROR 01000: Data truncated for column 'f1' at row 1
SELECT * FROM t1;
f1
-
+NULL
DROP TABLE t1;
CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB;
INSERT INTO t1 VALUES(NULL);
@@ -32,13 +26,10 @@
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
+ERROR 01000: Data truncated for column 'f1' at row 1
SELECT * FROM t1;
f1
-
+NULL
DROP TABLE t1;
CREATE TABLE t1(f1 TEXT)ENGINE=INNODB;
INSERT INTO t1 VALUES(NULL);
@@ -46,13 +37,10 @@
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
+ERROR 01000: Data truncated for column 'f1' at row 1
SELECT * FROM t1;
f1
-
+NULL
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);
@@ -60,13 +48,10 @@
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
+ERROR 01000: Data truncated for column 'f3' at row 1
SELECT * FROM t1;
f1 f2 f3
-2 2 0
+2 2 NULL
DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(10, NULL);
@@ -74,13 +59,10 @@
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
+ERROR 01000: Data truncated for column 'b' at row 1
SELECT * FROM t1;
f1 b
-10 0
+10 NULL
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;
@@ -95,8 +77,8 @@
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
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c2' at row 1
SELECT * FROM t1;
|