2
# test of already fixed bugs
5
drop table if exists t1,t2,t3,t4,t5,t6;
6
drop database if exists mysqltest;
10
# Insert causes warnings for no default values and corrupts tables
12
CREATE TABLE t1 (a varbinary(30) NOT NULL DEFAULT ' ',
13
b varbinary(1) NOT NULL DEFAULT ' ',
14
c varbinary(4) NOT NULL DEFAULT '0000',
28
q varbinary(30) NOT NULL DEFAULT ' ',
29
r varbinary(30) NOT NULL DEFAULT ' ',
31
t varbinary(4) NOT NULL DEFAULT ' ',
32
u varbinary(1) NOT NULL DEFAULT ' ',
33
v varbinary(30) NOT NULL DEFAULT ' ',
34
w varbinary(30) NOT NULL DEFAULT ' ',
36
y varbinary(5) NOT NULL DEFAULT ' ',
37
z varbinary(20) NOT NULL DEFAULT ' ',
38
a1 varbinary(30) NOT NULL DEFAULT ' ',
40
ENGINE=InnoDB DEFAULT COLLATE=utf8_bin;
42
INSERT into t1 (b) values ('1');
46
CREATE TEMPORARY TABLE t2 (a varbinary(30) NOT NULL DEFAULT ' ',
47
b varbinary(1) NOT NULL DEFAULT ' ',
48
c varbinary(4) NOT NULL DEFAULT '0000',
62
q varbinary(30) NOT NULL DEFAULT ' ',
63
r varbinary(30) NOT NULL DEFAULT ' ',
65
t varbinary(4) NOT NULL DEFAULT ' ',
66
u varbinary(1) NOT NULL DEFAULT ' ',
67
v varbinary(30) NOT NULL DEFAULT ' ',
68
w varbinary(30) NOT NULL DEFAULT ' ',
70
y varbinary(5) NOT NULL DEFAULT ' ',
71
z varbinary(20) NOT NULL DEFAULT ' ',
72
a1 varbinary(30) NOT NULL DEFAULT ' ',
74
ENGINE=MyISAM DEFAULT COLLATE=utf8_bin;
77
INSERT into t2 (b) values ('1');
86
# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT
89
# If the column can take NULL as a value, the column is defined with an
90
# explicit DEFAULT NULL clause. This is the same as before 5.0.2.
92
# If the column cannot take NULL as the value, MySQL defines the column with
93
# no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE
94
# statement includes no value for the column, MySQL handles the column
95
# according to the SQL mode in effect at the time:
97
# * If strict SQL mode is not enabled, MySQL sets the column to the
98
# implicit default value for the column data type.
100
# * If strict mode is enabled, an error occurs for transactional tables and
101
# the statement is rolled back. For non-transactional tables, an error
102
# occurs, but if this happens for the second or subsequent row of a
103
# multiple-row statement, the preceding rows will have been inserted.
105
create table bug20691 (i int, d datetime NOT NULL, dn datetime NULL);
106
--error ER_NO_DEFAULT_FOR_FIELD
107
insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
108
insert into bug20691 values (7, '1975-07-10 07:10:03', DEFAULT);
109
select * from bug20691 order by i asc;
112
create table bug20691 (
113
b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
120
insert into bug20691 values (3, '0007-01-01', 11, 17, '0019-01-01 00:00:00', 23, 1);
121
--error ER_NO_DEFAULT_FOR_FIELD
122
insert into bug20691 (x) values (2);
123
insert into bug20691 values (3, '0007-01-01', 11, 17, '0019-01-01 00:00:00', 23, 3);
124
--error ER_NO_DEFAULT_FOR_FIELD
125
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
126
select * from bug20691 order by x asc;
129
create table t1 (id int not null default 1);
130
insert into t1 values(default);