~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/strict.test

  • Committer: Andrew Hutchings
  • Date: 2010-09-08 19:03:09 UTC
  • mfrom: (1750 staging)
  • mto: (1750.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1751.
  • Revision ID: andrew@linuxjedi.co.uk-20100908190309-mya1nu7xvo1fpvk8
Merge trunk into branch

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
44
INSERT IGNORE INTO t1 values (1/0);
94
94
INSERT INTO t1 (col1) VALUES ('');
95
95
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
96
96
INSERT INTO t1 (col1) VALUES ('a59b');
97
 
--error 1265
 
97
--error ER_WARN_DATA_TRUNCATED
98
98
INSERT INTO t1 (col1) VALUES ('1a');
99
99
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
100
100
INSERT IGNORE INTO t1 values (1/0);
121
121
# this statement errors due to decimal truncation. The number
122
122
# used in insertion is chosen to test that this this error does
123
123
# in fact occur
124
 
--error 1265 
 
124
--error ER_WARN_DATA_TRUNCATED 
125
125
INSERT INTO t1 VALUES (10.5555);
126
126
INSERT INTO t1 VALUES (0);
127
127
INSERT INTO t1 VALUES (-10.55);
128
128
# this statement errors due to decimal truncation. The number
129
129
# used in insertion is chosen to test that this this error does
130
130
# in fact occur
131
 
--error 1265
 
131
--error ER_WARN_DATA_TRUNCATED
132
132
INSERT INTO t1 VALUES (-10.5555);
133
133
INSERT INTO t1 VALUES (11);
134
134
INSERT INTO t1 VALUES (1e+01);
143
143
# this statement errors due to decimal truncation. The number
144
144
# used in insertion is chosen to test that this this error does
145
145
# in fact occur
146
 
--error 1265 
 
146
--error ER_WARN_DATA_TRUNCATED 
147
147
INSERT INTO t1 VALUES ('10.5555');
148
148
INSERT INTO t1 VALUES ('-10.55');
149
149
# this statement errors due to decimal truncation. The number 
150
150
# used in insertion is chosen to test that this error does 
151
151
# in fact occur
152
 
--error 1265 
 
152
--error ER_WARN_DATA_TRUNCATED 
153
153
INSERT INTO t1 VALUES ('-10.5555');
154
154
INSERT INTO t1 VALUES ('11');
155
155
INSERT INTO t1 VALUES ('1e+01');
186
186
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
187
187
--error ER_DIVISION_BY_ZERO
188
188
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
189
 
#--error 1265
 
189
#--error ER_WARN_DATA_TRUNCATED
190
190
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
191
191
INSERT INTO t1 (col1) VALUES ('');
192
 
#--error 1265
 
192
#--error ER_WARN_DATA_TRUNCATED
193
193
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
194
194
INSERT INTO t1 (col1) VALUES ('a59b');
195
195
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
212
212
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
213
213
INSERT INTO t1 VALUES ('hello', 'hello');
214
214
INSERT INTO t1 VALUES ('he', 'he');
215
 
--error 1406
 
215
--error ER_DATA_TOO_LONG
216
216
INSERT INTO t1 VALUES ('hello   ', 'hello ');
217
 
--error 1406
 
217
--error ER_DATA_TOO_LONG
218
218
INSERT INTO t1 (col1) VALUES ('hellobob');
219
 
--error 1406
 
219
--error ER_DATA_TOO_LONG
220
220
INSERT INTO t1 (col2) VALUES ('hellobob');
221
 
--error 1406
 
221
--error ER_DATA_TOO_LONG
222
222
INSERT INTO t1 (col2) VALUES ('hello  ');
223
 
--error 1406
 
223
--error ER_DATA_TOO_LONG
224
224
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
225
 
--error 1406
 
225
--error ER_DATA_TOO_LONG
226
226
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
227
227
INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob');
228
228
UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he';
236
236
INSERT INTO t1 VALUES ('red');
237
237
INSERT INTO t1 VALUES ('blue');
238
238
INSERT INTO t1 VALUES ('green');
239
 
--error 1691 # Bad enum
 
239
--error ER_INVALID_ENUM_VALUE # Bad enum
240
240
INSERT INTO t1 (col1) VALUES ('yellow');
241
 
--error 1691 # Bad enum
 
241
--error ER_INVALID_ENUM_VALUE # Bad enum
242
242
INSERT INTO t1 (col1) VALUES ('redd');
243
 
--error 1691 # Bad enum
 
243
--error ER_INVALID_ENUM_VALUE # Bad enum
244
244
INSERT INTO t1 VALUES ('');
245
 
--error 1691 # Bad enum
 
245
--error ER_INVALID_ENUM_VALUE # Bad enum
246
246
UPDATE t1 SET col1 ='yellow' WHERE col1 ='green';
247
 
--error 1691 # Bad enum
 
247
--error ER_INVALID_ENUM_VALUE # Bad enum
248
248
INSERT IGNORE INTO t1 VALUES ('yellow');
249
 
--error 1691 # Bad enum
 
249
--error ER_INVALID_ENUM_VALUE # Bad enum
250
250
UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';
251
251
SELECT * FROM t1;
252
252
DROP TABLE t1;
256
256
CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);
257
257
INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');
258
258
INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');
259
 
--error 1048
 
259
--error ER_BAD_NULL_ERROR
260
260
INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
261
 
--error 1048
 
261
--error ER_BAD_NULL_ERROR
262
262
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
263
 
--error 1048
 
263
--error ER_BAD_NULL_ERROR
264
264
INSERT INTO t1 VALUES (103,'',NULL);
265
 
--error 1048
 
265
--error ER_BAD_NULL_ERROR
266
266
UPDATE t1 SET col1=NULL WHERE col1 =100;
267
 
--error 1048
 
267
--error ER_BAD_NULL_ERROR
268
268
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
269
 
--error 1048
 
269
--error ER_BAD_NULL_ERROR
270
270
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
271
271
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
272
272
SELECT * FROM t1;
279
279
SHOW CREATE TABLE t1;
280
280
INSERT INTO t1 VALUES (1, 'hello');
281
281
INSERT INTO t1 (col2) VALUES ('hello2');
282
 
--error 1048
 
282
--error ER_BAD_NULL_ERROR
283
283
INSERT INTO t1 (col2) VALUES (NULL);
284
 
--error 1364
 
284
--error ER_NO_DEFAULT_FOR_FIELD
285
285
INSERT INTO t1 (col1) VALUES (2);
286
 
--error 1364
 
286
--error ER_NO_DEFAULT_FOR_FIELD
287
287
INSERT INTO t1 VALUES(default(col1),default(col2));
288
 
--error 1364
 
288
--error ER_NO_DEFAULT_FOR_FIELD
289
289
INSERT INTO t1 (col1) SELECT 1;
290
 
--error 1048
 
290
--error ER_BAD_NULL_ERROR
291
291
INSERT INTO t1 SELECT 1,NULL;
292
292
INSERT IGNORE INTO t1 values (NULL,NULL);
293
293
--error ER_NO_DEFAULT_FOR_FIELD
303
303
 
304
304
create table t1 (charcol char(255), varcharcol varchar(255),
305
305
       varbinarycol varbinary(255));
306
 
--error 1406
 
306
--error ER_DATA_TOO_LONG
307
307
insert into t1 (charcol) values (repeat('x',256));
308
 
--error 1406
 
308
--error ER_DATA_TOO_LONG
309
309
insert into t1 (varcharcol) values (repeat('x',256));
310
 
--error 1406
 
310
--error ER_DATA_TOO_LONG
311
311
insert into t1 (varbinarycol) values (repeat('x',256));
312
312
select * from t1;
313
313
drop table t1;
317
317
#
318
318
 
319
319
create table t1 (col1 char(3), col2 integer);
320
 
--error 1292
 
320
--error ER_TRUNCATED_WRONG_VALUE
321
321
insert into t1 (col1) values (cast(1000 as char(3)));
322
 
--error 1292
 
322
--error ER_TRUNCATED_WRONG_VALUE
323
323
insert into t1 (col1) values (cast(1000E+0 as char(3)));
324
 
--error 1292
 
324
--error ER_TRUNCATED_WRONG_VALUE
325
325
insert into t1 (col1) values (cast(1000.0 as char(3)));
326
 
--error 1292
 
326
--error ER_TRUNCATED_WRONG_VALUE
327
327
insert into t1 (col2) values (cast('abc' as DECIMAL));
328
 
--error 1292
 
328
--error ER_TRUNCATED_WRONG_VALUE
329
329
insert into t1 (col2) values (10E+0 + 'a');
330
 
--error 1265
 
330
--error ER_WARN_DATA_TRUNCATED
331
331
insert into t1 (col2) values ('10a');
332
332
insert into t1 (col2) values (cast('10a' as DECIMAL));
333
333
insert into t1 (col2) values (cast('10' as DECIMAL));
338
338
 
339
339
# Test fields with no default value that are NOT NULL (Bug #5986)
340
340
CREATE TABLE t1 (i int not null);
341
 
--error 1364
 
341
--error ER_NO_DEFAULT_FOR_FIELD
342
342
INSERT INTO t1 VALUES ();
343
 
--error 1364
 
343
--error ER_NO_DEFAULT_FOR_FIELD
344
344
INSERT INTO t1 VALUES (DEFAULT);
345
 
--error 1364
 
345
--error ER_NO_DEFAULT_FOR_FIELD
346
346
INSERT INTO t1 VALUES (DEFAULT(i));
347
347
ALTER TABLE t1 ADD j int;
348
 
--error 1364
 
348
--error ER_NO_DEFAULT_FOR_FIELD
349
349
INSERT INTO t1 SET j = 1;
350
 
--error 1364
 
350
--error ER_NO_DEFAULT_FOR_FIELD
351
351
INSERT INTO t1 SET j = 1, i = DEFAULT;
352
 
--error 1364
 
352
--error ER_NO_DEFAULT_FOR_FIELD
353
353
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
354
 
--error 1364
 
354
--error ER_NO_DEFAULT_FOR_FIELD
355
355
INSERT INTO t1 VALUES (DEFAULT,1);
356
356
DROP TABLE t1;
357
357
CREATE TABLE t1 (i int not null);
358
 
--error 1364
 
358
--error ER_NO_DEFAULT_FOR_FIELD
359
359
INSERT INTO t1 VALUES ();
360
 
--error 1364
 
360
--error ER_NO_DEFAULT_FOR_FIELD
361
361
INSERT INTO t1 VALUES (DEFAULT);
362
362
# DEFAULT(i) is an error even with the default sql_mode
363
 
--error 1364
 
363
--error ER_NO_DEFAULT_FOR_FIELD
364
364
INSERT INTO t1 VALUES (DEFAULT(i));
365
365
ALTER TABLE t1 ADD j int;
366
 
--error 1364
 
366
--error ER_NO_DEFAULT_FOR_FIELD
367
367
INSERT INTO t1 SET j = 1;
368
 
--error 1364
 
368
--error ER_NO_DEFAULT_FOR_FIELD
369
369
INSERT INTO t1 SET j = 1, i = DEFAULT;
370
 
--error 1364
 
370
--error ER_NO_DEFAULT_FOR_FIELD
371
371
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
372
 
--error 1364
 
372
--error ER_NO_DEFAULT_FOR_FIELD
373
373
INSERT INTO t1 VALUES (DEFAULT,1);
374
374
DROP TABLE t1;
375
375
 
377
377
# Bugs #8295 and #8296: varchar and varbinary conversion
378
378
#
379
379
 
380
 
--error 1074
 
380
--error ER_TOO_BIG_FIELDLENGTH
381
381
create table t1(a varchar(65537));
382
 
--error 1074
 
382
--error ER_TOO_BIG_FIELDLENGTH
383
383
create table t1(a varbinary(65537));
384
384
 
385
385
#
453
453
#
454
454
# Bug#27069 set with identical elements are created
455
455
#
456
 
--error 1291
 
456
--error ER_DUPLICATED_VALUE_IN_TYPE
457
457
create table t1 (f1 enum('a','a'));
458
458
 
459
459
--echo End of 5.0 tests