1
drop table if exists t1,t2,t3,t4,t5,t6;
2
drop database if exists mysqltest;
3
CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
4
b varchar(1) binary NOT NULL DEFAULT ' ',
5
c varchar(4) binary NOT NULL DEFAULT '0000',
19
q varchar(30) binary NOT NULL DEFAULT ' ',
20
r varchar(30) binary NOT NULL DEFAULT ' ',
22
t varchar(4) binary NOT NULL DEFAULT ' ',
23
u varchar(1) binary NOT NULL DEFAULT ' ',
24
v varchar(30) binary NOT NULL DEFAULT ' ',
25
w varchar(30) binary NOT NULL DEFAULT ' ',
27
y varchar(5) binary NOT NULL DEFAULT ' ',
28
z varchar(20) binary NOT NULL DEFAULT ' ',
29
a1 varchar(30) binary NOT NULL DEFAULT ' ',
31
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
32
INSERT into t1 (b) values ('1');
36
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
37
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
38
CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ',
39
b varchar(1) binary NOT NULL DEFAULT ' ',
40
c varchar(4) binary NOT NULL DEFAULT '0000',
54
q varchar(30) binary NOT NULL DEFAULT ' ',
55
r varchar(30) binary NOT NULL DEFAULT ' ',
57
t varchar(4) binary NOT NULL DEFAULT ' ',
58
u varchar(1) binary NOT NULL DEFAULT ' ',
59
v varchar(30) binary NOT NULL DEFAULT ' ',
60
w varchar(30) binary NOT NULL DEFAULT ' ',
62
y varchar(5) binary NOT NULL DEFAULT ' ',
63
z varchar(20) binary NOT NULL DEFAULT ' ',
64
a1 varchar(30) binary NOT NULL DEFAULT ' ',
66
ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
69
t2 CREATE TABLE `t2` (
70
`a` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
71
`b` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
72
`c` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT '0000',
86
`q` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
87
`r` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
89
`t` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT ' ',
90
`u` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
91
`v` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
92
`w` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
94
`y` varchar(5) COLLATE latin1_bin NOT NULL DEFAULT ' ',
95
`z` varchar(20) COLLATE latin1_bin NOT NULL DEFAULT ' ',
96
`a1` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
98
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
99
INSERT into t2 (b) values ('1');
103
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
104
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
107
create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
108
insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
110
Warning 1364 Field 'd' doesn't have a default value
111
Warning 1364 Field 'd' doesn't have a default value
112
insert into bug20691 (i) values (2);
114
Warning 1364 Field 'd' doesn't have a default value
116
Field Type Null Key Default Extra
119
dn datetime NO 0000-00-00 00:00:00
120
insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
122
Warning 1364 Field 'd' doesn't have a default value
123
Warning 1364 Field 'd' doesn't have a default value
124
insert into bug20691 (i) values (4);
126
Warning 1364 Field 'd' doesn't have a default value
127
insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
129
Warning 1364 Field 'd' doesn't have a default value
130
Warning 1364 Field 'd' doesn't have a default value
131
SET sql_mode = 'ALLOW_INVALID_DATES';
132
insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
134
Warning 1364 Field 'd' doesn't have a default value
135
Warning 1364 Field 'd' doesn't have a default value
136
SET sql_mode = 'STRICT_ALL_TABLES';
137
insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
138
ERROR HY000: Field 'd' doesn't have a default value
139
select * from bug20691 order by i asc;
141
1 0000-00-00 00:00:00 0000-00-00 00:00:00
142
1 1975-07-10 07:10:03 1978-01-13 14:08:51
143
1 0000-00-00 00:00:00 0000-00-00 00:00:00
144
2 0000-00-00 00:00:00 0000-00-00 00:00:00
145
3 0000-00-00 00:00:00 0000-00-00 00:00:00
146
3 1975-07-10 07:10:03 1978-01-13 14:08:51
147
3 0000-00-00 00:00:00 0000-00-00 00:00:00
148
4 0000-00-00 00:00:00 0000-00-00 00:00:00
149
5 0000-00-00 00:00:00 0000-00-00 00:00:00
150
5 1975-07-10 07:10:03 1978-01-13 14:08:51
151
5 0000-00-00 00:00:00 0000-00-00 00:00:00
152
6 0000-00-00 00:00:00 0000-00-00 00:00:00
153
6 1975-07-10 07:10:03 1978-01-13 14:08:51
154
6 0000-00-00 00:00:00 0000-00-00 00:00:00
157
create table bug20691 (
158
a set('one', 'two', 'three') not null,
159
b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
168
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
169
insert into bug20691 (x) values (2);
171
Warning 1364 Field 'a' doesn't have a default value
172
Warning 1364 Field 'c' doesn't have a default value
173
Warning 1364 Field 'd' doesn't have a default value
174
Warning 1364 Field 'e' doesn't have a default value
175
Warning 1364 Field 'f' doesn't have a default value
176
Warning 1364 Field 'g' doesn't have a default value
177
Warning 1364 Field 'h' doesn't have a default value
178
Warning 1364 Field 'i' doesn't have a default value
179
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
180
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
182
Warning 1364 Field 'a' doesn't have a default value
183
Warning 1364 Field 'b' doesn't have a default value
184
Warning 1364 Field 'c' doesn't have a default value
185
Warning 1364 Field 'd' doesn't have a default value
186
Warning 1364 Field 'e' doesn't have a default value
187
Warning 1364 Field 'f' doesn't have a default value
188
Warning 1364 Field 'g' doesn't have a default value
189
Warning 1364 Field 'h' doesn't have a default value
190
Warning 1364 Field 'i' doesn't have a default value
191
select * from bug20691 order by x asc;
193
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
194
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
195
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
196
00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
198
create table t1 (id int not null);
199
insert into t1 values(default);
201
Warning 1364 Field 'id' doesn't have a default value
202
create view v1 (c) as select id from t1;
203
insert into t1 values(default);
205
Warning 1364 Field 'id' doesn't have a default value