~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
drop table if exists t1, t2;
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
0	256	00000000000000065536	2147483647	-2147483648	2147483648	4294967296
0	256	65536	2147483647	-2147483648	2147483648	4294967296
select 9223372036854775807,-009223372036854775808;
9223372036854775807	-009223372036854775808
9223372036854775807	-9223372036854775808
select +9999999999999999999,-9999999999999999999;
9999999999999999999	-9999999999999999999
9999999999999999999	-9999999999999999999
select 9223372036854775808 +1;
9223372036854775808 +1
9223372036854775809
select 9223372036854775808+1;
9223372036854775808+1
9223372036854775809
select -(0-3),round(-(0-3)), round(9999999999999999999);
-(0-3)	round(-(0-3))	round(9999999999999999999)
3	3	9999999999999999999
select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
1	11	101	1001	10001	100001	1000001	10000001	100000001	1000000001	10000000001	100000000001	1000000000001	10000000000001	100000000000001	1000000000000001	10000000000000001	100000000000000001	1000000000000000001	10000000000000000001
1	11	101	1001	10001	100001	1000001	10000001	100000001	1000000001	10000000001	100000000001	1000000000001	10000000000001	100000000000001	1000000000000001	10000000000000001	100000000000000001	1000000000000000001	10000000000000000001
select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
-1	-11	-101	-1001	-10001	-100001	-1000001	-10000001	-100000001	-1000000001	-10000000001	-100000000001	-1000000000001	-10000000000001	-100000000000001	-1000000000000001	-10000000000000001	-100000000000000001	-1000000000000000001	-10000000000000000001
-1	-11	-101	-1001	-10001	-100001	-1000001	-10000001	-100000001	-1000000001	-10000000001	-100000000001	-1000000000001	-10000000000001	-100000000000001	-1000000000000001	-10000000000000001	-100000000000000001	-1000000000000000001	-10000000000000000001
create table t1 (a bigint not null, primary key(a));
insert into t1 values (9223372036854775808);
insert into t1 values (0x7000000000000000);
select * from t1;
a
-9223372036854775808
8070450532247928832
select * from t1 where a=18446744073709551615;
a
delete from t1 where a=18446744073709551615;
select * from t1;
a
-9223372036854775808
8070450532247928832
drop table t1;
create table t1 ( a int not null default 1, big bigint );
insert into t1 (big) values (-1),(9223372036854775808),(9223372036854775807),(9223372036854775808);
select * from t1;
a	big
1	-1
1	-9223372036854775808
1	9223372036854775807
1	-9223372036854775808
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
alter table t1 modify big bigint not null;
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
insert into t1 (big) values (9223372036854775808);
select * from t1;
a	big
1	-1
1	-9223372036854775808
1	9223372036854775807
1	-9223372036854775808
1	-9223372036854775808
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
alter table t1 add key (big);
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
alter table t1 modify big bigint not null;
select * from t1;
a	big
1	-1
1	-9223372036854775808
1	9223372036854775807
1	-9223372036854775808
1	-9223372036854775808
select min(big),max(big),max(big)-1 from t1;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
select min(big),max(big),max(big)-1 from t1 group by a;
min(big)	max(big)	max(big)-1
-9223372036854775808	9223372036854775807	9223372036854775806
drop table t1;
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
insert into t1 values (null,1);
select * from t1;
id	a
9999999999	1
select * from t1 limit 9999999999;
id	a
9999999999	1
drop table t1;
CREATE TABLE t1 ( quantity decimal(60,0));
insert into t1 values (10000000000000000000);
insert into t1 values (10000000000000000000.0);
insert into t1 values ('10000000000000000000');
select * from t1;
quantity
10000000000000000000
10000000000000000000
10000000000000000000
drop table t1;
SELECT '0x8000000000000001'+0;
'0x8000000000000001'+0
0
Warnings:
Warning	1292	Truncated incorrect DOUBLE value: '0x8000000000000001'
create table t1 (
value64  bigint  not null,
value32  integer          not null,
primary key(value64, value32)
);
create table t2 (
value64  bigint  not null,
value32  integer          not null,
primary key(value64, value32)
);
insert into t1 values(17156792991891826145, 1);
insert into t1 values( 9223372036854775807, 2);
insert into t2 values(17156792991891826145, 3);
insert into t2 values( 9223372036854775807, 4);
select * from t1;
value64	value32
-1289951081817725471	1
9223372036854775807	2
select * from t2;
value64	value32
-1289951081817725471	3
9223372036854775807	4
select * from t1, t2 where t1.value64=17156792991891826145 and
t2.value64=17156792991891826145;
value64	value32	value64	value32
-1289951081817725471	1	-1289951081817725471	3
select * from t1, t2 where t1.value64=17156792991891826145 and
t2.value64=t1.value64;
value64	value32	value64	value32
-1289951081817725471	1	-1289951081817725471	3
select * from t1, t2 where t1.value64= 9223372036854775807 and
t2.value64=9223372036854775807;
value64	value32	value64	value32
9223372036854775807	2	9223372036854775807	4
select * from t1, t2 where t1.value64= 9223372036854775807 and
t2.value64=t1.value64;
value64	value32	value64	value32
9223372036854775807	2	9223372036854775807	4
drop table t1, t2;
create table t1 (sint64 bigint not null);
insert into t1 values (-9223372036854775808);
select * from t1;
sint64
-9223372036854775808
drop table t1;
create table t1 select 1 as 'a';
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int NOT NULL
) ENGINE=InnoDB
drop table t1;
create table t1 select 9223372036854775809 as 'a';
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` bigint NOT NULL
) ENGINE=InnoDB
select * from t1;
a
-9223372036854775807
drop table t1;
DROP DATABASE IF EXISTS `scott`;
Warnings:
Note	1008	Can't drop database 'scott'; database doesn't exist
create table t1 (a char(100), b varchar(100), c text, d blob);
insert into t1 values(
18446744073709551615,18446744073709551615,
18446744073709551615, 18446744073709551615
);
insert into t1 values (-1,-1,-1,-1);
select * from t1;
a	b	c	d
18446744073709551615	18446744073709551615	18446744073709551615	18446744073709551615
-1	-1	-1	-1
drop table t1;
create table t1 ( quantity decimal(2));
insert into t1 values (50), (-50), (0), (-1);
select * from t1;
quantity
50
-50
0
-1
drop table t1;
CREATE TABLE t1 (
`col1` INT NULL,
`col2` INT NULL,
`col3` INT NULL,
`col4` INT NULL,
`col5` INT NULL,
`col6` INT NULL,
`col7` INT NULL,
`col8` INT NULL,
`col9` INT NULL,
`col10` BIGINT NULL,
`col11` BIGINT NULL,
`col12` BIGINT NULL,
`col13` BIGINT NULL,
`col14` BIGINT NULL,
`col15` BIGINT NULL,
`col16` BIGINT NULL,
`col17` BIGINT NULL,
`col18` BIGINT NULL,
`col19` DECIMAL(19, 0) NULL,
`col20` DECIMAL(20, 0) NULL,
`col21` DECIMAL(21, 0) NULL,
`col22` DECIMAL(22, 0) NULL,
`col23` DECIMAL(23, 0) NULL,
`col24` DECIMAL(24, 0) NULL,
`col25` DECIMAL(25, 0) NULL,
`col26` DECIMAL(26, 0) NULL,
`col27` DECIMAL(27, 0) NULL,
`col28` DECIMAL(28, 0) NULL,
`col29` DECIMAL(29, 0) NULL,
`col30` DECIMAL(30, 0) NULL,
`col31` DECIMAL(31, 0) NULL,
`col32` DECIMAL(32, 0) NULL,
`col33` DECIMAL(33, 0) NULL,
`col34` DECIMAL(34, 0) NULL,
`col35` DECIMAL(35, 0) NULL,
`col36` DECIMAL(36, 0) NULL,
`col37` DECIMAL(37, 0) NULL,
`col38` DECIMAL(38, 0) NULL,
`fix1` DECIMAL(38, 1) NULL,
`fix2` DECIMAL(38, 2) NULL,
`fix3` DECIMAL(38, 3) NULL,
`fix4` DECIMAL(38, 4) NULL,
`fix5` DECIMAL(38, 5) NULL,
`fix6` DECIMAL(38, 6) NULL,
`fix7` DECIMAL(38, 7) NULL,
`fix8` DECIMAL(38, 8) NULL,
`fix9` DECIMAL(38, 9) NULL,
`fix10` DECIMAL(38, 10) NULL,
`fix11` DECIMAL(38, 11) NULL,
`fix12` DECIMAL(38, 12) NULL,
`fix13` DECIMAL(38, 13) NULL,
`fix14` DECIMAL(38, 14) NULL,
`fix15` DECIMAL(38, 15) NULL,
`fix16` DECIMAL(38, 16) NULL,
`fix17` DECIMAL(38, 17) NULL,
`fix18` DECIMAL(38, 18) NULL,
`fix19` DECIMAL(38, 19) NULL,
`fix20` DECIMAL(38, 20) NULL,
`fix21` DECIMAL(38, 21) NULL,
`fix22` DECIMAL(38, 22) NULL,
`fix23` DECIMAL(38, 23) NULL,
`fix24` DECIMAL(38, 24) NULL,
`fix25` DECIMAL(38, 25) NULL,
`fix26` DECIMAL(38, 26) NULL,
`fix27` DECIMAL(38, 27) NULL,
`fix28` DECIMAL(38, 28) NULL,
`fix29` DECIMAL(38, 29) NULL,
`fix30` DECIMAL(38, 30) NULL
);
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`)
VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999,
999999999999999, 9999999999999999, 99999999999999999, 999999999999999999,
9999999999999999999, 99999999999999999999, 999999999999999999999,
9999999999999999999999, 99999999999999999999999, 999999999999999999999999,
9999999999999999999999999, 99999999999999999999999999,
999999999999999999999999999, 9999999999999999999999999999,
99999999999999999999999999999, 999999999999999999999999999999,
9999999999999999999999999999999, 99999999999999999999999999999999,
999999999999999999999999999999999, 9999999999999999999999999999999999,
99999999999999999999999999999999999, 999999999999999999999999999999999999,
9999999999999999999999999999999999999, 99999999999999999999999999999999999999,
9999999999999999999999999999999999999.9,
999999999999999999999999999999999999.99,
99999999999999999999999999999999999.999,
9999999999999999999999999999999999.9999,
999999999999999999999999999999999.99999,
99999999999999999999999999999999.999999,
9999999999999999999999999999999.9999999,
999999999999999999999999999999.99999999,
99999999999999999999999999999.999999999,
9999999999999999999999999999.9999999999,
999999999999999999999999999.99999999999,
99999999999999999999999999.999999999999,
9999999999999999999999999.9999999999999,
999999999999999999999999.99999999999999,
99999999999999999999999.999999999999999,
9999999999999999999999.9999999999999999,
999999999999999999999.99999999999999999,
99999999999999999999.999999999999999999,
9999999999999999999.9999999999999999999,
999999999999999999.99999999999999999999,
99999999999999999.999999999999999999999,
9999999999999999.9999999999999999999999,
999999999999999.99999999999999999999999,
99999999999999.999999999999999999999999,
9999999999999.9999999999999999999999999,
999999999999.99999999999999999999999999,
99999999999.999999999999999999999999999,
9999999999.9999999999999999999999999999,
999999999.99999999999999999999999999999,
99999999.999999999999999999999999999999);
SELECT * FROM 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
9	99	999	9999	99999	999999	9999999	99999999	999999999	9999999999	99999999999	999999999999	9999999999999	99999999999999	999999999999999	9999999999999999	99999999999999999	999999999999999999	9999999999999999999	99999999999999999999	999999999999999999999	9999999999999999999999	99999999999999999999999	999999999999999999999999	9999999999999999999999999	99999999999999999999999999	999999999999999999999999999	9999999999999999999999999999	99999999999999999999999999999	999999999999999999999999999999	9999999999999999999999999999999	99999999999999999999999999999999	999999999999999999999999999999999	9999999999999999999999999999999999	99999999999999999999999999999999999	999999999999999999999999999999999999	9999999999999999999999999999999999999	99999999999999999999999999999999999999	9999999999999999999999999999999999999.9	999999999999999999999999999999999999.99	99999999999999999999999999999999999.999	9999999999999999999999999999999999.9999	999999999999999999999999999999999.99999	99999999999999999999999999999999.999999	9999999999999999999999999999999.9999999	999999999999999999999999999999.99999999	99999999999999999999999999999.999999999	9999999999999999999999999999.9999999999	999999999999999999999999999.99999999999	99999999999999999999999999.999999999999	9999999999999999999999999.9999999999999	999999999999999999999999.99999999999999	99999999999999999999999.999999999999999	9999999999999999999999.9999999999999999	999999999999999999999.99999999999999999	99999999999999999999.999999999999999999	9999999999999999999.9999999999999999999	999999999999999999.99999999999999999999	99999999999999999.999999999999999999999	9999999999999999.9999999999999999999999	999999999999999.99999999999999999999999	99999999999999.999999999999999999999999	9999999999999.9999999999999999999999999	999999999999.99999999999999999999999999	99999999999.999999999999999999999999999	9999999999.9999999999999999999999999999	999999999.99999999999999999999999999999	99999999.999999999999999999999999999999
DROP TABLE t1;
create table t1 (bigint_col bigint);
insert into t1 values (17666000000000000000);
select * from t1 where bigint_col=17666000000000000000;
bigint_col
-780744073709551616
select * from t1 where bigint_col='17666000000000000000';
bigint_col
drop table t1;

bug 19955 -- mod is signed with bigint
select 10000002383263201056 mod 50 as result;
result
6
create table t1 (c1 bigint);
insert into t1 values (10000002383263201056);
select c1 mod 50 as result from t1;
result
-10
drop table t1;
select -9223372036854775808;
Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
def					-9223372036854775808	5	20	20	N	32897	0	63
-9223372036854775808
-9223372036854775808
select -(9223372036854775808);
Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
def					-(9223372036854775808)	5	20	20	N	32897	0	63
-(9223372036854775808)
-9223372036854775808
select -((9223372036854775808));
Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
def					-((9223372036854775808))	5	20	20	N	32897	0	63
-((9223372036854775808))
-9223372036854775808
select -(-(9223372036854775808));
Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
def					-(-(9223372036854775808))	10	21	19	N	129	0	63
-(-(9223372036854775808))
9223372036854775808
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
--9223372036854775808	---9223372036854775808	----9223372036854775808
9223372036854775808	-9223372036854775808	9223372036854775808
select -(-9223372036854775808), -(-(-9223372036854775808));
-(-9223372036854775808)	-(-(-9223372036854775808))
9223372036854775808	-9223372036854775808
create table t1 select -9223372036854775808 bi;
describe t1;
Field	Type	Null	Key	Default	Extra
bi	bigint	NO		NULL	
drop table t1;
create table t1 select -9223372036854775809 bi;
describe t1;
Field	Type	Null	Key	Default	Extra
bi	decimal(19,0)	NO		NULL	
drop table t1;