~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/default.test

  • Committer: Monty Taylor
  • Date: 2008-11-24 05:39:31 UTC
  • mto: This revision was merged to the branch mainline in revision 610.
  • Revision ID: mordred@solanthus.local-20081124053931-tzlxsgkdvs3b7n8n
Reverted libuuid check code. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# test of already fixed bugs
3
 
#
4
 
--disable_warnings
5
 
drop table if exists t1,t2,t3,t4,t5,t6;
6
 
drop database if exists mysqltest;
7
 
 
8
 
#
9
 
# Bug 10838
10
 
# Insert causes warnings for no default values and corrupts tables
11
 
#
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',
15
 
                 d blob NULL,
16
 
                 e blob NULL,
17
 
                 f blob NULL,
18
 
                 g blob NULL,
19
 
                 h blob NULL,
20
 
                 i blob NULL,
21
 
                 j blob NULL,
22
 
                 k blob NULL,
23
 
                 l blob NULL,
24
 
                 m blob NULL,
25
 
                 n blob NULL,
26
 
                 o blob NULL,
27
 
                 p blob NULL,
28
 
                 q varbinary(30) NOT NULL DEFAULT ' ',
29
 
                 r varbinary(30) NOT NULL DEFAULT ' ',
30
 
                 s blob NULL,
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 ' ',
35
 
                 x blob NULL,
36
 
                 y varbinary(5) NOT NULL DEFAULT ' ',
37
 
                 z varbinary(20) NOT NULL DEFAULT ' ',
38
 
                 a1 varbinary(30) NOT NULL DEFAULT ' ',
39
 
                 b1 blob NULL)
40
 
ENGINE=InnoDB DEFAULT COLLATE=utf8_bin;
41
 
 
42
 
INSERT into t1 (b) values ('1');
43
 
SHOW WARNINGS;
44
 
SELECT * from t1;
45
 
 
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',
49
 
                 d blob NULL,
50
 
                 e blob NULL,
51
 
                 f blob NULL,
52
 
                 g blob NULL,
53
 
                 h blob NULL,
54
 
                 i blob NULL,
55
 
                 j blob NULL,
56
 
                 k blob NULL,
57
 
                 l blob NULL,
58
 
                 m blob NULL,
59
 
                 n blob NULL,
60
 
                 o blob NULL,
61
 
                 p blob NULL,
62
 
                 q varbinary(30) NOT NULL DEFAULT ' ',
63
 
                 r varbinary(30) NOT NULL DEFAULT ' ',
64
 
                 s blob NULL,
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 ' ',
69
 
                 x blob NULL,
70
 
                 y varbinary(5) NOT NULL DEFAULT ' ',
71
 
                 z varbinary(20) NOT NULL DEFAULT ' ',
72
 
                 a1 varbinary(30) NOT NULL DEFAULT ' ',
73
 
                 b1 blob NULL)
74
 
ENGINE=MyISAM DEFAULT COLLATE=utf8_bin;
75
 
 
76
 
SHOW CREATE TABLE t2;
77
 
INSERT into t2 (b) values ('1');
78
 
SHOW WARNINGS;
79
 
SELECT * from t2;
80
 
 
81
 
drop table t1;
82
 
drop table t2;
83
 
 
84
 
 
85
 
#
86
 
# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT
87
 
#
88
 
# From the docs:
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.
91
 
#
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:
96
 
#
97
 
#    * If strict SQL mode is not enabled, MySQL sets the column to the
98
 
#      implicit default value for the column data type.
99
 
#
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.
104
 
#
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;
110
 
drop table bug20691;
111
 
 
112
 
create table bug20691 (
113
 
  b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
114
 
  d date not null,
115
 
  e int not null,
116
 
  g blob not null,
117
 
  h datetime not null,
118
 
  i decimal not null,
119
 
  x int);
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;
127
 
drop table bug20691;
128
 
 
129
 
create table t1 (id int not null default 1);
130
 
insert into t1 values(default);
131
 
 
132
 
drop table t1;
133