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 varchar(30) binary NOT NULL DEFAULT ' ',
13
b varchar(1) binary NOT NULL DEFAULT ' ',
14
c varchar(4) binary NOT NULL DEFAULT '0000',
28
q varchar(30) binary NOT NULL DEFAULT ' ',
29
r varchar(30) binary NOT NULL DEFAULT ' ',
31
t varchar(4) binary NOT NULL DEFAULT ' ',
32
u varchar(1) binary NOT NULL DEFAULT ' ',
33
v varchar(30) binary NOT NULL DEFAULT ' ',
34
w varchar(30) binary NOT NULL DEFAULT ' ',
36
y varchar(5) binary NOT NULL DEFAULT ' ',
37
z varchar(20) binary NOT NULL DEFAULT ' ',
38
a1 varchar(30) binary NOT NULL DEFAULT ' ',
40
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
43
INSERT into t1 (b) values ('1');
47
CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ',
48
b varchar(1) binary NOT NULL DEFAULT ' ',
49
c varchar(4) binary NOT NULL DEFAULT '0000',
63
q varchar(30) binary NOT NULL DEFAULT ' ',
64
r varchar(30) binary NOT NULL DEFAULT ' ',
66
t varchar(4) binary NOT NULL DEFAULT ' ',
67
u varchar(1) binary NOT NULL DEFAULT ' ',
68
v varchar(30) binary NOT NULL DEFAULT ' ',
69
w varchar(30) binary NOT NULL DEFAULT ' ',
71
y varchar(5) binary NOT NULL DEFAULT ' ',
72
z varchar(20) binary NOT NULL DEFAULT ' ',
73
a1 varchar(30) binary NOT NULL DEFAULT ' ',
75
ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
78
INSERT into t2 (b) values ('1');
87
# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT
90
# If the column can take NULL as a value, the column is defined with an
91
# explicit DEFAULT NULL clause. This is the same as before 5.0.2.
93
# If the column cannot take NULL as the value, MySQL defines the column with
94
# no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE
95
# statement includes no value for the column, MySQL handles the column
96
# according to the SQL mode in effect at the time:
98
# * If strict SQL mode is not enabled, MySQL sets the column to the
99
# implicit default value for the column data type.
101
# * If strict mode is enabled, an error occurs for transactional tables and
102
# the statement is rolled back. For non-transactional tables, an error
103
# occurs, but if this happens for the second or subsequent row of a
104
# multiple-row statement, the preceding rows will have been inserted.
106
create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
107
insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
108
insert into bug20691 (i) values (2);
110
insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
111
insert into bug20691 (i) values (4);
112
insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
113
SET sql_mode = 'ALLOW_INVALID_DATES';
114
insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
115
SET sql_mode = 'STRICT_ALL_TABLES';
117
insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
118
select * from bug20691 order by i asc;
122
create table bug20691 (
123
a set('one', 'two', 'three') not null,
124
b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
133
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
134
insert into bug20691 (x) values (2);
135
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
136
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
137
select * from bug20691 order by x asc;
140
create table t1 (id int not null);
141
insert into t1 values(default);
143
create view v1 (c) as select id from t1;
144
insert into t1 values(default);
148
--echo End of 5.0 tests.