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 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 );
37
insert into t1 (big) values (-1),(9223372036854775808),(9223372036854775807),(9223372036854775808);
39
select min(big),max(big),max(big)-1 from t1;
40
select min(big),max(big),max(big)-1 from t1 group by a;
41
alter table t1 modify big bigint not null;
42
select min(big),max(big),max(big)-1 from t1;
43
select min(big),max(big),max(big)-1 from t1 group by a;
44
insert into t1 (big) values (9223372036854775808);
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
alter table t1 add key (big);
49
select min(big),max(big),max(big)-1 from t1;
50
select min(big),max(big),max(big)-1 from t1 group by a;
51
alter table t1 modify big bigint not null;
53
select min(big),max(big),max(big)-1 from t1;
54
select min(big),max(big),max(big)-1 from t1 group by a;
58
# Test problem with big values for auto_increment
61
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
62
insert into t1 values (null,1);
64
select * from t1 limit 9999999999;
68
# Item_uint::save_to_field()
70
# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
73
CREATE TABLE t1 ( quantity decimal(60,0));
74
insert into t1 values (10000000000000000000);
75
insert into t1 values (10000000000000000000.0);
76
insert into t1 values ('10000000000000000000');
80
# atof() behaviour is different of different systems. to be fixed in 4.1
81
SELECT '0x8000000000000001'+0;
83
# Test for BUG#8562: joins over BIGINT value + constant propagation
85
value64 bigint not null,
86
value32 integer not null,
87
primary key(value64, value32)
91
value64 bigint not null,
92
value32 integer not null,
93
primary key(value64, value32)
96
insert into t1 values(17156792991891826145, 1);
97
insert into t1 values( 9223372036854775807, 2);
98
insert into t2 values(17156792991891826145, 3);
99
insert into t2 values( 9223372036854775807, 4);
104
select * from t1, t2 where t1.value64=17156792991891826145 and
105
t2.value64=17156792991891826145;
106
select * from t1, t2 where t1.value64=17156792991891826145 and
107
t2.value64=t1.value64;
109
select * from t1, t2 where t1.value64= 9223372036854775807 and
110
t2.value64=9223372036854775807;
111
select * from t1, t2 where t1.value64= 9223372036854775807 and
112
t2.value64=t1.value64;
116
# Test for BUG#30069, can't handle bigint -9223372036854775808 on
117
# x86_64, with some GCC versions and optimizations.
119
create table t1 (sint64 bigint not null);
120
insert into t1 values (-9223372036854775808);
128
# Test of CREATE ... SELECT and integers
131
create table t1 select 1 as 'a';
132
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
133
show create table t1;
135
create table t1 select 9223372036854775809 as 'a';
136
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
137
show create table t1;
140
DROP DATABASE IF EXISTS `scott`;
144
# Check various conversions from/to bigint.
147
create table t1 (a char(100), b varchar(100), c text, d blob);
148
insert into t1 values(
149
18446744073709551615,18446744073709551615,
150
18446744073709551615, 18446744073709551615
153
insert into t1 values (-1,-1,-1,-1);
157
create table t1 ( quantity decimal(2));
158
insert into t1 values (50), (-50), (0), (-1);
163
# Test of storing decimal values in BIGINT range
164
# (Bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0))
186
`col19` DECIMAL(19, 0) NULL,
187
`col20` DECIMAL(20, 0) NULL,
188
`col21` DECIMAL(21, 0) NULL,
189
`col22` DECIMAL(22, 0) NULL,
190
`col23` DECIMAL(23, 0) NULL,
191
`col24` DECIMAL(24, 0) NULL,
192
`col25` DECIMAL(25, 0) NULL,
193
`col26` DECIMAL(26, 0) NULL,
194
`col27` DECIMAL(27, 0) NULL,
195
`col28` DECIMAL(28, 0) NULL,
196
`col29` DECIMAL(29, 0) NULL,
197
`col30` DECIMAL(30, 0) NULL,
198
`col31` DECIMAL(31, 0) NULL,
199
`col32` DECIMAL(32, 0) NULL,
200
`col33` DECIMAL(33, 0) NULL,
201
`col34` DECIMAL(34, 0) NULL,
202
`col35` DECIMAL(35, 0) NULL,
203
`col36` DECIMAL(36, 0) NULL,
204
`col37` DECIMAL(37, 0) NULL,
205
`col38` DECIMAL(38, 0) NULL,
206
`fix1` DECIMAL(38, 1) NULL,
207
`fix2` DECIMAL(38, 2) NULL,
208
`fix3` DECIMAL(38, 3) NULL,
209
`fix4` DECIMAL(38, 4) NULL,
210
`fix5` DECIMAL(38, 5) NULL,
211
`fix6` DECIMAL(38, 6) NULL,
212
`fix7` DECIMAL(38, 7) NULL,
213
`fix8` DECIMAL(38, 8) NULL,
214
`fix9` DECIMAL(38, 9) NULL,
215
`fix10` DECIMAL(38, 10) NULL,
216
`fix11` DECIMAL(38, 11) NULL,
217
`fix12` DECIMAL(38, 12) NULL,
218
`fix13` DECIMAL(38, 13) NULL,
219
`fix14` DECIMAL(38, 14) NULL,
220
`fix15` DECIMAL(38, 15) NULL,
221
`fix16` DECIMAL(38, 16) NULL,
222
`fix17` DECIMAL(38, 17) NULL,
223
`fix18` DECIMAL(38, 18) NULL,
224
`fix19` DECIMAL(38, 19) NULL,
225
`fix20` DECIMAL(38, 20) NULL,
226
`fix21` DECIMAL(38, 21) NULL,
227
`fix22` DECIMAL(38, 22) NULL,
228
`fix23` DECIMAL(38, 23) NULL,
229
`fix24` DECIMAL(38, 24) NULL,
230
`fix25` DECIMAL(38, 25) NULL,
231
`fix26` DECIMAL(38, 26) NULL,
232
`fix27` DECIMAL(38, 27) NULL,
233
`fix28` DECIMAL(38, 28) NULL,
234
`fix29` DECIMAL(38, 29) NULL,
235
`fix30` DECIMAL(38, 30) NULL
238
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`)
239
VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
240
9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999,
241
999999999999999, 9999999999999999, 99999999999999999, 999999999999999999,
242
9999999999999999999, 99999999999999999999, 999999999999999999999,
243
9999999999999999999999, 99999999999999999999999, 999999999999999999999999,
244
9999999999999999999999999, 99999999999999999999999999,
245
999999999999999999999999999, 9999999999999999999999999999,
246
99999999999999999999999999999, 999999999999999999999999999999,
247
9999999999999999999999999999999, 99999999999999999999999999999999,
248
999999999999999999999999999999999, 9999999999999999999999999999999999,
249
99999999999999999999999999999999999, 999999999999999999999999999999999999,
250
9999999999999999999999999999999999999, 99999999999999999999999999999999999999,
251
9999999999999999999999999999999999999.9,
252
999999999999999999999999999999999999.99,
253
99999999999999999999999999999999999.999,
254
9999999999999999999999999999999999.9999,
255
999999999999999999999999999999999.99999,
256
99999999999999999999999999999999.999999,
257
9999999999999999999999999999999.9999999,
258
999999999999999999999999999999.99999999,
259
99999999999999999999999999999.999999999,
260
9999999999999999999999999999.9999999999,
261
999999999999999999999999999.99999999999,
262
99999999999999999999999999.999999999999,
263
9999999999999999999999999.9999999999999,
264
999999999999999999999999.99999999999999,
265
99999999999999999999999.999999999999999,
266
9999999999999999999999.9999999999999999,
267
999999999999999999999.99999999999999999,
268
99999999999999999999.999999999999999999,
269
9999999999999999999.9999999999999999999,
270
999999999999999999.99999999999999999999,
271
99999999999999999.999999999999999999999,
272
9999999999999999.9999999999999999999999,
273
999999999999999.99999999999999999999999,
274
99999999999999.999999999999999999999999,
275
9999999999999.9999999999999999999999999,
276
999999999999.99999999999999999999999999,
277
99999999999.999999999999999999999999999,
278
9999999999.9999999999999999999999999999,
279
999999999.99999999999999999999999999999,
280
99999999.999999999999999999999999999999);
285
#bug #9088 BIGINT WHERE CLAUSE
286
create table t1 (bigint_col bigint);
287
insert into t1 values (17666000000000000000);
288
select * from t1 where bigint_col=17666000000000000000;
289
select * from t1 where bigint_col='17666000000000000000';
293
--echo bug 19955 -- mod is signed with bigint
295
select 10000002383263201056 mod 50 as result;
297
create table t1 (c1 bigint);
298
insert into t1 values (10000002383263201056);
299
select c1 mod 50 as result from t1;
303
# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
306
# PS protocol gives different metadata for `Max length' column
307
--disable_ps_protocol
309
select -9223372036854775808;
310
select -(9223372036854775808);
311
select -((9223372036854775808));
312
select -(-(9223372036854775808));
315
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
316
select -(-9223372036854775808), -(-(-9223372036854775808));
318
# Bug #28005 Partitions: can't use -9223372036854775808
319
create table t1 select -9223372036854775808 bi;
322
create table t1 select -9223372036854775809 bi;