~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/bigint.test

pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
12
12
select 9223372036854775807,-009223372036854775808;
13
13
select +9999999999999999999,-9999999999999999999;
14
 
select cast(9223372036854775808 as unsigned)+1;
 
14
select 9223372036854775808 +1;
15
15
select 9223372036854775808+1;
16
16
select -(0-3),round(-(0-3)), round(9999999999999999999);
17
17
select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
18
18
select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
19
 
select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16);
20
19
 
21
20
#
22
21
# In 3.23 we have to disable the test of column to bigint as
24
23
# This will work on 4.0 as we then have internal handling of bigint variables.
25
24
#
26
25
 
27
 
create table t1 (a bigint unsigned not null, primary key(a));
28
 
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
 
26
create table t1 (a bigint not null, primary key(a));
 
27
insert into t1 values (9223372036854775808);
 
28
insert into t1 values (0x7000000000000000);
29
29
select * from t1;
30
30
select * from t1 where a=18446744073709551615;
31
31
# select * from t1 where a='18446744073709551615';
34
34
drop table t1;
35
35
 
36
36
create table t1 ( a int not null default 1, big bigint );
37
 
insert into t1 (big) values (-1),(12345678901234567),(9223372036854775807),(18446744073709551615);
 
37
insert into t1 (big) values (-1),(9223372036854775808),(9223372036854775807),(9223372036854775808);
38
38
select * from t1;
39
39
select min(big),max(big),max(big)-1 from t1;
40
40
select min(big),max(big),max(big)-1 from t1 group by a;
41
 
alter table t1 modify big bigint unsigned not null;
 
41
alter table t1 modify big bigint not null;
42
42
select min(big),max(big),max(big)-1 from t1;
43
43
select min(big),max(big),max(big)-1 from t1 group by a;
44
 
insert into t1 (big) values (18446744073709551615);
 
44
insert into t1 (big) values (9223372036854775808);
45
45
select * from t1;
46
46
select min(big),max(big),max(big)-1 from t1;
47
47
select min(big),max(big),max(big)-1 from t1 group by a;
80
80
# atof() behaviour is different of different systems. to be fixed in 4.1
81
81
SELECT '0x8000000000000001'+0;
82
82
 
83
 
# Test for BUG#8562: joins over BIGINT UNSIGNED value + constant propagation
 
83
# Test for BUG#8562: joins over BIGINT value + constant propagation
84
84
create table t1 (
85
 
 value64  bigint unsigned  not null,
 
85
 value64  bigint  not null,
86
86
 value32  integer          not null,
87
87
 primary key(value64, value32)
88
88
);
89
89
 
90
90
create table t2 (
91
 
 value64  bigint unsigned  not null,
 
91
 value64  bigint  not null,
92
92
 value32  integer          not null,
93
93
 primary key(value64, value32)
94
94
);
125
125
# End of 4.1 tests
126
126
 
127
127
#
128
 
# Test of CREATE ... SELECT and unsigned integers
 
128
# Test of CREATE ... SELECT and integers
129
129
#
130
130
 
131
131
create table t1 select 1 as 'a';
139
139
 
140
140
 
141
141
#
142
 
# Check various conversions from/to unsigned bigint.
 
142
# Check various conversions from/to bigint.
143
143
#
144
144
 
145
145
create table t1 (a char(100), b varchar(100), c text, d blob);
148
148
  18446744073709551615, 18446744073709551615
149
149
);
150
150
 
151
 
insert into t1 values (-1 | 0,-1 | 0,-1 | 0 ,-1 | 0);
 
151
insert into t1 values (-1,-1,-1,-1);
152
152
select * from t1;
153
153
drop table t1;
154
154
 
155
 
create table t1 ( quantity decimal(2) unsigned);
156
 
insert into t1 values (500), (-500), (~0), (-1);
 
155
create table t1 ( quantity decimal(2));
 
156
insert into t1 values (50), (-50), (0), (-1);
157
157
select * from t1;
158
158
drop table t1;
159
159
 
163
163
#
164
164
 
165
165
CREATE TABLE t1 (
166
 
  `col1` INT(1) NULL,
167
 
  `col2` INT(2) NULL,
168
 
  `col3` INT(3) NULL,
169
 
  `col4` INT(4) NULL,
170
 
  `col5` INT(5) NULL,
171
 
  `col6` INT(6) NULL,
172
 
  `col7` INT(7) NULL,
173
 
  `col8` INT(8) NULL,
174
 
  `col9` INT(9) NULL,
175
 
  `col10` BIGINT(10) NULL,
176
 
  `col11` BIGINT(11) NULL,
177
 
  `col12` BIGINT(12) NULL,
178
 
  `col13` BIGINT(13) NULL,
179
 
  `col14` BIGINT(14) NULL,
180
 
  `col15` BIGINT(15) NULL,
181
 
  `col16` BIGINT(16) NULL,
182
 
  `col17` BIGINT(17) NULL,
183
 
  `col18` BIGINT(18) NULL,
 
166
  `col1` INT NULL,
 
167
  `col2` INT NULL,
 
168
  `col3` INT NULL,
 
169
  `col4` INT NULL,
 
170
  `col5` INT NULL,
 
171
  `col6` INT NULL,
 
172
  `col7` INT NULL,
 
173
  `col8` INT NULL,
 
174
  `col9` INT NULL,
 
175
  `col10` BIGINT NULL,
 
176
  `col11` BIGINT NULL,
 
177
  `col12` BIGINT NULL,
 
178
  `col13` BIGINT NULL,
 
179
  `col14` BIGINT NULL,
 
180
  `col15` BIGINT NULL,
 
181
  `col16` BIGINT NULL,
 
182
  `col17` BIGINT NULL,
 
183
  `col18` BIGINT NULL,
184
184
  `col19` DECIMAL(19, 0) NULL,
185
185
  `col20` DECIMAL(20, 0) NULL,
186
186
  `col21` DECIMAL(21, 0) NULL,
281
281
DROP TABLE t1;
282
282
 
283
283
#bug #9088 BIGINT WHERE CLAUSE
284
 
create table t1 (bigint_col bigint unsigned);
 
284
create table t1 (bigint_col bigint);
285
285
insert into t1 values (17666000000000000000);
286
286
select * from t1 where bigint_col=17666000000000000000;
287
287
select * from t1 where bigint_col='17666000000000000000';
290
290
--echo
291
291
--echo bug 19955 -- mod is signed with bigint
292
292
 
293
 
select cast(10000002383263201056 as unsigned) mod 50 as result;
 
293
select 10000002383263201056 mod 50 as result;
294
294
 
295
 
create table t1 (c1 bigint unsigned);
 
295
create table t1 (c1 bigint);
296
296
insert into t1 values (10000002383263201056);
297
297
select c1 mod 50 as result from t1;
298
298
drop table t1;
299
299
 
300
300
#
301
 
# Bug #8663 cant use bgint unsigned as input to cast
302
 
#
303
 
 
304
 
select cast(19999999999999999999 as signed);
305
 
select cast(-19999999999999999999 as signed);
306
 
 
307
 
#
308
301
# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
309
302
#
310
303