~drizzle-trunk/drizzle/development

1 by brian
clean slate
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;
520.1.8 by Brian Aker
Updating tests.
14
select 9223372036854775808 +1;
1 by brian
clean slate
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
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
26
create table t1 (a bigint not null, primary key(a));
520.1.8 by Brian Aker
Updating tests.
27
insert into t1 values (9223372036854775808);
28
insert into t1 values (0x7000000000000000);
1 by brian
clean slate
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 );
520.1.8 by Brian Aker
Updating tests.
37
insert into t1 (big) values (-1),(9223372036854775808),(9223372036854775807),(9223372036854775808);
1 by brian
clean slate
38
select * from t1;
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;
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
41
alter table t1 modify big bigint not null;
1 by brian
clean slate
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;
520.1.8 by Brian Aker
Updating tests.
44
insert into t1 (big) values (9223372036854775808);
1 by brian
clean slate
45
select * from t1;
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;
52
select * from t1;
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;
55
drop table t1;
56
57
#
58
# Test problem with big values for auto_increment
59
#
60
61
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
62
insert into t1 values (null,1);
63
select * from t1;
64
select * from t1 limit 9999999999;
65
drop table t1;
66
67
#
68
# Item_uint::save_to_field()
69
# BUG#1845
70
# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
71
#
72
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');
77
select * from t1;
78
drop table t1;
79
80
# atof() behaviour is different of different systems. to be fixed in 4.1
81
SELECT '0x8000000000000001'+0;
82
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
83
# Test for BUG#8562: joins over BIGINT value + constant propagation
1 by brian
clean slate
84
create table t1 (
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
85
 value64  bigint  not null,
1 by brian
clean slate
86
 value32  integer          not null,
87
 primary key(value64, value32)
88
);
89
90
create table t2 (
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
91
 value64  bigint  not null,
1 by brian
clean slate
92
 value32  integer          not null,
93
 primary key(value64, value32)
94
);
95
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);
100
101
select * from t1;
102
select * from t2;
103
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;
108
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;
113
114
drop table t1, t2;
115
116
# Test for BUG#30069, can't handle bigint -9223372036854775808 on
117
# x86_64, with some GCC versions and optimizations.
118
119
create table t1 (sint64 bigint not null);
120
insert into t1 values (-9223372036854775808);
121
select * from t1;
122
123
drop table t1;
124
125
# End of 4.1 tests
126
127
#
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
128
# Test of CREATE ... SELECT and integers
1 by brian
clean slate
129
#
130
131
create table t1 select 1 as 'a';
1441 by Brian Aker
Fixing tests to work with PBXT.
132
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
133
show create table t1;
134
drop table t1;
135
create table t1 select 9223372036854775809 as 'a';
1441 by Brian Aker
Fixing tests to work with PBXT.
136
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1 by brian
clean slate
137
show create table t1;
138
select * from t1;
139
drop table t1;
140
DROP DATABASE IF EXISTS `scott`;
141
142
143
#
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
144
# Check various conversions from/to bigint.
1 by brian
clean slate
145
#
146
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
151
);
152
520.1.8 by Brian Aker
Updating tests.
153
insert into t1 values (-1,-1,-1,-1);
1 by brian
clean slate
154
select * from t1;
155
drop table t1;
156
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
157
create table t1 ( quantity decimal(2));
520.1.8 by Brian Aker
Updating tests.
158
insert into t1 values (50), (-50), (0), (-1);
1 by brian
clean slate
159
select * from t1;
160
drop table t1;
161
162
#
163
# Test of storing decimal values in BIGINT range
164
# (Bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0))
165
#
166
167
CREATE TABLE t1 (
520.1.8 by Brian Aker
Updating tests.
168
  `col1` INT NULL,
169
  `col2` INT NULL,
170
  `col3` INT NULL,
171
  `col4` INT NULL,
172
  `col5` INT NULL,
173
  `col6` INT NULL,
174
  `col7` INT NULL,
175
  `col8` INT NULL,
176
  `col9` INT NULL,
177
  `col10` BIGINT NULL,
178
  `col11` BIGINT NULL,
179
  `col12` BIGINT NULL,
180
  `col13` BIGINT NULL,
181
  `col14` BIGINT NULL,
182
  `col15` BIGINT NULL,
183
  `col16` BIGINT NULL,
184
  `col17` BIGINT NULL,
185
  `col18` BIGINT NULL,
1 by brian
clean slate
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
236
);
237
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);
281
282
SELECT * FROM t1;
283
DROP TABLE t1;
284
285
#bug #9088 BIGINT WHERE CLAUSE
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
286
create table t1 (bigint_col bigint);
1 by brian
clean slate
287
insert into t1 values (17666000000000000000);
288
select * from t1 where bigint_col=17666000000000000000;
289
select * from t1 where bigint_col='17666000000000000000';
290
drop table t1;
291
292
--echo
293
--echo bug 19955 -- mod is signed with bigint
294
520.1.8 by Brian Aker
Updating tests.
295
select 10000002383263201056 mod 50 as result;
1 by brian
clean slate
296
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
297
create table t1 (c1 bigint);
1 by brian
clean slate
298
insert into t1 values (10000002383263201056);
299
select c1 mod 50 as result from t1;
300
drop table t1;
301
302
#
303
# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
304
#
305
306
# PS protocol gives different metadata for `Max length' column
307
--disable_ps_protocol
308
--enable_metadata
309
select -9223372036854775808;
310
select -(9223372036854775808);
311
select -((9223372036854775808));
312
select -(-(9223372036854775808));
313
--disable_metadata
314
--enable_ps_protocol
315
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
316
select -(-9223372036854775808), -(-(-9223372036854775808));
317
318
# Bug #28005 Partitions: can't use -9223372036854775808 
319
create table t1 select -9223372036854775808 bi;
320
describe t1;
321
drop table t1;
322
create table t1 select -9223372036854775809 bi;
323
describe t1;
324
drop table t1;