~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/strict.test

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
INSERT INTO t1 (col1) VALUES ('');
39
39
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
40
40
INSERT INTO t1 (col1) VALUES ('a59b');
41
 
--error 1265
 
41
--error ER_WARN_DATA_TRUNCATED
42
42
INSERT INTO t1 (col1) VALUES ('1a');
43
43
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
 
44
--error ER_DIVISION_BY_ZERO
44
45
INSERT IGNORE INTO t1 values (1/0);
45
46
INSERT IGNORE INTO t1 values (-2147483649);
46
47
INSERT IGNORE INTO t1 values (2147643648);
66
67
 
67
68
--error ER_WARN_DATA_OUT_OF_RANGE
68
69
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
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);
 
70
# https://bugs.launchpad.net/drizzle/+bug/316221
 
71
 --error ER_WARN_DATA_OUT_OF_RANGE
 
72
INSERT INTO t1 (col1) VALUES(9223372036854775808);
72
73
 
73
74
--error ER_WARN_DATA_OUT_OF_RANGE
74
75
INSERT INTO t1 (col1) VALUES('-9223372036854775809');
94
95
INSERT INTO t1 (col1) VALUES ('');
95
96
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
96
97
INSERT INTO t1 (col1) VALUES ('a59b');
97
 
--error 1265
 
98
--error ER_WARN_DATA_TRUNCATED
98
99
INSERT INTO t1 (col1) VALUES ('1a');
99
100
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
 
101
--error ER_DIVISION_BY_ZERO
100
102
INSERT IGNORE INTO t1 values (1/0);
101
103
INSERT IGNORE INTO t1 VALUES (-9223372036854775809);
102
104
INSERT IGNORE INTO t1 VALUES (9223372036854775808);
121
123
# this statement errors due to decimal truncation. The number
122
124
# used in insertion is chosen to test that this this error does
123
125
# in fact occur
124
 
--error 1265 
 
126
--error ER_WARN_DATA_TRUNCATED 
125
127
INSERT INTO t1 VALUES (10.5555);
126
128
INSERT INTO t1 VALUES (0);
127
129
INSERT INTO t1 VALUES (-10.55);
128
130
# this statement errors due to decimal truncation. The number
129
131
# used in insertion is chosen to test that this this error does
130
132
# in fact occur
131
 
--error 1265
 
133
--error ER_WARN_DATA_TRUNCATED
132
134
INSERT INTO t1 VALUES (-10.5555);
133
135
INSERT INTO t1 VALUES (11);
134
136
INSERT INTO t1 VALUES (1e+01);
143
145
# this statement errors due to decimal truncation. The number
144
146
# used in insertion is chosen to test that this this error does
145
147
# in fact occur
146
 
--error 1265 
 
148
--error ER_WARN_DATA_TRUNCATED 
147
149
INSERT INTO t1 VALUES ('10.5555');
148
150
INSERT INTO t1 VALUES ('-10.55');
149
151
# this statement errors due to decimal truncation. The number 
150
152
# used in insertion is chosen to test that this error does 
151
153
# in fact occur
152
 
--error 1265 
 
154
--error ER_WARN_DATA_TRUNCATED 
153
155
INSERT INTO t1 VALUES ('-10.5555');
154
156
INSERT INTO t1 VALUES ('11');
155
157
INSERT INTO t1 VALUES ('1e+01');
186
188
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
187
189
--error ER_DIVISION_BY_ZERO
188
190
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
189
 
#--error 1265
 
191
#--error ER_WARN_DATA_TRUNCATED
190
192
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
191
193
INSERT INTO t1 (col1) VALUES ('');
192
 
#--error 1265
 
194
#--error ER_WARN_DATA_TRUNCATED
193
195
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
194
196
INSERT INTO t1 (col1) VALUES ('a59b');
195
197
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
196
198
INSERT INTO t1 (col1) VALUES ('1a');
197
199
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
 
200
--error ER_DIVISION_BY_ZERO
198
201
INSERT IGNORE INTO t1 values (1/0);
199
202
INSERT IGNORE INTO t1 VALUES (1000);
200
203
INSERT IGNORE INTO t1 VALUES (-1000);
212
215
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
213
216
INSERT INTO t1 VALUES ('hello', 'hello');
214
217
INSERT INTO t1 VALUES ('he', 'he');
 
218
--error ER_DATA_TOO_LONG
215
219
INSERT INTO t1 VALUES ('hello   ', 'hello ');
216
 
--error 1406
 
220
--error ER_DATA_TOO_LONG
217
221
INSERT INTO t1 (col1) VALUES ('hellobob');
218
 
--error 1406
 
222
--error ER_DATA_TOO_LONG
219
223
INSERT INTO t1 (col2) VALUES ('hellobob');
 
224
--error ER_DATA_TOO_LONG
220
225
INSERT INTO t1 (col2) VALUES ('hello  ');
221
 
--error 1406
 
226
--error ER_DATA_TOO_LONG
222
227
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
223
 
--error 1406
 
228
--error ER_DATA_TOO_LONG
224
229
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
225
230
INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob');
226
231
UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he';
234
239
INSERT INTO t1 VALUES ('red');
235
240
INSERT INTO t1 VALUES ('blue');
236
241
INSERT INTO t1 VALUES ('green');
237
 
--error 1691 # Bad enum
 
242
--error ER_INVALID_ENUM_VALUE # Bad enum
238
243
INSERT INTO t1 (col1) VALUES ('yellow');
239
 
--error 1691 # Bad enum
 
244
--error ER_INVALID_ENUM_VALUE # Bad enum
240
245
INSERT INTO t1 (col1) VALUES ('redd');
241
 
--error 1691 # Bad enum
 
246
--error ER_INVALID_ENUM_VALUE # Bad enum
242
247
INSERT INTO t1 VALUES ('');
243
 
--error 1691 # Bad enum
 
248
--error ER_INVALID_ENUM_VALUE # Bad enum
244
249
UPDATE t1 SET col1 ='yellow' WHERE col1 ='green';
245
 
--error 1691 # Bad enum
 
250
--error ER_INVALID_ENUM_VALUE # Bad enum
246
251
INSERT IGNORE INTO t1 VALUES ('yellow');
247
 
--error 1691 # Bad enum
 
252
--error ER_INVALID_ENUM_VALUE # Bad enum
248
253
UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';
249
254
SELECT * FROM t1;
250
255
DROP TABLE t1;
254
259
CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);
255
260
INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');
256
261
INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');
257
 
--error 1048
 
262
--error ER_BAD_NULL_ERROR
258
263
INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
259
 
--error 1048
 
264
--error ER_BAD_NULL_ERROR
260
265
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
261
 
--error 1048
 
266
--error ER_BAD_NULL_ERROR
262
267
INSERT INTO t1 VALUES (103,'',NULL);
263
 
--error 1048
 
268
--error ER_BAD_NULL_ERROR
264
269
UPDATE t1 SET col1=NULL WHERE col1 =100;
265
 
--error 1048
 
270
--error ER_BAD_NULL_ERROR
266
271
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
267
 
--error 1048
 
272
--error ER_BAD_NULL_ERROR
268
273
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
269
274
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
270
275
SELECT * FROM t1;
277
282
SHOW CREATE TABLE t1;
278
283
INSERT INTO t1 VALUES (1, 'hello');
279
284
INSERT INTO t1 (col2) VALUES ('hello2');
280
 
--error 1048
 
285
--error ER_BAD_NULL_ERROR
281
286
INSERT INTO t1 (col2) VALUES (NULL);
282
 
--error 1364
 
287
--error ER_NO_DEFAULT_FOR_FIELD
283
288
INSERT INTO t1 (col1) VALUES (2);
284
 
--error 1364
 
289
--error ER_NO_DEFAULT_FOR_FIELD
285
290
INSERT INTO t1 VALUES(default(col1),default(col2));
286
 
--error 1364
 
291
--error ER_NO_DEFAULT_FOR_FIELD
287
292
INSERT INTO t1 (col1) SELECT 1;
288
 
--error 1048
 
293
--error ER_BAD_NULL_ERROR
289
294
INSERT INTO t1 SELECT 1,NULL;
290
295
INSERT IGNORE INTO t1 values (NULL,NULL);
291
296
--error ER_NO_DEFAULT_FOR_FIELD
301
306
 
302
307
create table t1 (charcol char(255), varcharcol varchar(255),
303
308
       varbinarycol varbinary(255));
304
 
--error 1406
 
309
--error ER_DATA_TOO_LONG
305
310
insert into t1 (charcol) values (repeat('x',256));
306
 
--error 1406
 
311
--error ER_DATA_TOO_LONG
307
312
insert into t1 (varcharcol) values (repeat('x',256));
308
 
--error 1406
 
313
--error ER_DATA_TOO_LONG
309
314
insert into t1 (varbinarycol) values (repeat('x',256));
310
315
select * from t1;
311
316
drop table t1;
315
320
#
316
321
 
317
322
create table t1 (col1 char(3), col2 integer);
318
 
--error 1292
 
323
--error ER_TRUNCATED_WRONG_VALUE
319
324
insert into t1 (col1) values (cast(1000 as char(3)));
320
 
--error 1292
 
325
--error ER_TRUNCATED_WRONG_VALUE
321
326
insert into t1 (col1) values (cast(1000E+0 as char(3)));
322
 
--error 1292
 
327
--error ER_TRUNCATED_WRONG_VALUE
323
328
insert into t1 (col1) values (cast(1000.0 as char(3)));
324
 
--error 1292
 
329
--error ER_TRUNCATED_WRONG_VALUE
325
330
insert into t1 (col2) values (cast('abc' as DECIMAL));
326
 
--error 1292
 
331
--error ER_TRUNCATED_WRONG_VALUE
327
332
insert into t1 (col2) values (10E+0 + 'a');
328
 
--error 1265
 
333
--error ER_WARN_DATA_TRUNCATED
329
334
insert into t1 (col2) values ('10a');
330
335
insert into t1 (col2) values (cast('10a' as DECIMAL));
331
336
insert into t1 (col2) values (cast('10' as DECIMAL));
336
341
 
337
342
# Test fields with no default value that are NOT NULL (Bug #5986)
338
343
CREATE TABLE t1 (i int not null);
339
 
--error 1364
 
344
--error ER_NO_DEFAULT_FOR_FIELD
340
345
INSERT INTO t1 VALUES ();
341
 
--error 1364
 
346
--error ER_NO_DEFAULT_FOR_FIELD
342
347
INSERT INTO t1 VALUES (DEFAULT);
343
 
--error 1364
 
348
--error ER_NO_DEFAULT_FOR_FIELD
344
349
INSERT INTO t1 VALUES (DEFAULT(i));
345
350
ALTER TABLE t1 ADD j int;
346
 
--error 1364
 
351
--error ER_NO_DEFAULT_FOR_FIELD
347
352
INSERT INTO t1 SET j = 1;
348
 
--error 1364
 
353
--error ER_NO_DEFAULT_FOR_FIELD
349
354
INSERT INTO t1 SET j = 1, i = DEFAULT;
350
 
--error 1364
 
355
--error ER_NO_DEFAULT_FOR_FIELD
351
356
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
352
 
--error 1364
 
357
--error ER_NO_DEFAULT_FOR_FIELD
353
358
INSERT INTO t1 VALUES (DEFAULT,1);
354
359
DROP TABLE t1;
355
360
CREATE TABLE t1 (i int not null);
356
 
--error 1364
 
361
--error ER_NO_DEFAULT_FOR_FIELD
357
362
INSERT INTO t1 VALUES ();
358
 
--error 1364
 
363
--error ER_NO_DEFAULT_FOR_FIELD
359
364
INSERT INTO t1 VALUES (DEFAULT);
360
365
# DEFAULT(i) is an error even with the default sql_mode
361
 
--error 1364
 
366
--error ER_NO_DEFAULT_FOR_FIELD
362
367
INSERT INTO t1 VALUES (DEFAULT(i));
363
368
ALTER TABLE t1 ADD j int;
364
 
--error 1364
 
369
--error ER_NO_DEFAULT_FOR_FIELD
365
370
INSERT INTO t1 SET j = 1;
366
 
--error 1364
 
371
--error ER_NO_DEFAULT_FOR_FIELD
367
372
INSERT INTO t1 SET j = 1, i = DEFAULT;
368
 
--error 1364
 
373
--error ER_NO_DEFAULT_FOR_FIELD
369
374
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
370
 
--error 1364
 
375
--error ER_NO_DEFAULT_FOR_FIELD
371
376
INSERT INTO t1 VALUES (DEFAULT,1);
372
377
DROP TABLE t1;
373
378
 
375
380
# Bugs #8295 and #8296: varchar and varbinary conversion
376
381
#
377
382
 
378
 
--error 1074
 
383
--error ER_TOO_BIG_FIELDLENGTH
379
384
create table t1(a varchar(65537));
380
 
--error 1074
 
385
--error ER_TOO_BIG_FIELDLENGTH
381
386
create table t1(a varbinary(65537));
382
387
 
383
388
#
416
421
drop table t2,t1;
417
422
 
418
423
create table t1 (i int)
419
 
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
 
424
comment='123456789*123456789*123456789*123456789*123456789*123456789*';
420
425
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
421
426
show create table t1;
422
427
drop table t1;
451
456
#
452
457
# Bug#27069 set with identical elements are created
453
458
#
454
 
--error 1291
 
459
--error ER_DUPLICATED_VALUE_IN_TYPE
455
460
create table t1 (f1 enum('a','a'));
456
461
 
457
462
--echo End of 5.0 tests