blob: 1ec00621518cd4c11e9e0d346ead1fb93804d539 (
plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
#
# NOT NULL column attribute
#
let $extra_col_opts = NOT NULL;
--source have_engine.inc
--echo #
--echo # BINARY columns
--echo #
--source type_binary.inc
--let $col_definition = BINARY $default_col_opts
--let $col_default = 0
--source col_not_null.inc
--echo #
--echo # VARBINARY columns
--echo #
--source type_varbinary.inc
--let $col_definition = VARBINARY(64) $default_col_opts
--let $col_default = 'test'
--source col_not_null.inc
--echo #
--echo # BIT columns
--echo #
--source type_bit.inc
--let $col_definition = BIT $default_col_opts
--let $col_default = 1
--source col_not_null.inc
--echo #
--echo # BLOB columns
--echo #
--source type_blob.inc
--let $col_definition = BLOB $default_col_opts
--source col_not_null.inc
--let $col_definition = TINYBLOB $default_col_opts
--source col_not_null.inc
--let $col_definition = MEDIUMBLOB $default_col_opts
--source col_not_null.inc
--let $col_definition = LONGBLOB $default_col_opts
--source col_not_null.inc
--echo #
--echo # BOOL columns
--echo #
--source type_bool.inc
--let $col_definition = BOOL $default_col_opts
--let $col_default = '0'
--source col_not_null.inc
--echo #
--echo # CHAR columns
--echo #
--source type_char.inc
--let $col_definition = CHAR $default_col_opts
--let $col_default = '_'
--source col_not_null.inc
--echo #
--echo # VARCHAR columns
--echo #
--source type_varchar.inc
--let $col_definition = VARCHAR(64) $default_col_opts
--let $col_default = 'test default'
--source col_not_null.inc
--echo #
--echo # date and time columns
--echo #
--source type_date_time.inc
--let $col_definition = DATE $default_col_opts
--let $col_default = '2012-12-21'
--source col_not_null.inc
--let $col_definition = DATETIME $default_col_opts
--let $col_default = '2012-12-21 12:21:12'
--source col_not_null.inc
# For TIMESTAMP the behavior is non-standard
# $col_opts already contains NOT NULL part (it's set in have_engine.inc)
let $create_definition =
c TIMESTAMP $col_opts,
c2 TIMESTAMP $col_opts DEFAULT '2012-02-21 12:21:12'
;
--source create_table.inc
if ($mysql_errname)
{
--let $functionality = TIMESTAMP type or NOT NULL columns or DEFAULT
--source unexpected_result.inc
}
if (!$mysql_errname)
{
--let $error_codes = ER_INVALID_DEFAULT
--let $alter_definition = ADD COLUMN err TIMESTAMP $col_opts DEFAULT NULL
--source alter_table.inc
if ($mysql_errname!=ER_INVALID_DEFAULT)
{
--let $functionality = ALTER or DEFAULT
--source unexpected_result.inc
}
INSERT INTO t1 (c) VALUES (NULL);
INSERT INTO t1 (c2) VALUES (NULL);
--replace_regex /2012-02-21 12:21:12/<DEFAULT_TIMESTAMP>/ /[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/<TIMESTAMP>/
SELECT c, c2 FROM t1;
DROP TABLE t1;
}
--let $create_definition = c TIMESTAMP $col_opts
--source create_table.inc
if ($mysql_errname)
{
--let $functionality = TIMESTAMP type
--source unexpected_result.inc
}
if (!$mysql_errname)
{
SHOW COLUMNS IN t1;
INSERT INTO t1 (c) VALUES (NULL);
if ($mysql_errname)
{
--let $functionality = TIMESTAMP
--source unexpected_result.inc
}
--replace_regex /[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/<TIMESTAMP>/
SELECT c FROM t1;
DROP TABLE t1;
}
# End of TIMESTAMP exception
--let $col_definition = TIME $default_col_opts
--let $col_default = '12:21:12'
--source col_not_null.inc
--let $col_definition = YEAR $default_col_opts
--let $col_default = '2012'
--source col_not_null.inc
--let $col_definition = YEAR(2) $default_col_opts
--let $col_default = '12'
--source col_not_null.inc
--echo #
--echo # ENUM columns
--echo #
--source type_enum.inc
--let $col_definition = ENUM('test1','test2','test3') $default_col_opts
--let $col_default = 'test2'
--source col_not_null.inc
--echo #
--echo # Fixed point columns (NUMERIC, DECIMAL)
--echo #
--source type_fixed.inc
--let $col_definition = DECIMAL $default_col_opts
--let $col_default = 1.1
--source col_not_null.inc
--let $col_definition = NUMERIC $default_col_opts
--let $col_default = 0
--source col_not_null.inc
--echo #
--echo # Floating point columns (FLOAT, DOUBLE)
--echo #
--source type_float.inc
--let $col_definition = FLOAT $default_col_opts
--let $col_default = 1.1
--source col_not_null.inc
--let $col_definition = DOUBLE $default_col_opts
--let $col_default = 0
--source col_not_null.inc
--echo #
--echo # INT columns
--echo #
--source type_int.inc
--let $col_definition = INT $default_col_opts
--let $col_default = 2147483647
--source col_not_null.inc
--let $col_definition = TINYINT $default_col_opts
--let $col_default = 127
--source col_not_null.inc
--let $col_definition = SMALLINT $default_col_opts
--let $col_default = 0
--source col_not_null.inc
--let $col_definition = MEDIUMINT $default_col_opts
--let $col_default = 1
--source col_not_null.inc
--let $col_definition = BIGINT $default_col_opts
--let $col_default = 9223372036854775807
--source col_not_null.inc
--echo #
--echo # SET columns
--echo #
--source type_set.inc
--let $col_definition = SET('test1','test2','test3') $default_col_opts
--let $col_default = 'test2,test3'
--source col_not_null.inc
--echo #
--echo # TEXT columns
--echo #
--source type_text.inc
--let $col_definition = TEXT $default_col_opts
--source col_not_null.inc
--let $col_definition = TINYTEXT $default_col_opts
--source col_not_null.inc
--let $col_definition = MEDIUMTEXT $default_col_opts
--source col_not_null.inc
--let $col_definition = LONGTEXT $default_col_opts
--source col_not_null.inc
--source cleanup_engine.inc
|