~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/t/type_decimal.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-11-12 12:26:01 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101112122601-myppfj3tfmlkccuq
Tags: upstream-2010.11.03
ImportĀ upstreamĀ versionĀ 2010.11.03

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
insert into t1 values ("00000000000001");
175
175
insert into t1 values ("+0000000000001");
176
176
insert into t1 values ("-0000000000001");
177
 
--error 1264 out of range value
 
177
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
178
178
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
179
 
--error 1264 out of range value
 
179
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
180
180
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
181
 
--error 1366 incorrect decimal value
 
181
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
182
182
insert into t1 values ("1e+1000");
183
 
--error 1366 incorrect decimal value
 
183
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
184
184
insert into t1 values ("1e-1000");
185
 
--error 1366 incorrect decimal value
 
185
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
186
186
insert into t1 values ("-1e+1000");
187
 
--error 1366 incorrect decimal value
 
187
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
188
188
insert into t1 values ("1e+4294967296");
189
 
--error 1366 incorrect decimal value
 
189
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
190
190
insert into t1 values ("1e-4294967296");
191
 
--error 1366 incorrect decimal value
 
191
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
192
192
insert into t1 values ("1e+18446744073709551615");
193
 
--error 1366 incorrect decimal value
 
193
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
194
194
insert into t1 values ("1e+18446744073709551616");
195
 
--error 1366 incorrect decimal value
 
195
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
196
196
insert into t1 values ("1e-9223372036854775807");
197
 
--error 1366 incorrect decimal value
 
197
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
198
198
insert into t1 values ("1e-9223372036854775809");
199
 
--error 1366 incorrect decimal value
200
 
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
201
 
select * from t1;
202
 
drop  table t1;
203
 
 
204
 
create table t1 (a decimal(10,2));
205
 
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
206
 
insert into t1 values ("-.1"),("+.1"),(".1");
207
 
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
208
 
--error 1264 out of range value
209
 
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
210
 
--error 1264 out of range value
211
 
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
212
 
--error 1366 incorrect decimal value
213
 
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
214
 
--error 1366 incorrect decimal value
215
 
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
216
 
select * from t1;
217
 
drop  table t1;
218
 
 
219
 
create table t1 (a decimal(10,2));
220
 
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
221
 
insert into t1 values ("-.1"),("+.1"),(".1");
222
 
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
223
 
--error 1264 out of range value
224
 
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
225
 
--error 1264 out of range value
226
 
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
227
 
--error 1366 incorrect decimal value
228
 
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
229
 
--error 1366 incorrect decimal value
 
199
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
 
200
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
 
201
select * from t1;
 
202
drop  table t1;
 
203
 
 
204
create table t1 (a decimal(10,2));
 
205
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
 
206
insert into t1 values ("-.1"),("+.1"),(".1");
 
207
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
 
208
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
209
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
 
210
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
211
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
 
212
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
 
213
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
 
214
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
 
215
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
 
216
select * from t1;
 
217
drop  table t1;
 
218
 
 
219
create table t1 (a decimal(10,2));
 
220
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
 
221
insert into t1 values ("-.1"),("+.1"),(".1");
 
222
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
 
223
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
224
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
 
225
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
226
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
 
227
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
 
228
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
 
229
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
230
230
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
231
231
select * from t1;
232
232
drop  table t1;
237
237
insert into t1 values (0.0),("-0.0"),(+0.0),(01.0),(+01.0),(-01.0);
238
238
insert into t1 values (-.1),(+.1),(.1);
239
239
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
240
 
--error 1264 out of range value
 
240
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
241
241
insert into t1 values (+111111111.11),(111111111.11),(-11111111.11);
242
 
--error 1264 out of range value
 
242
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
243
243
insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
244
 
--error 1264 out of range value
 
244
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
245
245
insert into t1 values (1e+100),(1e-100),(-1e+100);
246
246
insert into t1 values (123.4e0);
247
247
insert into t1 values (123.4e+2);
248
248
# This INSERT statement will give an error since truncation of a
249
249
# decimal number in Drizzle is an error. See bug#337038 for further
250
250
# details.
251
 
--error 1265
 
251
--error ER_WARN_DATA_TRUNCATED
252
252
insert into t1 values (123.4e-2);
253
253
insert into t1 values (123e1);
254
254
insert into t1 values (123e+0);
263
263
#
264
264
 
265
265
create table t1 (a decimal);
266
 
--error 1264 out of range value
 
266
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
267
267
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
268
268
select * from t1;
269
269
drop  table t1;
270
270
create table t1 (a decimal);
271
 
--error 1264 out of range value
272
 
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
273
 
select * from t1;
274
 
drop  table t1;
275
 
create table t1 (a decimal);
276
 
--error 1264 out of range value
277
 
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
278
 
select * from t1;
279
 
drop  table t1;
280
 
create table t1 (a decimal);
281
 
--error 1264 out of range value
 
271
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
272
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
 
273
select * from t1;
 
274
drop  table t1;
 
275
create table t1 (a decimal);
 
276
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
277
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
 
278
select * from t1;
 
279
drop  table t1;
 
280
create table t1 (a decimal);
 
281
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
282
282
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
283
283
select * from t1;
284
284
drop  table t1;
285
285
 
286
286
#  Exponent overflow bug
287
287
create table t1(a decimal(10,0));
288
 
--error 1366 incorrect decimal value
 
288
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
289
289
insert into t1 values ("1e4294967295");
290
290
select * from t1;
291
291
delete from t1;
292
 
--error 1366 incorrect decimal value
 
292
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD incorrect decimal value
293
293
insert into t1 values("1e4294967297");
294
294
select * from t1;
295
295
drop table t1;
298
298
# Test of wrong decimal type
299
299
#
300
300
 
301
 
--error 1064
 
301
--error ER_PARSE_ERROR
302
302
CREATE TABLE t1 (a_dec DECIMAL(-1,0));
303
 
--error 1064
 
303
--error ER_PARSE_ERROR
304
304
CREATE TABLE t1 (a_dec DECIMAL(-2,1));
305
 
--error 1064
 
305
--error ER_PARSE_ERROR
306
306
CREATE TABLE t1 (a_dec DECIMAL(-1,1));
307
 
--error 1427
 
307
--error ER_M_BIGGER_THAN_D
308
308
CREATE TABLE t1 (a_dec DECIMAL(0,11));
309
309
 
310
310
#
312
312
#
313
313
--disable_warnings
314
314
create table t1(a decimal(7,3));
315
 
--error 1264 out of range value
316
 
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
317
 
select * from t1;
318
 
drop table t1;
319
 
create table t1(a decimal(7,3));
320
 
--error 1264 out of range value
321
 
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
322
 
select * from t1;
323
 
drop table t1;
324
 
create table t1(a decimal(7,3));
325
 
--error 1264 out of range value
 
315
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
316
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
 
317
select * from t1;
 
318
drop table t1;
 
319
create table t1(a decimal(7,3));
 
320
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
 
321
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
 
322
select * from t1;
 
323
drop table t1;
 
324
create table t1(a decimal(7,3));
 
325
--error ER_WARN_DATA_OUT_OF_RANGE out of range value
326
326
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
327
327
--enable_warnings
328
328
select * from t1;
374
374
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
375
375
show create table t1;
376
376
drop table t1;
377
 
--error 1426
 
377
--error ER_TOO_BIG_PRECISION
378
378
create table t1 (d decimal(66,0));
379
379
 
380
380
#
447
447
#
448
448
# Bug#22183: Unhandled NULL caused server crash
449
449
#
450
 
--error 1689 # 1 is not a valid Julian Day Number for SQL date range
 
450
--error ER_ARGUMENT_OUT_OF_RANGE # 1 is not a valid Julian Day Number for SQL date range
451
451
create table t1 as
452
452
 select from_days(s) as date,t
453
453
 from (select 1 as s,'t' as t union select null, null ) as sub1;
548
548
# This INSERT statement will give an error since truncation of a
549
549
# decimal number in Drizzle is an error. See bug#337038 for further
550
550
# details.
551
 
--error 1265
 
551
--error ER_WARN_DATA_TRUNCATED
552
552
INSERT INTO t1 VALUES (999.99, 5);
553
553
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
554
554
show create table t1;