~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# Testing of "strict" mode
2
3
-- source include/have_innodb.inc
4
5
# Test INSERT with INT
6
873.2.35 by Monty Taylor
Update tests based on how Toru's latest patch changes create table statements.
7
--disable_warnings
8
DROP TABLE IF EXISTS t1;
9
--enable_warnings
784.2.1 by Stewart Smith
fix strict test for drizzle.
10
CREATE TABLE t1 (col1 INT);
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
11
INSERT INTO t1 VALUES(-2147483648);
12
INSERT INTO t1 VALUES (0);
13
INSERT INTO t1 VALUES (2147483647);
14
INSERT INTO t1 VALUES ('-2147483648');
15
INSERT INTO t1 VALUES ('2147483647');
16
INSERT INTO t1 VALUES (-2147483648.0);
17
INSERT INTO t1 VALUES (2147483647.0);
784.2.1 by Stewart Smith
fix strict test for drizzle.
18
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
19
INSERT INTO t1 (col1) VALUES(-2147483649);
784.2.1 by Stewart Smith
fix strict test for drizzle.
20
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
21
INSERT INTO t1 (col1) VALUES(2147643648);
784.2.1 by Stewart Smith
fix strict test for drizzle.
22
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
23
INSERT INTO t1 (col1) VALUES('-2147483649');
784.2.1 by Stewart Smith
fix strict test for drizzle.
24
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
25
INSERT INTO t1 (col1) VALUES('2147643648');
784.2.1 by Stewart Smith
fix strict test for drizzle.
26
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
27
INSERT INTO t1 (col1) VALUES(-2147483649.0);
784.2.1 by Stewart Smith
fix strict test for drizzle.
28
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
29
INSERT INTO t1 (col1) VALUES(2147643648.0);
30
784.2.1 by Stewart Smith
fix strict test for drizzle.
31
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
32
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
784.2.1 by Stewart Smith
fix strict test for drizzle.
33
--error ER_DIVISION_BY_ZERO
1 by brian
clean slate
34
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
784.2.1 by Stewart Smith
fix strict test for drizzle.
35
--error ER_DIVISION_BY_ZERO
1 by brian
clean slate
36
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
784.2.1 by Stewart Smith
fix strict test for drizzle.
37
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
38
INSERT INTO t1 (col1) VALUES ('');
784.2.1 by Stewart Smith
fix strict test for drizzle.
39
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
40
INSERT INTO t1 (col1) VALUES ('a59b');
41
--error 1265
42
INSERT INTO t1 (col1) VALUES ('1a');
43
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
784.2.1 by Stewart Smith
fix strict test for drizzle.
44
INSERT IGNORE INTO t1 values (1/0);
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
45
INSERT IGNORE INTO t1 values (-2147483649);
46
INSERT IGNORE INTO t1 values (2147643648);
47
INSERT IGNORE INTO t1 values ('-2147483649');
48
INSERT IGNORE INTO t1 values ('2147643648');
49
INSERT IGNORE INTO t1 values (-2147483649.0);
50
INSERT IGNORE INTO t1 values (2147643648.0);
1 by brian
clean slate
51
SELECT * FROM t1;
52
DROP TABLE t1;
53
54
# Test INSERT with BIGINT
55
# Note that this doesn't behave 100 % to standard as we rotate
56
# integers when it's too big/small (just like C)
57
784.2.1 by Stewart Smith
fix strict test for drizzle.
58
CREATE TABLE t1 (col1 BIGINT);
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
59
INSERT INTO t1 VALUES (-9223372036854775808);
60
INSERT INTO t1 VALUES (0);
61
INSERT INTO t1 VALUES (9223372036854775807);
62
INSERT INTO t1 VALUES ('-9223372036854775808');
63
INSERT INTO t1 VALUES ('9223372036854775807');
64
INSERT INTO t1 VALUES (-9223372036854774000.0);
65
INSERT INTO t1 VALUES (9223372036854775700.0);
1 by brian
clean slate
66
784.2.1 by Stewart Smith
fix strict test for drizzle.
67
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
68
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
784.2.1 by Stewart Smith
fix strict test for drizzle.
69
# DISABLED due to https://bugs.launchpad.net/drizzle/+bug/316221
70
# --error ER_WARN_DATA_OUT_OF_RANGE
71
# INSERT INTO t1 (col1) VALUES(9223372036854775808);
1 by brian
clean slate
72
784.2.1 by Stewart Smith
fix strict test for drizzle.
73
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
74
INSERT INTO t1 (col1) VALUES('-9223372036854775809');
784.2.1 by Stewart Smith
fix strict test for drizzle.
75
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
76
INSERT INTO t1 (col1) VALUES('9223372036854775808');
77
78
# Note that the following two double numbers are slighty bigger than max/min
79
# bigint becasue of rounding errors when converting it to bigint
784.2.1 by Stewart Smith
fix strict test for drizzle.
80
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
81
INSERT INTO t1 (col1) VALUES(-9223372036854785809.0);
784.2.1 by Stewart Smith
fix strict test for drizzle.
82
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
83
INSERT INTO t1 (col1) VALUES(9223372036854785808.0);
84
85
# The following doesn't give an error as it's done in integer context
86
# UPDATE t1 SET col1=col1 - 5000 WHERE col1 < 0;
87
# UPDATE t1 SET col2 =col2 + 5000 WHERE col2 > 0;
88
784.2.1 by Stewart Smith
fix strict test for drizzle.
89
--error ER_DIVISION_BY_ZERO
1 by brian
clean slate
90
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
784.2.1 by Stewart Smith
fix strict test for drizzle.
91
--error ER_DIVISION_BY_ZERO
1 by brian
clean slate
92
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
784.2.1 by Stewart Smith
fix strict test for drizzle.
93
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
94
INSERT INTO t1 (col1) VALUES ('');
784.2.1 by Stewart Smith
fix strict test for drizzle.
95
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
96
INSERT INTO t1 (col1) VALUES ('a59b');
97
--error 1265
98
INSERT INTO t1 (col1) VALUES ('1a');
99
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
784.2.1 by Stewart Smith
fix strict test for drizzle.
100
INSERT IGNORE INTO t1 values (1/0);
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
101
INSERT IGNORE INTO t1 VALUES (-9223372036854775809);
102
INSERT IGNORE INTO t1 VALUES (9223372036854775808);
103
INSERT IGNORE INTO t1 VALUES ('-9223372036854775809');
104
INSERT IGNORE INTO t1 VALUES ('9223372036854775808');
105
INSERT IGNORE INTO t1 VALUES (-9223372036854785809.0);
106
INSERT IGNORE INTO t1 VALUES (9223372036854785808.0);
1 by brian
clean slate
107
SELECT * FROM t1;
108
DROP TABLE t1;
109
110
# Test INSERT with NUMERIC
111
112
CREATE TABLE t1 (col1 NUMERIC(4,2));
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
113
# The following INSERT statements used to look as follows before 
114
# the fix for bug#337038 was implemented:
115
# INSERT INTO t1 
116
# VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01);
117
# Now that decimal truncation gives an error instead of a warning, we will
118
# get an error on certain INSERT statements below about decimal truncation.
119
120
INSERT INTO t1 VALUES (10.55);
121
# this statement errors due to decimal truncation. The number
122
# used in insertion is chosen to test that this this error does
123
# in fact occur
124
--error 1265 
125
INSERT INTO t1 VALUES (10.5555);
126
INSERT INTO t1 VALUES (0);
127
INSERT INTO t1 VALUES (-10.55);
128
# this statement errors due to decimal truncation. The number
129
# used in insertion is chosen to test that this this error does
130
# in fact occur
131
--error 1265
132
INSERT INTO t1 VALUES (-10.5555);
133
INSERT INTO t1 VALUES (11);
134
INSERT INTO t1 VALUES (1e+01);
135
136
# The following INSERT statements used to look as follows before 
137
# the fix for bug#337038 was implemented:
138
# INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+01');
139
# Now that decimal truncation gives an error instead of a warning, we will
140
# get an error on certain INSERT statements below about decimal truncation.
141
142
INSERT INTO t1 VALUES ('10.55');
143
# this statement errors due to decimal truncation. The number
144
# used in insertion is chosen to test that this this error does
145
# in fact occur
146
--error 1265 
147
INSERT INTO t1 VALUES ('10.5555');
148
INSERT INTO t1 VALUES ('-10.55');
149
# this statement errors due to decimal truncation. The number 
150
# used in insertion is chosen to test that this error does 
151
# in fact occur
152
--error 1265 
153
INSERT INTO t1 VALUES ('-10.5555');
154
INSERT INTO t1 VALUES ('11');
155
INSERT INTO t1 VALUES ('1e+01');
1 by brian
clean slate
156
157
# The 2 following inserts should generate a warning, but doesn't yet
158
# because NUMERIC works like DECIMAL
784.2.1 by Stewart Smith
fix strict test for drizzle.
159
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
160
INSERT INTO t1 VALUES (101.55);
784.2.1 by Stewart Smith
fix strict test for drizzle.
161
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
162
INSERT INTO t1 VALUES (101);
784.2.1 by Stewart Smith
fix strict test for drizzle.
163
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
164
INSERT INTO t1 VALUES (-101.55);
784.2.1 by Stewart Smith
fix strict test for drizzle.
165
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
166
INSERT INTO t1 VALUES (1010.55);
784.2.1 by Stewart Smith
fix strict test for drizzle.
167
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
168
INSERT INTO t1 VALUES (1010);
169
# The 2 following inserts should generate a warning, but doesn't yet
170
# because NUMERIC works like DECIMAL
784.2.1 by Stewart Smith
fix strict test for drizzle.
171
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
172
INSERT INTO t1 VALUES ('101.55');
784.2.1 by Stewart Smith
fix strict test for drizzle.
173
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
174
INSERT INTO t1 VALUES ('101');
784.2.1 by Stewart Smith
fix strict test for drizzle.
175
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
176
INSERT INTO t1 VALUES ('-101.55');
784.2.1 by Stewart Smith
fix strict test for drizzle.
177
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
178
INSERT INTO t1 VALUES ('-1010.55');
784.2.1 by Stewart Smith
fix strict test for drizzle.
179
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
180
INSERT INTO t1 VALUES ('-100E+1');
784.2.1 by Stewart Smith
fix strict test for drizzle.
181
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
182
INSERT INTO t1 VALUES ('-100E');
784.2.1 by Stewart Smith
fix strict test for drizzle.
183
--error ER_WARN_DATA_OUT_OF_RANGE
1 by brian
clean slate
184
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
784.2.1 by Stewart Smith
fix strict test for drizzle.
185
--error ER_DIVISION_BY_ZERO
1 by brian
clean slate
186
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
784.2.1 by Stewart Smith
fix strict test for drizzle.
187
--error ER_DIVISION_BY_ZERO
1 by brian
clean slate
188
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
189
#--error 1265
784.2.1 by Stewart Smith
fix strict test for drizzle.
190
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
191
INSERT INTO t1 (col1) VALUES ('');
192
#--error 1265
784.2.1 by Stewart Smith
fix strict test for drizzle.
193
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
194
INSERT INTO t1 (col1) VALUES ('a59b');
784.2.1 by Stewart Smith
fix strict test for drizzle.
195
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
196
INSERT INTO t1 (col1) VALUES ('1a');
197
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
198
INSERT IGNORE INTO t1 values (1/0);
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
199
INSERT IGNORE INTO t1 VALUES (1000);
200
INSERT IGNORE INTO t1 VALUES (-1000);
201
INSERT IGNORE INTO t1 VALUES ('1000');
202
INSERT IGNORE INTO t1 VALUES ('-1000');
203
INSERT IGNORE INTO t1 VALUES (1000.0);
204
INSERT IGNORE INTO t1 VALUES (-1000.0);
1 by brian
clean slate
205
UPDATE IGNORE t1 SET col1=1/NULL where col1=0;
942.3.1 by Vladimir Kolesnikov
test generalizations
206
--sorted_result
1 by brian
clean slate
207
SELECT * FROM t1;
208
DROP TABLE t1;
209
210
# Testing INSERT with CHAR/VARCHAR
211
212
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
213
INSERT INTO t1 VALUES ('hello', 'hello');
214
INSERT INTO t1 VALUES ('he', 'he');
215
INSERT INTO t1 VALUES ('hello   ', 'hello ');
1 by brian
clean slate
216
--error 1406
217
INSERT INTO t1 (col1) VALUES ('hellobob');
218
--error 1406
219
INSERT INTO t1 (col2) VALUES ('hellobob');
220
INSERT INTO t1 (col2) VALUES ('hello  ');
221
--error 1406
222
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
223
--error 1406
224
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
225
INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob');
226
UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he';
942.3.1 by Vladimir Kolesnikov
test generalizations
227
--sorted_result
1 by brian
clean slate
228
SELECT * FROM t1;
229
DROP TABLE t1;
230
231
# Testing INSERT with ENUM
232
233
CREATE TABLE t1 (col1 enum('red','blue','green'));
970.2.5 by Padraig O'Sullivan
Added extra comments to parts of test cases that were modified for this bug
234
INSERT INTO t1 VALUES ('red');
235
INSERT INTO t1 VALUES ('blue');
236
INSERT INTO t1 VALUES ('green');
934.4.1 by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not
237
--error 1691 # Bad enum
1 by brian
clean slate
238
INSERT INTO t1 (col1) VALUES ('yellow');
934.4.1 by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not
239
--error 1691 # Bad enum
1 by brian
clean slate
240
INSERT INTO t1 (col1) VALUES ('redd');
934.4.1 by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not
241
--error 1691 # Bad enum
1 by brian
clean slate
242
INSERT INTO t1 VALUES ('');
934.4.1 by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not
243
--error 1691 # Bad enum
1 by brian
clean slate
244
UPDATE t1 SET col1 ='yellow' WHERE col1 ='green';
934.4.1 by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not
245
--error 1691 # Bad enum
1 by brian
clean slate
246
INSERT IGNORE INTO t1 VALUES ('yellow');
934.4.1 by Jay Pipes
Fixes ENUM field type to throw an error on bad data input. 0 is now not
247
--error 1691 # Bad enum
1 by brian
clean slate
248
UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';
249
SELECT * FROM t1;
250
DROP TABLE t1;
251
252
# Testing of insert of NULL in not NULL column
253
254
CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);
255
INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');
256
INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');
257
--error 1048
258
INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
259
--error 1048
260
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
261
--error 1048
262
INSERT INTO t1 VALUES (103,'',NULL);
263
--error 1048
264
UPDATE t1 SET col1=NULL WHERE col1 =100;
265
--error 1048
266
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
267
--error 1048
268
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
269
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
270
SELECT * FROM t1;
271
DROP TABLE t1;
272
273
# Testing of default values
274
275
CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL);
942.3.1 by Vladimir Kolesnikov
test generalizations
276
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
277
SHOW CREATE TABLE t1;
278
INSERT INTO t1 VALUES (1, 'hello');
279
INSERT INTO t1 (col2) VALUES ('hello2');
280
--error 1048
281
INSERT INTO t1 (col2) VALUES (NULL);
282
--error 1364
283
INSERT INTO t1 (col1) VALUES (2);
284
--error 1364
285
INSERT INTO t1 VALUES(default(col1),default(col2));
286
--error 1364
287
INSERT INTO t1 (col1) SELECT 1;
288
--error 1048
289
INSERT INTO t1 SELECT 1,NULL;
290
INSERT IGNORE INTO t1 values (NULL,NULL);
784.2.1 by Stewart Smith
fix strict test for drizzle.
291
--error ER_NO_DEFAULT_FOR_FIELD
1 by brian
clean slate
292
INSERT IGNORE INTO t1 (col1) values (3);
784.2.1 by Stewart Smith
fix strict test for drizzle.
293
--error ER_NO_DEFAULT_FOR_FIELD
1 by brian
clean slate
294
INSERT IGNORE INTO t1 () values ();
295
SELECT * FROM t1;
296
DROP TABLE t1;
297
298
#
299
# Bug #9029 Traditional: Wrong SQLSTATE returned for string truncation
300
#
301
302
create table t1 (charcol char(255), varcharcol varchar(255),
784.2.1 by Stewart Smith
fix strict test for drizzle.
303
       varbinarycol varbinary(255));
1 by brian
clean slate
304
--error 1406
305
insert into t1 (charcol) values (repeat('x',256));
306
--error 1406
307
insert into t1 (varcharcol) values (repeat('x',256));
308
--error 1406
309
insert into t1 (varbinarycol) values (repeat('x',256));
310
select * from t1;
311
drop table t1;
312
313
#
314
# Check insert with wrong CAST() (Bug #5912)
315
#
316
317
create table t1 (col1 char(3), col2 integer);
318
--error 1292
319
insert into t1 (col1) values (cast(1000 as char(3)));
320
--error 1292
321
insert into t1 (col1) values (cast(1000E+0 as char(3)));
322
--error 1292
323
insert into t1 (col1) values (cast(1000.0 as char(3)));
324
--error 1292
784.2.1 by Stewart Smith
fix strict test for drizzle.
325
insert into t1 (col2) values (cast('abc' as DECIMAL));
1 by brian
clean slate
326
--error 1292
327
insert into t1 (col2) values (10E+0 + 'a');
784.2.1 by Stewart Smith
fix strict test for drizzle.
328
--error 1265
329
insert into t1 (col2) values ('10a');
330
insert into t1 (col2) values (cast('10a' as DECIMAL));
331
insert into t1 (col2) values (cast('10' as DECIMAL));
332
insert into t1 (col2) values (cast('10' as DECIMAL));
1 by brian
clean slate
333
insert into t1 (col2) values (10E+0 + '0 ');
334
select * from t1;
335
drop table t1;
336
337
# Test fields with no default value that are NOT NULL (Bug #5986)
338
CREATE TABLE t1 (i int not null);
339
--error 1364
340
INSERT INTO t1 VALUES ();
341
--error 1364
342
INSERT INTO t1 VALUES (DEFAULT);
343
--error 1364
344
INSERT INTO t1 VALUES (DEFAULT(i));
345
ALTER TABLE t1 ADD j int;
346
--error 1364
347
INSERT INTO t1 SET j = 1;
348
--error 1364
349
INSERT INTO t1 SET j = 1, i = DEFAULT;
350
--error 1364
351
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
352
--error 1364
353
INSERT INTO t1 VALUES (DEFAULT,1);
354
DROP TABLE t1;
355
CREATE TABLE t1 (i int not null);
784.2.1 by Stewart Smith
fix strict test for drizzle.
356
--error 1364
1 by brian
clean slate
357
INSERT INTO t1 VALUES ();
784.2.1 by Stewart Smith
fix strict test for drizzle.
358
--error 1364
1 by brian
clean slate
359
INSERT INTO t1 VALUES (DEFAULT);
360
# DEFAULT(i) is an error even with the default sql_mode
361
--error 1364
362
INSERT INTO t1 VALUES (DEFAULT(i));
363
ALTER TABLE t1 ADD j int;
784.2.1 by Stewart Smith
fix strict test for drizzle.
364
--error 1364
1 by brian
clean slate
365
INSERT INTO t1 SET j = 1;
784.2.1 by Stewart Smith
fix strict test for drizzle.
366
--error 1364
1 by brian
clean slate
367
INSERT INTO t1 SET j = 1, i = DEFAULT;
368
--error 1364
369
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
784.2.1 by Stewart Smith
fix strict test for drizzle.
370
--error 1364
1 by brian
clean slate
371
INSERT INTO t1 VALUES (DEFAULT,1);
372
DROP TABLE t1;
373
374
#
375
# Bugs #8295 and #8296: varchar and varbinary conversion
376
#
377
378
--error 1074
379
create table t1(a varchar(65537));
380
--error 1074
381
create table t1(a varbinary(65537));
382
383
#
384
# Bug #9881: problem with altering table
385
#
386
387
create table t1(a int, b date not null);                                       
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
388
alter table t1 modify a bigint not null;
942.3.1 by Vladimir Kolesnikov
test generalizations
389
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
390
show create table t1;
391
drop table t1;
392
393
#
394
# Bug #11964: alter table with timestamp field
395
#
396
397
create table t1(a int, b timestamp);
398
alter table t1 add primary key(a);
942.3.1 by Vladimir Kolesnikov
test generalizations
399
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
400
show create table t1;
401
drop table t1;
402
create table t1(a int, b timestamp default 20050102030405);
403
alter table t1 add primary key(a);
942.3.1 by Vladimir Kolesnikov
test generalizations
404
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
405
show create table t1;
406
drop table t1;
407
408
409
#
410
# Bug#17626 CREATE TABLE ... SELECT failure with TRADITIONAL SQL mode
411
#
412
create table t1 (date date not null);
413
create table t2 select date from t1;
942.3.1 by Vladimir Kolesnikov
test generalizations
414
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
415
show create table t2;
416
drop table t2,t1;
417
418
create table t1 (i int)
419
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
942.3.1 by Vladimir Kolesnikov
test generalizations
420
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
421
show create table t1;
422
drop table t1;
423
424
#
425
# Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode
426
#
784.2.1 by Stewart Smith
fix strict test for drizzle.
427
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
428
create table t1(col1 int, col2 int, 
429
  col3 int, col4 int,
430
  col7 int, col8 int,
431
  col9 bigint, col10 bigint);
784.2.1 by Stewart Smith
fix strict test for drizzle.
432
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
433
insert into t1(col1) values('-');
784.2.1 by Stewart Smith
fix strict test for drizzle.
434
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
435
insert into t1(col2) values('+');
784.2.1 by Stewart Smith
fix strict test for drizzle.
436
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
437
insert into t1(col3) values('-');
784.2.1 by Stewart Smith
fix strict test for drizzle.
438
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
439
insert into t1(col4) values('+');
784.2.1 by Stewart Smith
fix strict test for drizzle.
440
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
441
insert into t1(col7) values('-');
784.2.1 by Stewart Smith
fix strict test for drizzle.
442
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
443
insert into t1(col8) values('+');
784.2.1 by Stewart Smith
fix strict test for drizzle.
444
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
445
insert into t1(col9) values('-');
784.2.1 by Stewart Smith
fix strict test for drizzle.
446
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
1 by brian
clean slate
447
insert into t1(col10) values('+');
448
drop table t1;
449
450
451
#
452
# Bug#27069 set with identical elements are created
453
#
454
--error 1291
455
create table t1 (f1 enum('a','a'));
456
457
--echo End of 5.0 tests