5
drop table if exists t1, t2;
9
# Test of reading of bigint values
11
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
12
select 9223372036854775807,-009223372036854775808;
13
select +9999999999999999999,-9999999999999999999;
14
select 9223372036854775808 +1;
15
select 9223372036854775808+1;
16
select -(0-3),round(-(0-3)), round(9999999999999999999);
17
select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
18
select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
21
# In 3.23 we have to disable the test of column to bigint as
22
# this fails on AIX powerpc (the resolution for double is not good enough)
23
# This will work on 4.0 as we then have internal handling of bigint variables.
26
create table t1 (a bigint unsigned not null, primary key(a));
27
insert into t1 values (9223372036854775808);
28
insert into t1 values (0x7000000000000000);
30
select * from t1 where a=18446744073709551615;
31
# select * from t1 where a='18446744073709551615';
32
delete from t1 where a=18446744073709551615;
36
create table t1 ( a int not null default 1, big bigint unsigned);
37
--error ER_WARN_DATA_OUT_OF_RANGE
38
insert into t1 (big) values (-1),(9223372036854775808),(9223372036854775807),(9223372036854775808);
39
--error ER_WARN_DATA_OUT_OF_RANGE
40
insert into t1 (big) values (-1);
41
insert into t1 (big) values (9223372036854775808),(9223372036854775807),(9223372036854775808);
43
select min(big),max(big),max(big)-1 from t1;
44
select min(big),max(big),max(big)-1 from t1 group by a;
45
alter table t1 modify big bigint not null;
46
select min(big),max(big),max(big)-1 from t1;
47
select min(big),max(big),max(big)-1 from t1 group by a;
48
--error ER_WARN_DATA_OUT_OF_RANGE
49
insert into t1 (big) values (9223372036854775808);
51
select min(big),max(big),max(big)-1 from t1;
52
select min(big),max(big),max(big)-1 from t1 group by a;
53
alter table t1 add key (big);
54
select min(big),max(big),max(big)-1 from t1;
55
select min(big),max(big),max(big)-1 from t1 group by a;
56
alter table t1 modify big bigint not null;
58
select min(big),max(big),max(big)-1 from t1;
59
select min(big),max(big),max(big)-1 from t1 group by a;
63
# Test problem with big values for auto_increment
66
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
67
insert into t1 values (null,1);
69
select * from t1 limit 9999999999;
73
# Item_uint::save_to_field()
75
# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
78
CREATE TABLE t1 ( quantity decimal(60,0));
79
insert into t1 values (10000000000000000000);
80
insert into t1 values (10000000000000000000.0);
81
insert into t1 values ('10000000000000000000');
85
# atof() behaviour is different of different systems. to be fixed in 4.1
86
SELECT '0x8000000000000001'+0;
88
# Test for BUG#8562: joins over BIGINT value + constant propagation
90
value64 bigint unsigned not null,
91
value32 integer not null,
92
primary key(value64, value32)
96
value64 bigint unsigned not null,
97
value32 integer not null,
98
primary key(value64, value32)
101
insert into t1 values(17156792991891826145, 1);
102
insert into t1 values( 9223372036854775807, 2);
103
insert into t2 values(17156792991891826145, 3);
104
insert into t2 values( 9223372036854775807, 4);
106
select * from t1 ORDER BY value32;
107
select * from t2 ORDER BY value32;
110
select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=17156792991891826145;
112
select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=t1.value64;
115
select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=9223372036854775807;
117
select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=t1.value64;
121
# Test for BUG#30069, can't handle bigint -9223372036854775808 on
122
# x86_64, with some GCC versions and optimizations.
124
create table t1 (sint64 bigint not null);
125
insert into t1 values (-9223372036854775808);
133
# Test of CREATE ... SELECT and integers
136
create table t1 select 1 as 'a';
137
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
138
show create table t1;
141
create table t1 select 9223372036854775809 as 'a';
142
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
143
show create table t1;
146
create table t1 select 72036854775809 as 'a';
147
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
148
show create table t1;
152
DROP DATABASE IF EXISTS `scott`;
156
# Check various conversions from/to bigint.
159
create table t1 (a char(100), b varchar(100), c text, d blob);
160
insert into t1 values(
161
18446744073709551615,18446744073709551615,
162
18446744073709551615, 18446744073709551615
165
insert into t1 values (-1,-1,-1,-1);
170
create table t1 ( quantity decimal(2));
171
insert into t1 values (50), (-50), (0), (-1);
177
# Test of storing decimal values in BIGINT range
178
# (Bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0))
200
`col19` DECIMAL(19, 0) NULL,
201
`col20` DECIMAL(20, 0) NULL,
202
`col21` DECIMAL(21, 0) NULL,
203
`col22` DECIMAL(22, 0) NULL,
204
`col23` DECIMAL(23, 0) NULL,
205
`col24` DECIMAL(24, 0) NULL,
206
`col25` DECIMAL(25, 0) NULL,
207
`col26` DECIMAL(26, 0) NULL,
208
`col27` DECIMAL(27, 0) NULL,
209
`col28` DECIMAL(28, 0) NULL,
210
`col29` DECIMAL(29, 0) NULL,
211
`col30` DECIMAL(30, 0) NULL,
212
`col31` DECIMAL(31, 0) NULL,
213
`col32` DECIMAL(32, 0) NULL,
214
`col33` DECIMAL(33, 0) NULL,
215
`col34` DECIMAL(34, 0) NULL,
216
`col35` DECIMAL(35, 0) NULL,
217
`col36` DECIMAL(36, 0) NULL,
218
`col37` DECIMAL(37, 0) NULL,
219
`col38` DECIMAL(38, 0) NULL,
220
`fix1` DECIMAL(38, 1) NULL,
221
`fix2` DECIMAL(38, 2) NULL,
222
`fix3` DECIMAL(38, 3) NULL,
223
`fix4` DECIMAL(38, 4) NULL,
224
`fix5` DECIMAL(38, 5) NULL,
225
`fix6` DECIMAL(38, 6) NULL,
226
`fix7` DECIMAL(38, 7) NULL,
227
`fix8` DECIMAL(38, 8) NULL,
228
`fix9` DECIMAL(38, 9) NULL,
229
`fix10` DECIMAL(38, 10) NULL,
230
`fix11` DECIMAL(38, 11) NULL,
231
`fix12` DECIMAL(38, 12) NULL,
232
`fix13` DECIMAL(38, 13) NULL,
233
`fix14` DECIMAL(38, 14) NULL,
234
`fix15` DECIMAL(38, 15) NULL,
235
`fix16` DECIMAL(38, 16) NULL,
236
`fix17` DECIMAL(38, 17) NULL,
237
`fix18` DECIMAL(38, 18) NULL,
238
`fix19` DECIMAL(38, 19) NULL,
239
`fix20` DECIMAL(38, 20) NULL,
240
`fix21` DECIMAL(38, 21) NULL,
241
`fix22` DECIMAL(38, 22) NULL,
242
`fix23` DECIMAL(38, 23) NULL,
243
`fix24` DECIMAL(38, 24) NULL,
244
`fix25` DECIMAL(38, 25) NULL,
245
`fix26` DECIMAL(38, 26) NULL,
246
`fix27` DECIMAL(38, 27) NULL,
247
`fix28` DECIMAL(38, 28) NULL,
248
`fix29` DECIMAL(38, 29) NULL,
249
`fix30` DECIMAL(38, 30) NULL
252
INSERT INTO t1(`col1`, `col2`, `col3`, `col4`, `col5`, `col6`, `col7`, `col8`, `col9`, `col10`, `col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`, `col19`, `col20`, `col21`, `col22`, `col23`, `col24`, `col25`, `col26`, `col27`, `col28`, `col29`, `col30`, `col31`, `col32`, `col33`, `col34`, `col35`, `col36`, `col37`, `col38`, `fix1`, `fix2`, `fix3`, `fix4`, `fix5`, `fix6`, `fix7`, `fix8`, `fix9`, `fix10`, `fix11`, `fix12`, `fix13`, `fix14`, `fix15`, `fix16`, `fix17`, `fix18`, `fix19`, `fix20`, `fix21`, `fix22`, `fix23`, `fix24`, `fix25`, `fix26`, `fix27`, `fix28`, `fix29`, `fix30`)
253
VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
254
9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999,
255
999999999999999, 9999999999999999, 99999999999999999, 999999999999999999,
256
9999999999999999999, 99999999999999999999, 999999999999999999999,
257
9999999999999999999999, 99999999999999999999999, 999999999999999999999999,
258
9999999999999999999999999, 99999999999999999999999999,
259
999999999999999999999999999, 9999999999999999999999999999,
260
99999999999999999999999999999, 999999999999999999999999999999,
261
9999999999999999999999999999999, 99999999999999999999999999999999,
262
999999999999999999999999999999999, 9999999999999999999999999999999999,
263
99999999999999999999999999999999999, 999999999999999999999999999999999999,
264
9999999999999999999999999999999999999, 99999999999999999999999999999999999999,
265
9999999999999999999999999999999999999.9,
266
999999999999999999999999999999999999.99,
267
99999999999999999999999999999999999.999,
268
9999999999999999999999999999999999.9999,
269
999999999999999999999999999999999.99999,
270
99999999999999999999999999999999.999999,
271
9999999999999999999999999999999.9999999,
272
999999999999999999999999999999.99999999,
273
99999999999999999999999999999.999999999,
274
9999999999999999999999999999.9999999999,
275
999999999999999999999999999.99999999999,
276
99999999999999999999999999.999999999999,
277
9999999999999999999999999.9999999999999,
278
999999999999999999999999.99999999999999,
279
99999999999999999999999.999999999999999,
280
9999999999999999999999.9999999999999999,
281
999999999999999999999.99999999999999999,
282
99999999999999999999.999999999999999999,
283
9999999999999999999.9999999999999999999,
284
999999999999999999.99999999999999999999,
285
99999999999999999.999999999999999999999,
286
9999999999999999.9999999999999999999999,
287
999999999999999.99999999999999999999999,
288
99999999999999.999999999999999999999999,
289
9999999999999.9999999999999999999999999,
290
999999999999.99999999999999999999999999,
291
99999999999.999999999999999999999999999,
292
9999999999.9999999999999999999999999999,
293
999999999.99999999999999999999999999999,
294
99999999.999999999999999999999999999999);
300
#bug #9088 BIGINT WHERE CLAUSE
301
create table t1 (bigint_col bigint unsigned);
302
insert into t1 values (17666000000000000000);
303
select * from t1 where bigint_col=17666000000000000000;
304
select * from t1 where bigint_col='17666000000000000000';
308
--echo bug 19955 -- mod is signed with bigint
310
select 10000002383263201056 mod 50 as result;
312
create table t1 (c1 bigint unsigned);
313
insert into t1 values (10000002383263201056);
314
select c1 mod 50 as result from t1;
318
# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
321
# PS protocol gives different metadata for `Max length' column
322
--disable_ps_protocol
324
select -9223372036854775808;
325
select -(9223372036854775808);
326
select -((9223372036854775808));
327
select -(-(9223372036854775808));
330
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
331
select -(-9223372036854775808), -(-(-9223372036854775808));
333
# Bug #28005 Partitions: can't use -9223372036854775808
334
create table t1 select -9223372036854775808 bi;
337
create table t1 select -9223372036854775809 bi;