~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/bigint.test

  • Committer: Jay Pipes
  • Date: 2008-07-18 20:20:47 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080718202047-1tnd4i9z3k3cvg9v
DBUG entirely removed from server and client

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Initialize
3
 
 
4
 
--disable_warnings
5
 
drop table if exists t1, t2;
6
 
--enable_warnings
7
 
 
8
 
#
9
 
# Test of reading of bigint values
10
 
#
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;
19
 
 
20
 
#
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.
24
 
#
25
 
 
26
 
create table t1 (a bigint unsigned not null, primary key(a));
27
 
insert into t1 values (9223372036854775808);
28
 
insert into t1 values (0x7000000000000000);
29
 
select * from t1;
30
 
select * from t1 where a=18446744073709551615;
31
 
# select * from t1 where a='18446744073709551615';
32
 
delete from t1 where a=18446744073709551615;
33
 
select * from t1;
34
 
drop table t1;
35
 
 
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);
42
 
select * from t1;
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);
50
 
select * from t1;
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;
57
 
select * from t1;
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;
60
 
drop table t1;
61
 
 
62
 
#
63
 
# Test problem with big values for auto_increment
64
 
#
65
 
 
66
 
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
67
 
insert into t1 values (null,1);
68
 
select * from t1;
69
 
select * from t1 limit 9999999999;
70
 
drop table t1;
71
 
 
72
 
#
73
 
# Item_uint::save_to_field()
74
 
# BUG#1845
75
 
# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
76
 
#
77
 
 
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');
82
 
select * from t1;
83
 
drop table t1;
84
 
 
85
 
# atof() behaviour is different of different systems. to be fixed in 4.1
86
 
SELECT '0x8000000000000001'+0;
87
 
 
88
 
# Test for BUG#8562: joins over BIGINT value + constant propagation
89
 
create table t1 (
90
 
 value64  bigint  unsigned not null,
91
 
 value32  integer          not null,
92
 
 primary key(value64, value32)
93
 
);
94
 
 
95
 
create table t2 (
96
 
 value64  bigint unsigned not null,
97
 
 value32  integer          not null,
98
 
 primary key(value64, value32)
99
 
);
100
 
 
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);
105
 
 
106
 
select * from t1 ORDER BY value32;
107
 
select * from t2 ORDER BY value32;
108
 
 
109
 
--sorted_result
110
 
select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=17156792991891826145;
111
 
--sorted_result
112
 
select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=t1.value64;
113
 
 
114
 
--sorted_result
115
 
select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=9223372036854775807;
116
 
--sorted_result
117
 
select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=t1.value64;
118
 
 
119
 
drop table t1, t2;
120
 
 
121
 
# Test for BUG#30069, can't handle bigint -9223372036854775808 on
122
 
# x86_64, with some GCC versions and optimizations.
123
 
 
124
 
create table t1 (sint64 bigint not null);
125
 
insert into t1 values (-9223372036854775808);
126
 
select * from t1;
127
 
 
128
 
drop table t1;
129
 
 
130
 
# End of 4.1 tests
131
 
 
132
 
#
133
 
# Test of CREATE ... SELECT and integers
134
 
#
135
 
 
136
 
create table t1 select 1 as 'a';
137
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
138
 
show create table t1;
139
 
drop table t1;
140
 
 
141
 
create table t1 select 9223372036854775809 as 'a';
142
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
143
 
show create table t1;
144
 
drop table t1;
145
 
 
146
 
create table t1 select 72036854775809 as 'a';
147
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
148
 
show create table t1;
149
 
select * from t1;
150
 
drop table t1;
151
 
 
152
 
DROP DATABASE IF EXISTS `scott`;
153
 
 
154
 
 
155
 
#
156
 
# Check various conversions from/to bigint.
157
 
#
158
 
 
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
163
 
);
164
 
 
165
 
insert into t1 values (-1,-1,-1,-1);
166
 
--sorted_result
167
 
select * from t1;
168
 
drop table t1;
169
 
 
170
 
create table t1 ( quantity decimal(2));
171
 
insert into t1 values (50), (-50), (0), (-1);
172
 
--sorted_result
173
 
select * from t1;
174
 
drop table t1;
175
 
 
176
 
#
177
 
# Test of storing decimal values in BIGINT range
178
 
# (Bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0))
179
 
#
180
 
 
181
 
CREATE TABLE t1 (
182
 
  `col1` INT NULL,
183
 
  `col2` INT NULL,
184
 
  `col3` INT NULL,
185
 
  `col4` INT NULL,
186
 
  `col5` INT NULL,
187
 
  `col6` INT NULL,
188
 
  `col7` INT NULL,
189
 
  `col8` INT NULL,
190
 
  `col9` INT NULL,
191
 
  `col10` BIGINT NULL,
192
 
  `col11` BIGINT NULL,
193
 
  `col12` BIGINT NULL,
194
 
  `col13` BIGINT NULL,
195
 
  `col14` BIGINT NULL,
196
 
  `col15` BIGINT NULL,
197
 
  `col16` BIGINT NULL,
198
 
  `col17` BIGINT NULL,
199
 
  `col18` BIGINT NULL,
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
250
 
);
251
 
 
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);
295
 
 
296
 
--sorted_result
297
 
SELECT * FROM t1;
298
 
DROP TABLE t1;
299
 
 
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';
305
 
drop table t1;
306
 
 
307
 
--echo
308
 
--echo bug 19955 -- mod is signed with bigint
309
 
 
310
 
select 10000002383263201056 mod 50 as result;
311
 
 
312
 
create table t1 (c1 bigint unsigned);
313
 
insert into t1 values (10000002383263201056);
314
 
select c1 mod 50 as result from t1;
315
 
drop table t1;
316
 
 
317
 
#
318
 
# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
319
 
#
320
 
 
321
 
# PS protocol gives different metadata for `Max length' column
322
 
--disable_ps_protocol
323
 
--enable_metadata
324
 
select -9223372036854775808;
325
 
select -(9223372036854775808);
326
 
select -((9223372036854775808));
327
 
select -(-(9223372036854775808));
328
 
--disable_metadata
329
 
--enable_ps_protocol
330
 
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
331
 
select -(-9223372036854775808), -(-(-9223372036854775808));
332
 
 
333
 
# Bug #28005 Partitions: can't use -9223372036854775808 
334
 
create table t1 select -9223372036854775808 bi;
335
 
describe t1;
336
 
drop table t1;
337
 
create table t1 select -9223372036854775809 bi;
338
 
describe t1;
339
 
drop table t1;