1select 0 + b'1';
20 + b'1'
31
4select 0 + b'0';
50 + b'0'
60
7select 0 + b'000001';
80 + b'000001'
91
10select 0 + b'000011';
110 + b'000011'
123
13select 0 + b'000101';
140 + b'000101'
155
16select 0 + b'000000';
170 + b'000000'
180
19select 0 + b'10000000';
200 + b'10000000'
21128
22select 0 + b'11111111';
230 + b'11111111'
24255
25select 0 + b'10000001';
260 + b'10000001'
27129
28select 0 + b'1000000000000000';
290 + b'1000000000000000'
3032768
31select 0 + b'1111111111111111';
320 + b'1111111111111111'
3365535
34select 0 + b'1000000000000001';
350 + b'1000000000000001'
3632769
37drop table if exists t1,t2;
38create table t1 (a bit(65));
39ERROR 42000: Display width out of range for 'a' (max = 64)
40create table t1 (a bit(0));
41show create table t1;
42Table	Create Table
43t1	CREATE TABLE `t1` (
44  `a` bit(1) DEFAULT NULL
45) ENGINE=MyISAM DEFAULT CHARSET=latin1
46drop table t1;
47create table t1 (a bit(64));
48insert into t1 values
49(b'1111111111111111111111111111111111111111111111111111111111111111'),
50(b'1000000000000000000000000000000000000000000000000000000000000000'),
51(b'0000000000000000000000000000000000000000000000000000000000000001'),
52(b'1010101010101010101010101010101010101010101010101010101010101010'),
53(b'0101010101010101010101010101010101010101010101010101010101010101');
54select hex(a) from t1;
55hex(a)
56FFFFFFFFFFFFFFFF
578000000000000000
581
59AAAAAAAAAAAAAAAA
605555555555555555
61drop table t1;
62create table t1 (a bit);
63insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
64Warnings:
65Warning	1264	Out of range value for column 'a' at row 4
66select hex(a) from t1;
67hex(a)
680
691
700
711
721
73alter table t1 add unique (a);
74ERROR 23000: Duplicate entry '\x00' for key 'a'
75drop table t1;
76create table t1 (a bit(2));
77insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
78Warnings:
79Warning	1264	Out of range value for column 'a' at row 4
80select a+0 from t1;
81a+0
820
831
842
853
86alter table t1 add key (a);
87explain select a+0 from t1;
88id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
891	SIMPLE	t1	index	NULL	a	2	NULL	4	Using index
90select a+0 from t1;
91a+0
920
931
942
953
96drop table t1;
97create table t1 (a bit(7), b bit(9), key(a, b));
98insert into t1 values
99(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),
100(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),
101(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),
102(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
103(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
104(44, 307), (68, 454), (57, 135);
105explain select a+0 from t1;
106id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1071	SIMPLE	t1	index	NULL	a	5	NULL	38	Using index
108select a+0 from t1;
109a+0
1100
1114
1125
1139
11423
11524
11628
11729
11830
11931
12034
12144
12249
12356
12457
12559
12660
12761
12868
12968
13075
13177
13278
13379
13487
13588
13694
13794
138104
139106
140108
141111
142116
143118
144119
145122
146123
147127
148explain select b+0 from t1;
149id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1501	SIMPLE	t1	index	NULL	a	5	NULL	38	Using index
151select b+0 from t1;
152b+0
153177
154245
155178
156363
15736
158398
159499
160399
16183
162438
163202
164307
165345
166379
167135
168188
169343
170152
171206
172454
17342
174133
175123
176349
177351
178411
17946
180468
181280
182446
18367
184368
185390
186380
187368
188118
189411
190403
191explain select a+0, b+0 from t1;
192id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1931	SIMPLE	t1	index	NULL	a	5	NULL	38	Using index
194select a+0, b+0 from t1;
195a+0	b+0
1960	177
1974	245
1985	178
1999	363
20023	36
20124	398
20228	499
20329	399
20430	83
20531	438
20634	202
20744	307
20849	345
20956	379
21057	135
21159	188
21260	343
21361	152
21468	206
21568	454
21675	42
21777	133
21878	123
21979	349
22087	351
22188	411
22294	46
22394	468
224104	280
225106	446
226108	67
227111	368
228116	390
229118	380
230119	368
231122	118
232123	411
233127	403
234explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
235id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
2361	SIMPLE	t1	range	a	a	2	NULL	27	Using where; Using index; Using filesort
237select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
238a+0	b+0
23944	307
24049	345
24156	379
24260	343
24368	206
24468	454
24579	349
24687	351
24788	411
24894	468
249104	280
250106	446
251111	368
252116	390
253118	380
254119	368
255123	411
256127	403
257explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
258id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
2591	SIMPLE	t1	range	a	a	2	NULL	9	Using where; Using index; Using filesort
260select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
261a+0	b+0
26257	135
26361	152
26459	188
26568	206
26644	307
26760	343
26849	345
26956	379
27068	454
271set @@max_length_for_sort_data=0;
272Warnings:
273Warning	1292	Truncated incorrect max_length_for_sort_data value: '0'
274select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
275a+0	b+0
27657	135
27761	152
27859	188
27968	206
28044	307
28160	343
28249	345
28356	379
28468	454
285select hex(min(a)) from t1;
286hex(min(a))
2870
288select hex(min(b)) from t1;
289hex(min(b))
29024
291select hex(min(a)), hex(max(a)), hex(min(b)), hex(max(b)) from t1;
292hex(min(a))	hex(max(a))	hex(min(b))	hex(max(b))
2930	7F	24	1F3
294drop table t1;
295create table t1 (a int not null, b bit, c bit(9), key(a, b, c));
296insert into t1 values
297(4, NULL, 1), (4, 0, 3), (2, 1, 4), (1, 1, 100), (4, 0, 23), (4, 0, 54),
298(56, 0, 22), (4, 1, 100), (23, 0, 1), (4, 0, 34);
299select a+0, b+0, c+0 from t1;
300a+0	b+0	c+0
3011	1	100
3022	1	4
3034	NULL	1
3044	0	3
3054	0	23
3064	0	34
3074	0	54
3084	1	100
30923	0	1
31056	0	22
311select hex(min(b)) from t1 where a = 4;
312hex(min(b))
3130
314select hex(min(c)) from t1 where a = 4 and b = 0;
315hex(min(c))
3163
317select hex(max(b)) from t1;
318hex(max(b))
3191
320select a+0, b+0, c+0 from t1 where a = 4 and b = 0 limit 2;
321a+0	b+0	c+0
3224	0	3
3234	0	23
324select a+0, b+0, c+0 from t1 where a = 4 and b = 1;
325a+0	b+0	c+0
3264	1	100
327select a+0, b+0, c+0 from t1 where a = 4 and b = 1 and c=100;
328a+0	b+0	c+0
3294	1	100
330select a+0, b+0, c+0 from t1 order by b desc;
331a+0	b+0	c+0
3322	1	4
3331	1	100
3344	1	100
3354	0	3
3364	0	23
3374	0	54
33856	0	22
33923	0	1
3404	0	34
3414	NULL	1
342select a+0, b+0, c+0 from t1 order by c;
343a+0	b+0	c+0
3444	NULL	1
34523	0	1
3464	0	3
3472	1	4
34856	0	22
3494	0	23
3504	0	34
3514	0	54
3521	1	100
3534	1	100
354drop table t1;
355create table t1(a bit(2), b bit(2));
356insert into t1 (a) values (0x01), (0x03), (0x02);
357update t1 set b= concat(a);
358select a+0, b+0 from t1;
359a+0	b+0
3601	1
3613	3
3622	2
363drop table t1;
364create table t1 (a bit(7), key(a));
365insert into t1 values (44), (57);
366select a+0 from t1;
367a+0
36844
36957
370drop table t1;
371create table t1 (a bit(3), b bit(12));
372insert into t1 values (7,(1<<12)-2), (0x01,0x01ff);
373select hex(a),hex(b) from t1;
374hex(a)	hex(b)
3757	FFE
3761	1FF
377select hex(concat(a)),hex(concat(b)) from t1;
378hex(concat(a))	hex(concat(b))
37907	0FFE
38001	01FF
381drop table t1;
382create table t1(a int, b bit not null);
383alter table t1 add primary key (a);
384drop table t1;
385create table t1 (a bit(19), b bit(5));
386insert into t1 values (1000, 10), (3, 8), (200, 6), (2303, 2), (12345, 4), (1, 0);
387select a+0, b+0 from t1;
388a+0	b+0
3891000	10
3903	8
391200	6
3922303	2
39312345	4
3941	0
395alter table t1 engine=heap;
396select a+0, b+0 from t1;
397a+0	b+0
3981000	10
3993	8
400200	6
4012303	2
40212345	4
4031	0
404alter table t1 add key(a, b);
405select a+0, b+0 from t1;
406a+0	b+0
4071000	10
4083	8
409200	6
4102303	2
41112345	4
4121	0
413alter table t1 engine=myisam;
414select a+0, b+0 from t1;
415a+0	b+0
4161	0
4173	8
418200	6
4191000	10
4202303	2
42112345	4
422create table t2 engine=heap select * from t1;
423select a+0, b+0 from t2;
424a+0	b+0
4251	0
4263	8
427200	6
4281000	10
4292303	2
43012345	4
431drop table t1;
432create table t1 select * from t2;
433select a+0, b+0 from t1;
434a+0	b+0
4351	0
4363	8
437200	6
4381000	10
4392303	2
44012345	4
441drop table t1, t2;
442create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
443g bit(1) NOT NULL default 1, h char(1) default 'a');
444insert into t1 set a=1;
445select hex(g), h from t1;
446hex(g)	h
4471	a
448drop table t1;
449create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
450g bit(1) NOT NULL default 1);
451insert into t1 set a=1;
452select hex(g) from t1;
453hex(g)
4541
455drop table t1;
456create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
457h char(1) default 'a') engine=myisam;
458insert into t1 set a=1;
459select h from t1;
460h
461a
462drop table t1;
463create table t1 (a bit(8)) engine=heap;
464insert ignore into t1 values ('1111100000');
465Warnings:
466Warning	1264	Out of range value for column 'a' at row 1
467select a+0 from t1;
468a+0
469255
470drop table t1;
471create table t1 (a bit(7));
472insert into t1 values (120), (0), (111);
473select a+0 from t1 union select a+0 from t1;
474a+0
475120
4760
477111
478select a+0 from t1 union select NULL;
479a+0
480120
4810
482111
483NULL
484select NULL union select a+0 from t1;
485NULL
486NULL
487120
4880
489111
490create table t2 select a from t1 union select a from t1;
491select a+0 from t2;
492a+0
493120
4940
495111
496show create table t2;
497Table	Create Table
498t2	CREATE TABLE `t2` (
499  `a` bit(7) DEFAULT NULL
500) ENGINE=MyISAM DEFAULT CHARSET=latin1
501drop table t1, t2;
502create table t1 (id1 int(11), b1 bit(1));
503create table t2 (id2 int(11), b2 bit(1));
504insert into t1 values (1, 1), (2, 0), (3, 1);
505insert into t2 values (2, 1), (3, 0), (4, 0);
506create algorithm=undefined view v1 as
507select b1+0, b2+0 from t1, t2 where id1 = id2 and b1 = 0
508union
509select b1+0, b2+0 from t1, t2 where id1 = id2 and b2 = 1;
510select * from v1;
511b1+0	b2+0
5120	1
513drop table t1, t2;
514drop view v1;
515create table t1(a bit(4));
516insert into t1(a) values (1), (2), (5), (4), (3);
517insert into t1 select * from t1;
518select a+0 from t1;
519a+0
5201
5212
5225
5234
5243
5251
5262
5275
5284
5293
530drop table t1;
531create table t1 (a1 int(11), b1 bit(2));
532create table t2 (a2 int(11), b2 bit(2));
533insert into t1 values (1, 1), (2, 0), (3, 1), (4, 2);
534insert into t2 values (2, 1), (3, 0), (4, 1), (5, 2);
535select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2;
536a1	a2	b1+0	b2+0
5372	2	0	1
5383	3	1	0
5394	4	2	1
540select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2 order by a1;
541a1	a2	b1+0	b2+0
5422	2	0	1
5433	3	1	0
5444	4	2	1
545select a1, a2, b1+0, b2+0 from t1 join t2 on b1 = b2;
546a1	a2	b1+0	b2+0
5471	2	1	1
5483	2	1	1
5492	3	0	0
5501	4	1	1
5513	4	1	1
5524	5	2	2
553select sum(a1), b1+0, b2+0 from t1 join t2 on b1 = b2 group by b1 order by 1;
554sum(a1)	b1+0	b2+0
5552	0	0
5564	2	2
5578	1	1
558select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
5591
5601
5611
5621
563select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;
564b1+0	sum(b1)	sum(b2)
5650	0	0
5661	4	4
5672	2	2
568drop table t1, t2;
569create table t1 (a bit(7));
570insert into t1 values (0x60);
571select * from t1;
572Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
573def	test	t1	t1	a	a	16	7	1	Y	32	0	63
574a
575`
576drop table t1;
577create table bug15583(b BIT(8), n INT);
578insert into bug15583 values(128, 128);
579insert into bug15583 values(null, null);
580insert into bug15583 values(0, 0);
581insert into bug15583 values(255, 255);
582select hex(b), bin(b), oct(b), hex(n), bin(n), oct(n) from bug15583;
583hex(b)	bin(b)	oct(b)	hex(n)	bin(n)	oct(n)
58480	10000000	200	80	10000000	200
585NULL	NULL	NULL	NULL	NULL	NULL
5860	0	0	0	0	0
587FF	11111111	377	FF	11111111	377
588select hex(b)=hex(n) as should_be_onetrue, bin(b)=bin(n) as should_be_onetrue, oct(b)=oct(n) as should_be_onetrue from bug15583;
589should_be_onetrue	should_be_onetrue	should_be_onetrue
5901	1	1
591NULL	NULL	NULL
5921	1	1
5931	1	1
594select hex(b + 0), bin(b + 0), oct(b + 0), hex(n), bin(n), oct(n) from bug15583;
595hex(b + 0)	bin(b + 0)	oct(b + 0)	hex(n)	bin(n)	oct(n)
59680	10000000	200	80	10000000	200
597NULL	NULL	NULL	NULL	NULL	NULL
5980	0	0	0	0	0
599FF	11111111	377	FF	11111111	377
600select conv(b, 10, 2), conv(b + 0, 10, 2) from bug15583;
601conv(b, 10, 2)	conv(b + 0, 10, 2)
60210000000	10000000
603NULL	NULL
6040	0
60511111111	11111111
606drop table bug15583;
607create table t1(a bit(1), b smallint unsigned);
608insert ignore into t1 (b, a) values ('2', '1');
609Warnings:
610Warning	1264	Out of range value for column 'a' at row 1
611select hex(a), b from t1;
612hex(a)	b
6131	2
614drop table t1;
615create table t1(bit_field bit(2), int_field int, key a(bit_field));
616insert into t1 values (1,2);
617handler t1 open as t1;
618handler t1 read a=(1);
619bit_field	int_field
620	2
621handler t1 close;
622drop table t1;
623CREATE TABLE t1 (b BIT(2), a VARCHAR(5));
624INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
625SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
626b+0	COUNT(DISTINCT a)
6270	1
6281	1
6293	2
630DROP TABLE t1;
631CREATE TABLE t1 (a CHAR(5), b BIT(2));
632INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
633SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
634b+0	COUNT(DISTINCT a)
6350	1
6361	1
6373	2
638DROP TABLE t1;
639CREATE TABLE t1 (a INT, b BIT(2));
640INSERT INTO t1 (b, a) VALUES (1, 1), (3, 2), (0, 3), (3, 4);
641SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
642b+0	COUNT(DISTINCT a)
6430	1
6441	1
6453	2
646DROP TABLE t1;
647CREATE TABLE t1 (b BIT);
648INSERT INTO t1 (b) VALUES (1), (0);
649SELECT DISTINCT b FROM t1;
650Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
651def	test	t1	t1	b	b	16	1	1	Y	32	0	63
652b
653#
654#
655SELECT b FROM t1 GROUP BY b;
656Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
657def	test	t1	t1	b	b	16	1	1	Y	32	0	63
658b
659#
660#
661DROP TABLE t1;
662CREATE TABLE t1 (a int, b bit(2));
663INSERT INTO t1 VALUES (3, 2), (2, 3), (2, 0), (3, 2), (3, 1);
664SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a;
665COUNT(DISTINCT b)
6662
6672
668DROP TABLE t1;
669create table t2 (a int, b bit(2), c char(10));
670INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'),
671(3, 2, 'two'), (3, 1, 'one');
672SELECT COUNT(DISTINCT b,c) FROM t2 GROUP BY a;
673COUNT(DISTINCT b,c)
6742
6752
676DROP TABLE t2;
677CREATE TABLE t1(a BIT(13), KEY(a));
678INSERT IGNORE INTO t1(a) VALUES
679(65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535);
680ANALYZE TABLE t1;
681Table	Op	Msg_type	Msg_text
682test.t1	analyze	status	Engine-independent statistics collected
683test.t1	analyze	status	OK
684EXPLAIN SELECT 1 FROM t1 GROUP BY a;
685id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
6861	SIMPLE	t1	range	NULL	a	3	NULL	2	Using index for group-by
687SELECT 1 FROM t1 GROUP BY a;
6881
6891
690DROP TABLE t1;
691CREATE TABLE t1 (b BIT NOT NULL, i2 INTEGER NOT NULL, s VARCHAR(255) NOT NULL);
692INSERT INTO t1 VALUES(0x01,100,''), (0x00,300,''), (0x01,200,''), (0x00,100,'');
693SELECT HEX(b), i2 FROM t1 WHERE (i2>=100 AND i2<201) AND b=TRUE;
694HEX(b)	i2
6951	100
6961	200
697CREATE TABLE t2 (b1 BIT NOT NULL, b2 BIT NOT NULL, i2 INTEGER NOT NULL,
698s VARCHAR(255) NOT NULL);
699INSERT INTO t2 VALUES (0x01,0x00,100,''), (0x00,0x01,300,''),
700(0x01,0x00,200,''), (0x00,0x01,100,'');
701SELECT HEX(b1), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b1=TRUE;
702HEX(b1)	i2
7031	100
7041	200
705SELECT HEX(b2), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b2=FALSE;
706HEX(b2)	i2
7070	100
7080	200
709SELECT HEX(b1), HEX(b2), i2 FROM t2
710WHERE (i2>=100 AND i2<201) AND b1=TRUE AND b2=FALSE;
711HEX(b1)	HEX(b2)	i2
7121	0	100
7131	0	200
714DROP TABLE t1, t2;
715CREATE TABLE IF NOT EXISTS t1 (
716f1 bit(2) NOT NULL default b'10',
717f2 bit(14) NOT NULL default b'11110000111100'
718) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
719SHOW CREATE TABLE t1;
720Table	Create Table
721t1	CREATE TABLE `t1` (
722  `f1` bit(2) NOT NULL DEFAULT b'10',
723  `f2` bit(14) NOT NULL DEFAULT b'11110000111100'
724) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
725DROP TABLE t1;
726CREATE TABLE IF NOT EXISTS t1 (
727f1 bit(2) NOT NULL default b''
728) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
729SHOW CREATE TABLE t1;
730Table	Create Table
731t1	CREATE TABLE `t1` (
732  `f1` bit(2) NOT NULL DEFAULT b'0'
733) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
734DROP TABLE t1;
735create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
736create table t2bit7 (b1 bit(7)) engine=MyISAM;
737insert into t1bit7 values (b'1100000');
738insert into t1bit7 values (b'1100001');
739insert into t1bit7 values (b'1100010');
740insert into t2bit7 values (b'1100001');
741insert into t2bit7 values (b'1100010');
742insert into t2bit7 values (b'1100110');
743select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
744bin(a1)
7451100001
7461100010
747drop table t1bit7, t2bit7;
748create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
749create table t2bit7 (b1 bit(15)) engine=MyISAM;
750insert into t1bit7 values (b'110000011111111');
751insert into t1bit7 values (b'110000111111111');
752insert into t1bit7 values (b'110001011111111');
753insert into t2bit7 values (b'110000111111111');
754insert into t2bit7 values (b'110001011111111');
755insert into t2bit7 values (b'110011011111111');
756select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
757bin(a1)
758110000111111111
759110001011111111
760drop table t1bit7, t2bit7;
761#
762# Bug42803: Field_bit does not have unsigned_flag field,
763# can lead to bad memory access
764#
765CREATE TABLE t1 (a BIT(7), b BIT(9), KEY(a, b));
766INSERT INTO t1 VALUES(0, 0), (5, 3), (5, 6), (6, 4), (7, 0);
767EXPLAIN SELECT a+0, b+0 FROM t1 WHERE a > 4 and b < 7 ORDER BY 2;
768id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
7691	SIMPLE	t1	index	a	a	5	NULL	5	Using where; Using index; Using filesort
770DROP TABLE t1;
771End of 5.0 tests
772create table t1(a bit(7));
773insert into t1 values(0x40);
774alter table t1 modify column a bit(8);
775select hex(a) from t1;
776hex(a)
77740
778insert into t1 values(0x80);
779select hex(a) from t1;
780hex(a)
78140
78280
783create index a on t1(a);
784insert into t1 values(0x81);
785select hex(a) from t1;
786hex(a)
78740
78880
78981
790show create table t1;
791Table	Create Table
792t1	CREATE TABLE `t1` (
793  `a` bit(8) DEFAULT NULL,
794  KEY `a` (`a`)
795) ENGINE=MyISAM DEFAULT CHARSET=latin1
796drop table t1;
797#
798# Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key'
799#
800CREATE TABLE t1(a INT, b BIT(7) NOT NULL);
801INSERT INTO t1 VALUES (NULL, 0),(NULL, 0);
802SELECT SUM(a) FROM t1 GROUP BY b, a;
803SUM(a)
804NULL
805DROP TABLE t1;
806CREATE TABLE t1(a INT, b BIT(7) NOT NULL, c BIT(8) NOT NULL);
807INSERT INTO t1 VALUES (NULL, 0, 0),(NULL, 0, 0);
808SELECT SUM(a) FROM t1 GROUP BY c, b, a;
809SUM(a)
810NULL
811DROP TABLE t1;
812End of 5.1 tests
813#
814# Start of 10.1 tests
815#
816#
817# MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
818#
819CREATE TABLE t1 (val bit(1));
820INSERT INTO t1 VALUES (0);
821CREATE TABLE t2 AS SELECT COALESCE(val, 1) AS c FROM t1;
822SELECT  * FROM t2;
823c
8240
825SHOW CREATE TABLE t2;
826Table	Create Table
827t2	CREATE TABLE `t2` (
828  `c` decimal(1,0) DEFAULT NULL
829) ENGINE=MyISAM DEFAULT CHARSET=latin1
830DROP TABLE t2;
831SELECT COALESCE(val, 1) FROM t1;
832Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
833def					COALESCE(val, 1)	246	2	1	Y	32896	0	63
834COALESCE(val, 1)
8350
836DROP TABLE t1;
837#
838# MDEV-18452 ASAN unknown-crash in Field::set_default upon SET bit_column = DEFAULT
839#
840CREATE TABLE t1 (b BIT(20)) ENGINE=MyISAM;
841INSERT INTO t1 VALUES (0);
842UPDATE t1 SET b = DEFAULT;
843DROP TABLE t1;
844#
845# End of 10.1 tests
846#
847#
848# Start of 10.2 tests
849#
850#
851# MDEV-9334 ALTER from DECIMAL to BIGINT UNSIGNED returns a wrong result
852#
853CREATE TABLE t1 (a DECIMAL(30,0));
854INSERT INTO t1 VALUES (CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED));
855ALTER TABLE t1 MODIFY a BIT(64);
856SELECT a+0 FROM t1;
857a+0
85818446744073709551615
859DROP TABLE IF EXISTS t1;
860#
861# End of 10.2 tests
862#
863#
864# Start of 10.4 tests
865#
866#
867# MDEV-15759 Expect "Impossible WHERE" for indexed_int_column=out_of_range_int_constant
868#
869CREATE TABLE t1 (a BIT(7), KEY(a));
870INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
871EXPLAIN SELECT * FROM t1 WHERE a=200;
872id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
8731	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
874EXPLAIN SELECT * FROM t1 WHERE a<=>200;
875id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
8761	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
877DROP TABLE t1;
878#
879# MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
880#
881BEGIN NOT ATOMIC
882FOR i IN 1..64
883DO
884SELECT '-----', CONCAT('BIT(',i,')') AS Type;
885EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a BIT(64))','64', i);
886INSERT IGNORE INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
887CREATE TABLE t2 AS SELECT
888a,
889FLOOR(a) AS cf,
890CEILING(a) AS cc,
891ROUND(a) AS cr,
892TRUNCATE(a,0) AS ct
893FROM t1;
894SHOW CREATE TABLE t2;
895SELECT CAST(a AS UNSIGNED) AS a, cf, cc, cr, ct FROM t2;
896DROP TABLE t2;
897DROP TABLE t1;
898END FOR;
899END;
900$$
901-----	-----
902Type	BIT(1)
903Table	t2
904Create Table	CREATE TABLE `t2` (
905  `a` bit(1) DEFAULT NULL,
906  `cf` int(1) unsigned DEFAULT NULL,
907  `cc` int(1) unsigned DEFAULT NULL,
908  `cr` int(1) unsigned DEFAULT NULL,
909  `ct` int(1) unsigned DEFAULT NULL
910) ENGINE=MyISAM DEFAULT CHARSET=latin1
911a	1
912cf	1
913cc	1
914cr	1
915ct	1
916-----	-----
917Type	BIT(2)
918Table	t2
919Create Table	CREATE TABLE `t2` (
920  `a` bit(2) DEFAULT NULL,
921  `cf` int(1) unsigned DEFAULT NULL,
922  `cc` int(1) unsigned DEFAULT NULL,
923  `cr` int(1) unsigned DEFAULT NULL,
924  `ct` int(1) unsigned DEFAULT NULL
925) ENGINE=MyISAM DEFAULT CHARSET=latin1
926a	3
927cf	3
928cc	3
929cr	3
930ct	3
931-----	-----
932Type	BIT(3)
933Table	t2
934Create Table	CREATE TABLE `t2` (
935  `a` bit(3) DEFAULT NULL,
936  `cf` int(1) unsigned DEFAULT NULL,
937  `cc` int(1) unsigned DEFAULT NULL,
938  `cr` int(1) unsigned DEFAULT NULL,
939  `ct` int(1) unsigned DEFAULT NULL
940) ENGINE=MyISAM DEFAULT CHARSET=latin1
941a	7
942cf	7
943cc	7
944cr	7
945ct	7
946-----	-----
947Type	BIT(4)
948Table	t2
949Create Table	CREATE TABLE `t2` (
950  `a` bit(4) DEFAULT NULL,
951  `cf` int(2) unsigned DEFAULT NULL,
952  `cc` int(2) unsigned DEFAULT NULL,
953  `cr` int(2) unsigned DEFAULT NULL,
954  `ct` int(2) unsigned DEFAULT NULL
955) ENGINE=MyISAM DEFAULT CHARSET=latin1
956a	15
957cf	15
958cc	15
959cr	15
960ct	15
961-----	-----
962Type	BIT(5)
963Table	t2
964Create Table	CREATE TABLE `t2` (
965  `a` bit(5) DEFAULT NULL,
966  `cf` int(2) unsigned DEFAULT NULL,
967  `cc` int(2) unsigned DEFAULT NULL,
968  `cr` int(2) unsigned DEFAULT NULL,
969  `ct` int(2) unsigned DEFAULT NULL
970) ENGINE=MyISAM DEFAULT CHARSET=latin1
971a	31
972cf	31
973cc	31
974cr	31
975ct	31
976-----	-----
977Type	BIT(6)
978Table	t2
979Create Table	CREATE TABLE `t2` (
980  `a` bit(6) DEFAULT NULL,
981  `cf` int(2) unsigned DEFAULT NULL,
982  `cc` int(2) unsigned DEFAULT NULL,
983  `cr` int(2) unsigned DEFAULT NULL,
984  `ct` int(2) unsigned DEFAULT NULL
985) ENGINE=MyISAM DEFAULT CHARSET=latin1
986a	63
987cf	63
988cc	63
989cr	63
990ct	63
991-----	-----
992Type	BIT(7)
993Table	t2
994Create Table	CREATE TABLE `t2` (
995  `a` bit(7) DEFAULT NULL,
996  `cf` int(3) unsigned DEFAULT NULL,
997  `cc` int(3) unsigned DEFAULT NULL,
998  `cr` int(3) unsigned DEFAULT NULL,
999  `ct` int(3) unsigned DEFAULT NULL
1000) ENGINE=MyISAM DEFAULT CHARSET=latin1
1001a	127
1002cf	127
1003cc	127
1004cr	127
1005ct	127
1006-----	-----
1007Type	BIT(8)
1008Table	t2
1009Create Table	CREATE TABLE `t2` (
1010  `a` bit(8) DEFAULT NULL,
1011  `cf` int(3) unsigned DEFAULT NULL,
1012  `cc` int(3) unsigned DEFAULT NULL,
1013  `cr` int(3) unsigned DEFAULT NULL,
1014  `ct` int(3) unsigned DEFAULT NULL
1015) ENGINE=MyISAM DEFAULT CHARSET=latin1
1016a	255
1017cf	255
1018cc	255
1019cr	255
1020ct	255
1021-----	-----
1022Type	BIT(9)
1023Table	t2
1024Create Table	CREATE TABLE `t2` (
1025  `a` bit(9) DEFAULT NULL,
1026  `cf` int(3) unsigned DEFAULT NULL,
1027  `cc` int(3) unsigned DEFAULT NULL,
1028  `cr` int(3) unsigned DEFAULT NULL,
1029  `ct` int(3) unsigned DEFAULT NULL
1030) ENGINE=MyISAM DEFAULT CHARSET=latin1
1031a	511
1032cf	511
1033cc	511
1034cr	511
1035ct	511
1036-----	-----
1037Type	BIT(10)
1038Table	t2
1039Create Table	CREATE TABLE `t2` (
1040  `a` bit(10) DEFAULT NULL,
1041  `cf` int(4) unsigned DEFAULT NULL,
1042  `cc` int(4) unsigned DEFAULT NULL,
1043  `cr` int(4) unsigned DEFAULT NULL,
1044  `ct` int(4) unsigned DEFAULT NULL
1045) ENGINE=MyISAM DEFAULT CHARSET=latin1
1046a	1023
1047cf	1023
1048cc	1023
1049cr	1023
1050ct	1023
1051-----	-----
1052Type	BIT(11)
1053Table	t2
1054Create Table	CREATE TABLE `t2` (
1055  `a` bit(11) DEFAULT NULL,
1056  `cf` int(4) unsigned DEFAULT NULL,
1057  `cc` int(4) unsigned DEFAULT NULL,
1058  `cr` int(4) unsigned DEFAULT NULL,
1059  `ct` int(4) unsigned DEFAULT NULL
1060) ENGINE=MyISAM DEFAULT CHARSET=latin1
1061a	2047
1062cf	2047
1063cc	2047
1064cr	2047
1065ct	2047
1066-----	-----
1067Type	BIT(12)
1068Table	t2
1069Create Table	CREATE TABLE `t2` (
1070  `a` bit(12) DEFAULT NULL,
1071  `cf` int(4) unsigned DEFAULT NULL,
1072  `cc` int(4) unsigned DEFAULT NULL,
1073  `cr` int(4) unsigned DEFAULT NULL,
1074  `ct` int(4) unsigned DEFAULT NULL
1075) ENGINE=MyISAM DEFAULT CHARSET=latin1
1076a	4095
1077cf	4095
1078cc	4095
1079cr	4095
1080ct	4095
1081-----	-----
1082Type	BIT(13)
1083Table	t2
1084Create Table	CREATE TABLE `t2` (
1085  `a` bit(13) DEFAULT NULL,
1086  `cf` int(4) unsigned DEFAULT NULL,
1087  `cc` int(4) unsigned DEFAULT NULL,
1088  `cr` int(4) unsigned DEFAULT NULL,
1089  `ct` int(4) unsigned DEFAULT NULL
1090) ENGINE=MyISAM DEFAULT CHARSET=latin1
1091a	8191
1092cf	8191
1093cc	8191
1094cr	8191
1095ct	8191
1096-----	-----
1097Type	BIT(14)
1098Table	t2
1099Create Table	CREATE TABLE `t2` (
1100  `a` bit(14) DEFAULT NULL,
1101  `cf` int(5) unsigned DEFAULT NULL,
1102  `cc` int(5) unsigned DEFAULT NULL,
1103  `cr` int(5) unsigned DEFAULT NULL,
1104  `ct` int(5) unsigned DEFAULT NULL
1105) ENGINE=MyISAM DEFAULT CHARSET=latin1
1106a	16383
1107cf	16383
1108cc	16383
1109cr	16383
1110ct	16383
1111-----	-----
1112Type	BIT(15)
1113Table	t2
1114Create Table	CREATE TABLE `t2` (
1115  `a` bit(15) DEFAULT NULL,
1116  `cf` int(5) unsigned DEFAULT NULL,
1117  `cc` int(5) unsigned DEFAULT NULL,
1118  `cr` int(5) unsigned DEFAULT NULL,
1119  `ct` int(5) unsigned DEFAULT NULL
1120) ENGINE=MyISAM DEFAULT CHARSET=latin1
1121a	32767
1122cf	32767
1123cc	32767
1124cr	32767
1125ct	32767
1126-----	-----
1127Type	BIT(16)
1128Table	t2
1129Create Table	CREATE TABLE `t2` (
1130  `a` bit(16) DEFAULT NULL,
1131  `cf` int(5) unsigned DEFAULT NULL,
1132  `cc` int(5) unsigned DEFAULT NULL,
1133  `cr` int(5) unsigned DEFAULT NULL,
1134  `ct` int(5) unsigned DEFAULT NULL
1135) ENGINE=MyISAM DEFAULT CHARSET=latin1
1136a	65535
1137cf	65535
1138cc	65535
1139cr	65535
1140ct	65535
1141-----	-----
1142Type	BIT(17)
1143Table	t2
1144Create Table	CREATE TABLE `t2` (
1145  `a` bit(17) DEFAULT NULL,
1146  `cf` int(6) unsigned DEFAULT NULL,
1147  `cc` int(6) unsigned DEFAULT NULL,
1148  `cr` int(6) unsigned DEFAULT NULL,
1149  `ct` int(6) unsigned DEFAULT NULL
1150) ENGINE=MyISAM DEFAULT CHARSET=latin1
1151a	131071
1152cf	131071
1153cc	131071
1154cr	131071
1155ct	131071
1156-----	-----
1157Type	BIT(18)
1158Table	t2
1159Create Table	CREATE TABLE `t2` (
1160  `a` bit(18) DEFAULT NULL,
1161  `cf` int(6) unsigned DEFAULT NULL,
1162  `cc` int(6) unsigned DEFAULT NULL,
1163  `cr` int(6) unsigned DEFAULT NULL,
1164  `ct` int(6) unsigned DEFAULT NULL
1165) ENGINE=MyISAM DEFAULT CHARSET=latin1
1166a	262143
1167cf	262143
1168cc	262143
1169cr	262143
1170ct	262143
1171-----	-----
1172Type	BIT(19)
1173Table	t2
1174Create Table	CREATE TABLE `t2` (
1175  `a` bit(19) DEFAULT NULL,
1176  `cf` int(6) unsigned DEFAULT NULL,
1177  `cc` int(6) unsigned DEFAULT NULL,
1178  `cr` int(6) unsigned DEFAULT NULL,
1179  `ct` int(6) unsigned DEFAULT NULL
1180) ENGINE=MyISAM DEFAULT CHARSET=latin1
1181a	524287
1182cf	524287
1183cc	524287
1184cr	524287
1185ct	524287
1186-----	-----
1187Type	BIT(20)
1188Table	t2
1189Create Table	CREATE TABLE `t2` (
1190  `a` bit(20) DEFAULT NULL,
1191  `cf` int(7) unsigned DEFAULT NULL,
1192  `cc` int(7) unsigned DEFAULT NULL,
1193  `cr` int(7) unsigned DEFAULT NULL,
1194  `ct` int(7) unsigned DEFAULT NULL
1195) ENGINE=MyISAM DEFAULT CHARSET=latin1
1196a	1048575
1197cf	1048575
1198cc	1048575
1199cr	1048575
1200ct	1048575
1201-----	-----
1202Type	BIT(21)
1203Table	t2
1204Create Table	CREATE TABLE `t2` (
1205  `a` bit(21) DEFAULT NULL,
1206  `cf` int(7) unsigned DEFAULT NULL,
1207  `cc` int(7) unsigned DEFAULT NULL,
1208  `cr` int(7) unsigned DEFAULT NULL,
1209  `ct` int(7) unsigned DEFAULT NULL
1210) ENGINE=MyISAM DEFAULT CHARSET=latin1
1211a	2097151
1212cf	2097151
1213cc	2097151
1214cr	2097151
1215ct	2097151
1216-----	-----
1217Type	BIT(22)
1218Table	t2
1219Create Table	CREATE TABLE `t2` (
1220  `a` bit(22) DEFAULT NULL,
1221  `cf` int(7) unsigned DEFAULT NULL,
1222  `cc` int(7) unsigned DEFAULT NULL,
1223  `cr` int(7) unsigned DEFAULT NULL,
1224  `ct` int(7) unsigned DEFAULT NULL
1225) ENGINE=MyISAM DEFAULT CHARSET=latin1
1226a	4194303
1227cf	4194303
1228cc	4194303
1229cr	4194303
1230ct	4194303
1231-----	-----
1232Type	BIT(23)
1233Table	t2
1234Create Table	CREATE TABLE `t2` (
1235  `a` bit(23) DEFAULT NULL,
1236  `cf` int(7) unsigned DEFAULT NULL,
1237  `cc` int(7) unsigned DEFAULT NULL,
1238  `cr` int(7) unsigned DEFAULT NULL,
1239  `ct` int(7) unsigned DEFAULT NULL
1240) ENGINE=MyISAM DEFAULT CHARSET=latin1
1241a	8388607
1242cf	8388607
1243cc	8388607
1244cr	8388607
1245ct	8388607
1246-----	-----
1247Type	BIT(24)
1248Table	t2
1249Create Table	CREATE TABLE `t2` (
1250  `a` bit(24) DEFAULT NULL,
1251  `cf` int(8) unsigned DEFAULT NULL,
1252  `cc` int(8) unsigned DEFAULT NULL,
1253  `cr` int(8) unsigned DEFAULT NULL,
1254  `ct` int(8) unsigned DEFAULT NULL
1255) ENGINE=MyISAM DEFAULT CHARSET=latin1
1256a	16777215
1257cf	16777215
1258cc	16777215
1259cr	16777215
1260ct	16777215
1261-----	-----
1262Type	BIT(25)
1263Table	t2
1264Create Table	CREATE TABLE `t2` (
1265  `a` bit(25) DEFAULT NULL,
1266  `cf` int(8) unsigned DEFAULT NULL,
1267  `cc` int(8) unsigned DEFAULT NULL,
1268  `cr` int(8) unsigned DEFAULT NULL,
1269  `ct` int(8) unsigned DEFAULT NULL
1270) ENGINE=MyISAM DEFAULT CHARSET=latin1
1271a	33554431
1272cf	33554431
1273cc	33554431
1274cr	33554431
1275ct	33554431
1276-----	-----
1277Type	BIT(26)
1278Table	t2
1279Create Table	CREATE TABLE `t2` (
1280  `a` bit(26) DEFAULT NULL,
1281  `cf` int(8) unsigned DEFAULT NULL,
1282  `cc` int(8) unsigned DEFAULT NULL,
1283  `cr` int(8) unsigned DEFAULT NULL,
1284  `ct` int(8) unsigned DEFAULT NULL
1285) ENGINE=MyISAM DEFAULT CHARSET=latin1
1286a	67108863
1287cf	67108863
1288cc	67108863
1289cr	67108863
1290ct	67108863
1291-----	-----
1292Type	BIT(27)
1293Table	t2
1294Create Table	CREATE TABLE `t2` (
1295  `a` bit(27) DEFAULT NULL,
1296  `cf` int(9) unsigned DEFAULT NULL,
1297  `cc` int(9) unsigned DEFAULT NULL,
1298  `cr` int(9) unsigned DEFAULT NULL,
1299  `ct` int(9) unsigned DEFAULT NULL
1300) ENGINE=MyISAM DEFAULT CHARSET=latin1
1301a	134217727
1302cf	134217727
1303cc	134217727
1304cr	134217727
1305ct	134217727
1306-----	-----
1307Type	BIT(28)
1308Table	t2
1309Create Table	CREATE TABLE `t2` (
1310  `a` bit(28) DEFAULT NULL,
1311  `cf` int(9) unsigned DEFAULT NULL,
1312  `cc` int(9) unsigned DEFAULT NULL,
1313  `cr` int(9) unsigned DEFAULT NULL,
1314  `ct` int(9) unsigned DEFAULT NULL
1315) ENGINE=MyISAM DEFAULT CHARSET=latin1
1316a	268435455
1317cf	268435455
1318cc	268435455
1319cr	268435455
1320ct	268435455
1321-----	-----
1322Type	BIT(29)
1323Table	t2
1324Create Table	CREATE TABLE `t2` (
1325  `a` bit(29) DEFAULT NULL,
1326  `cf` int(9) unsigned DEFAULT NULL,
1327  `cc` int(9) unsigned DEFAULT NULL,
1328  `cr` int(9) unsigned DEFAULT NULL,
1329  `ct` int(9) unsigned DEFAULT NULL
1330) ENGINE=MyISAM DEFAULT CHARSET=latin1
1331a	536870911
1332cf	536870911
1333cc	536870911
1334cr	536870911
1335ct	536870911
1336-----	-----
1337Type	BIT(30)
1338Table	t2
1339Create Table	CREATE TABLE `t2` (
1340  `a` bit(30) DEFAULT NULL,
1341  `cf` int(10) unsigned DEFAULT NULL,
1342  `cc` int(10) unsigned DEFAULT NULL,
1343  `cr` int(10) unsigned DEFAULT NULL,
1344  `ct` int(10) unsigned DEFAULT NULL
1345) ENGINE=MyISAM DEFAULT CHARSET=latin1
1346a	1073741823
1347cf	1073741823
1348cc	1073741823
1349cr	1073741823
1350ct	1073741823
1351-----	-----
1352Type	BIT(31)
1353Table	t2
1354Create Table	CREATE TABLE `t2` (
1355  `a` bit(31) DEFAULT NULL,
1356  `cf` int(10) unsigned DEFAULT NULL,
1357  `cc` int(10) unsigned DEFAULT NULL,
1358  `cr` int(10) unsigned DEFAULT NULL,
1359  `ct` int(10) unsigned DEFAULT NULL
1360) ENGINE=MyISAM DEFAULT CHARSET=latin1
1361a	2147483647
1362cf	2147483647
1363cc	2147483647
1364cr	2147483647
1365ct	2147483647
1366-----	-----
1367Type	BIT(32)
1368Table	t2
1369Create Table	CREATE TABLE `t2` (
1370  `a` bit(32) DEFAULT NULL,
1371  `cf` int(10) unsigned DEFAULT NULL,
1372  `cc` int(10) unsigned DEFAULT NULL,
1373  `cr` int(10) unsigned DEFAULT NULL,
1374  `ct` int(10) unsigned DEFAULT NULL
1375) ENGINE=MyISAM DEFAULT CHARSET=latin1
1376a	4294967295
1377cf	4294967295
1378cc	4294967295
1379cr	4294967295
1380ct	4294967295
1381-----	-----
1382Type	BIT(33)
1383Table	t2
1384Create Table	CREATE TABLE `t2` (
1385  `a` bit(33) DEFAULT NULL,
1386  `cf` bigint(10) unsigned DEFAULT NULL,
1387  `cc` bigint(10) unsigned DEFAULT NULL,
1388  `cr` bigint(10) unsigned DEFAULT NULL,
1389  `ct` bigint(10) unsigned DEFAULT NULL
1390) ENGINE=MyISAM DEFAULT CHARSET=latin1
1391a	8589934591
1392cf	8589934591
1393cc	8589934591
1394cr	8589934591
1395ct	8589934591
1396-----	-----
1397Type	BIT(34)
1398Table	t2
1399Create Table	CREATE TABLE `t2` (
1400  `a` bit(34) DEFAULT NULL,
1401  `cf` bigint(11) unsigned DEFAULT NULL,
1402  `cc` bigint(11) unsigned DEFAULT NULL,
1403  `cr` bigint(11) unsigned DEFAULT NULL,
1404  `ct` bigint(11) unsigned DEFAULT NULL
1405) ENGINE=MyISAM DEFAULT CHARSET=latin1
1406a	17179869183
1407cf	17179869183
1408cc	17179869183
1409cr	17179869183
1410ct	17179869183
1411-----	-----
1412Type	BIT(35)
1413Table	t2
1414Create Table	CREATE TABLE `t2` (
1415  `a` bit(35) DEFAULT NULL,
1416  `cf` bigint(11) unsigned DEFAULT NULL,
1417  `cc` bigint(11) unsigned DEFAULT NULL,
1418  `cr` bigint(11) unsigned DEFAULT NULL,
1419  `ct` bigint(11) unsigned DEFAULT NULL
1420) ENGINE=MyISAM DEFAULT CHARSET=latin1
1421a	34359738367
1422cf	34359738367
1423cc	34359738367
1424cr	34359738367
1425ct	34359738367
1426-----	-----
1427Type	BIT(36)
1428Table	t2
1429Create Table	CREATE TABLE `t2` (
1430  `a` bit(36) DEFAULT NULL,
1431  `cf` bigint(11) unsigned DEFAULT NULL,
1432  `cc` bigint(11) unsigned DEFAULT NULL,
1433  `cr` bigint(11) unsigned DEFAULT NULL,
1434  `ct` bigint(11) unsigned DEFAULT NULL
1435) ENGINE=MyISAM DEFAULT CHARSET=latin1
1436a	68719476735
1437cf	68719476735
1438cc	68719476735
1439cr	68719476735
1440ct	68719476735
1441-----	-----
1442Type	BIT(37)
1443Table	t2
1444Create Table	CREATE TABLE `t2` (
1445  `a` bit(37) DEFAULT NULL,
1446  `cf` bigint(12) unsigned DEFAULT NULL,
1447  `cc` bigint(12) unsigned DEFAULT NULL,
1448  `cr` bigint(12) unsigned DEFAULT NULL,
1449  `ct` bigint(12) unsigned DEFAULT NULL
1450) ENGINE=MyISAM DEFAULT CHARSET=latin1
1451a	137438953471
1452cf	137438953471
1453cc	137438953471
1454cr	137438953471
1455ct	137438953471
1456-----	-----
1457Type	BIT(38)
1458Table	t2
1459Create Table	CREATE TABLE `t2` (
1460  `a` bit(38) DEFAULT NULL,
1461  `cf` bigint(12) unsigned DEFAULT NULL,
1462  `cc` bigint(12) unsigned DEFAULT NULL,
1463  `cr` bigint(12) unsigned DEFAULT NULL,
1464  `ct` bigint(12) unsigned DEFAULT NULL
1465) ENGINE=MyISAM DEFAULT CHARSET=latin1
1466a	274877906943
1467cf	274877906943
1468cc	274877906943
1469cr	274877906943
1470ct	274877906943
1471-----	-----
1472Type	BIT(39)
1473Table	t2
1474Create Table	CREATE TABLE `t2` (
1475  `a` bit(39) DEFAULT NULL,
1476  `cf` bigint(12) unsigned DEFAULT NULL,
1477  `cc` bigint(12) unsigned DEFAULT NULL,
1478  `cr` bigint(12) unsigned DEFAULT NULL,
1479  `ct` bigint(12) unsigned DEFAULT NULL
1480) ENGINE=MyISAM DEFAULT CHARSET=latin1
1481a	549755813887
1482cf	549755813887
1483cc	549755813887
1484cr	549755813887
1485ct	549755813887
1486-----	-----
1487Type	BIT(40)
1488Table	t2
1489Create Table	CREATE TABLE `t2` (
1490  `a` bit(40) DEFAULT NULL,
1491  `cf` bigint(13) unsigned DEFAULT NULL,
1492  `cc` bigint(13) unsigned DEFAULT NULL,
1493  `cr` bigint(13) unsigned DEFAULT NULL,
1494  `ct` bigint(13) unsigned DEFAULT NULL
1495) ENGINE=MyISAM DEFAULT CHARSET=latin1
1496a	1099511627775
1497cf	1099511627775
1498cc	1099511627775
1499cr	1099511627775
1500ct	1099511627775
1501-----	-----
1502Type	BIT(41)
1503Table	t2
1504Create Table	CREATE TABLE `t2` (
1505  `a` bit(41) DEFAULT NULL,
1506  `cf` bigint(13) unsigned DEFAULT NULL,
1507  `cc` bigint(13) unsigned DEFAULT NULL,
1508  `cr` bigint(13) unsigned DEFAULT NULL,
1509  `ct` bigint(13) unsigned DEFAULT NULL
1510) ENGINE=MyISAM DEFAULT CHARSET=latin1
1511a	2199023255551
1512cf	2199023255551
1513cc	2199023255551
1514cr	2199023255551
1515ct	2199023255551
1516-----	-----
1517Type	BIT(42)
1518Table	t2
1519Create Table	CREATE TABLE `t2` (
1520  `a` bit(42) DEFAULT NULL,
1521  `cf` bigint(13) unsigned DEFAULT NULL,
1522  `cc` bigint(13) unsigned DEFAULT NULL,
1523  `cr` bigint(13) unsigned DEFAULT NULL,
1524  `ct` bigint(13) unsigned DEFAULT NULL
1525) ENGINE=MyISAM DEFAULT CHARSET=latin1
1526a	4398046511103
1527cf	4398046511103
1528cc	4398046511103
1529cr	4398046511103
1530ct	4398046511103
1531-----	-----
1532Type	BIT(43)
1533Table	t2
1534Create Table	CREATE TABLE `t2` (
1535  `a` bit(43) DEFAULT NULL,
1536  `cf` bigint(13) unsigned DEFAULT NULL,
1537  `cc` bigint(13) unsigned DEFAULT NULL,
1538  `cr` bigint(13) unsigned DEFAULT NULL,
1539  `ct` bigint(13) unsigned DEFAULT NULL
1540) ENGINE=MyISAM DEFAULT CHARSET=latin1
1541a	8796093022207
1542cf	8796093022207
1543cc	8796093022207
1544cr	8796093022207
1545ct	8796093022207
1546-----	-----
1547Type	BIT(44)
1548Table	t2
1549Create Table	CREATE TABLE `t2` (
1550  `a` bit(44) DEFAULT NULL,
1551  `cf` bigint(14) unsigned DEFAULT NULL,
1552  `cc` bigint(14) unsigned DEFAULT NULL,
1553  `cr` bigint(14) unsigned DEFAULT NULL,
1554  `ct` bigint(14) unsigned DEFAULT NULL
1555) ENGINE=MyISAM DEFAULT CHARSET=latin1
1556a	17592186044415
1557cf	17592186044415
1558cc	17592186044415
1559cr	17592186044415
1560ct	17592186044415
1561-----	-----
1562Type	BIT(45)
1563Table	t2
1564Create Table	CREATE TABLE `t2` (
1565  `a` bit(45) DEFAULT NULL,
1566  `cf` bigint(14) unsigned DEFAULT NULL,
1567  `cc` bigint(14) unsigned DEFAULT NULL,
1568  `cr` bigint(14) unsigned DEFAULT NULL,
1569  `ct` bigint(14) unsigned DEFAULT NULL
1570) ENGINE=MyISAM DEFAULT CHARSET=latin1
1571a	35184372088831
1572cf	35184372088831
1573cc	35184372088831
1574cr	35184372088831
1575ct	35184372088831
1576-----	-----
1577Type	BIT(46)
1578Table	t2
1579Create Table	CREATE TABLE `t2` (
1580  `a` bit(46) DEFAULT NULL,
1581  `cf` bigint(14) unsigned DEFAULT NULL,
1582  `cc` bigint(14) unsigned DEFAULT NULL,
1583  `cr` bigint(14) unsigned DEFAULT NULL,
1584  `ct` bigint(14) unsigned DEFAULT NULL
1585) ENGINE=MyISAM DEFAULT CHARSET=latin1
1586a	70368744177663
1587cf	70368744177663
1588cc	70368744177663
1589cr	70368744177663
1590ct	70368744177663
1591-----	-----
1592Type	BIT(47)
1593Table	t2
1594Create Table	CREATE TABLE `t2` (
1595  `a` bit(47) DEFAULT NULL,
1596  `cf` bigint(15) unsigned DEFAULT NULL,
1597  `cc` bigint(15) unsigned DEFAULT NULL,
1598  `cr` bigint(15) unsigned DEFAULT NULL,
1599  `ct` bigint(15) unsigned DEFAULT NULL
1600) ENGINE=MyISAM DEFAULT CHARSET=latin1
1601a	140737488355327
1602cf	140737488355327
1603cc	140737488355327
1604cr	140737488355327
1605ct	140737488355327
1606-----	-----
1607Type	BIT(48)
1608Table	t2
1609Create Table	CREATE TABLE `t2` (
1610  `a` bit(48) DEFAULT NULL,
1611  `cf` bigint(15) unsigned DEFAULT NULL,
1612  `cc` bigint(15) unsigned DEFAULT NULL,
1613  `cr` bigint(15) unsigned DEFAULT NULL,
1614  `ct` bigint(15) unsigned DEFAULT NULL
1615) ENGINE=MyISAM DEFAULT CHARSET=latin1
1616a	281474976710655
1617cf	281474976710655
1618cc	281474976710655
1619cr	281474976710655
1620ct	281474976710655
1621-----	-----
1622Type	BIT(49)
1623Table	t2
1624Create Table	CREATE TABLE `t2` (
1625  `a` bit(49) DEFAULT NULL,
1626  `cf` bigint(15) unsigned DEFAULT NULL,
1627  `cc` bigint(15) unsigned DEFAULT NULL,
1628  `cr` bigint(15) unsigned DEFAULT NULL,
1629  `ct` bigint(15) unsigned DEFAULT NULL
1630) ENGINE=MyISAM DEFAULT CHARSET=latin1
1631a	562949953421311
1632cf	562949953421311
1633cc	562949953421311
1634cr	562949953421311
1635ct	562949953421311
1636-----	-----
1637Type	BIT(50)
1638Table	t2
1639Create Table	CREATE TABLE `t2` (
1640  `a` bit(50) DEFAULT NULL,
1641  `cf` bigint(16) unsigned DEFAULT NULL,
1642  `cc` bigint(16) unsigned DEFAULT NULL,
1643  `cr` bigint(16) unsigned DEFAULT NULL,
1644  `ct` bigint(16) unsigned DEFAULT NULL
1645) ENGINE=MyISAM DEFAULT CHARSET=latin1
1646a	1125899906842623
1647cf	1125899906842623
1648cc	1125899906842623
1649cr	1125899906842623
1650ct	1125899906842623
1651-----	-----
1652Type	BIT(51)
1653Table	t2
1654Create Table	CREATE TABLE `t2` (
1655  `a` bit(51) DEFAULT NULL,
1656  `cf` bigint(16) unsigned DEFAULT NULL,
1657  `cc` bigint(16) unsigned DEFAULT NULL,
1658  `cr` bigint(16) unsigned DEFAULT NULL,
1659  `ct` bigint(16) unsigned DEFAULT NULL
1660) ENGINE=MyISAM DEFAULT CHARSET=latin1
1661a	2251799813685247
1662cf	2251799813685247
1663cc	2251799813685247
1664cr	2251799813685247
1665ct	2251799813685247
1666-----	-----
1667Type	BIT(52)
1668Table	t2
1669Create Table	CREATE TABLE `t2` (
1670  `a` bit(52) DEFAULT NULL,
1671  `cf` bigint(16) unsigned DEFAULT NULL,
1672  `cc` bigint(16) unsigned DEFAULT NULL,
1673  `cr` bigint(16) unsigned DEFAULT NULL,
1674  `ct` bigint(16) unsigned DEFAULT NULL
1675) ENGINE=MyISAM DEFAULT CHARSET=latin1
1676a	4503599627370495
1677cf	4503599627370495
1678cc	4503599627370495
1679cr	4503599627370495
1680ct	4503599627370495
1681-----	-----
1682Type	BIT(53)
1683Table	t2
1684Create Table	CREATE TABLE `t2` (
1685  `a` bit(53) DEFAULT NULL,
1686  `cf` bigint(16) unsigned DEFAULT NULL,
1687  `cc` bigint(16) unsigned DEFAULT NULL,
1688  `cr` bigint(16) unsigned DEFAULT NULL,
1689  `ct` bigint(16) unsigned DEFAULT NULL
1690) ENGINE=MyISAM DEFAULT CHARSET=latin1
1691a	9007199254740991
1692cf	9007199254740991
1693cc	9007199254740991
1694cr	9007199254740991
1695ct	9007199254740991
1696-----	-----
1697Type	BIT(54)
1698Table	t2
1699Create Table	CREATE TABLE `t2` (
1700  `a` bit(54) DEFAULT NULL,
1701  `cf` bigint(17) unsigned DEFAULT NULL,
1702  `cc` bigint(17) unsigned DEFAULT NULL,
1703  `cr` bigint(17) unsigned DEFAULT NULL,
1704  `ct` bigint(17) unsigned DEFAULT NULL
1705) ENGINE=MyISAM DEFAULT CHARSET=latin1
1706a	18014398509481983
1707cf	18014398509481983
1708cc	18014398509481983
1709cr	18014398509481983
1710ct	18014398509481983
1711-----	-----
1712Type	BIT(55)
1713Table	t2
1714Create Table	CREATE TABLE `t2` (
1715  `a` bit(55) DEFAULT NULL,
1716  `cf` bigint(17) unsigned DEFAULT NULL,
1717  `cc` bigint(17) unsigned DEFAULT NULL,
1718  `cr` bigint(17) unsigned DEFAULT NULL,
1719  `ct` bigint(17) unsigned DEFAULT NULL
1720) ENGINE=MyISAM DEFAULT CHARSET=latin1
1721a	36028797018963967
1722cf	36028797018963967
1723cc	36028797018963967
1724cr	36028797018963967
1725ct	36028797018963967
1726-----	-----
1727Type	BIT(56)
1728Table	t2
1729Create Table	CREATE TABLE `t2` (
1730  `a` bit(56) DEFAULT NULL,
1731  `cf` bigint(17) unsigned DEFAULT NULL,
1732  `cc` bigint(17) unsigned DEFAULT NULL,
1733  `cr` bigint(17) unsigned DEFAULT NULL,
1734  `ct` bigint(17) unsigned DEFAULT NULL
1735) ENGINE=MyISAM DEFAULT CHARSET=latin1
1736a	72057594037927935
1737cf	72057594037927935
1738cc	72057594037927935
1739cr	72057594037927935
1740ct	72057594037927935
1741-----	-----
1742Type	BIT(57)
1743Table	t2
1744Create Table	CREATE TABLE `t2` (
1745  `a` bit(57) DEFAULT NULL,
1746  `cf` bigint(18) unsigned DEFAULT NULL,
1747  `cc` bigint(18) unsigned DEFAULT NULL,
1748  `cr` bigint(18) unsigned DEFAULT NULL,
1749  `ct` bigint(18) unsigned DEFAULT NULL
1750) ENGINE=MyISAM DEFAULT CHARSET=latin1
1751a	144115188075855871
1752cf	144115188075855871
1753cc	144115188075855871
1754cr	144115188075855871
1755ct	144115188075855871
1756-----	-----
1757Type	BIT(58)
1758Table	t2
1759Create Table	CREATE TABLE `t2` (
1760  `a` bit(58) DEFAULT NULL,
1761  `cf` bigint(18) unsigned DEFAULT NULL,
1762  `cc` bigint(18) unsigned DEFAULT NULL,
1763  `cr` bigint(18) unsigned DEFAULT NULL,
1764  `ct` bigint(18) unsigned DEFAULT NULL
1765) ENGINE=MyISAM DEFAULT CHARSET=latin1
1766a	288230376151711743
1767cf	288230376151711743
1768cc	288230376151711743
1769cr	288230376151711743
1770ct	288230376151711743
1771-----	-----
1772Type	BIT(59)
1773Table	t2
1774Create Table	CREATE TABLE `t2` (
1775  `a` bit(59) DEFAULT NULL,
1776  `cf` bigint(18) unsigned DEFAULT NULL,
1777  `cc` bigint(18) unsigned DEFAULT NULL,
1778  `cr` bigint(18) unsigned DEFAULT NULL,
1779  `ct` bigint(18) unsigned DEFAULT NULL
1780) ENGINE=MyISAM DEFAULT CHARSET=latin1
1781a	576460752303423487
1782cf	576460752303423487
1783cc	576460752303423487
1784cr	576460752303423487
1785ct	576460752303423487
1786-----	-----
1787Type	BIT(60)
1788Table	t2
1789Create Table	CREATE TABLE `t2` (
1790  `a` bit(60) DEFAULT NULL,
1791  `cf` bigint(19) unsigned DEFAULT NULL,
1792  `cc` bigint(19) unsigned DEFAULT NULL,
1793  `cr` bigint(19) unsigned DEFAULT NULL,
1794  `ct` bigint(19) unsigned DEFAULT NULL
1795) ENGINE=MyISAM DEFAULT CHARSET=latin1
1796a	1152921504606846975
1797cf	1152921504606846975
1798cc	1152921504606846975
1799cr	1152921504606846975
1800ct	1152921504606846975
1801-----	-----
1802Type	BIT(61)
1803Table	t2
1804Create Table	CREATE TABLE `t2` (
1805  `a` bit(61) DEFAULT NULL,
1806  `cf` bigint(19) unsigned DEFAULT NULL,
1807  `cc` bigint(19) unsigned DEFAULT NULL,
1808  `cr` bigint(19) unsigned DEFAULT NULL,
1809  `ct` bigint(19) unsigned DEFAULT NULL
1810) ENGINE=MyISAM DEFAULT CHARSET=latin1
1811a	2305843009213693951
1812cf	2305843009213693951
1813cc	2305843009213693951
1814cr	2305843009213693951
1815ct	2305843009213693951
1816-----	-----
1817Type	BIT(62)
1818Table	t2
1819Create Table	CREATE TABLE `t2` (
1820  `a` bit(62) DEFAULT NULL,
1821  `cf` bigint(19) unsigned DEFAULT NULL,
1822  `cc` bigint(19) unsigned DEFAULT NULL,
1823  `cr` bigint(19) unsigned DEFAULT NULL,
1824  `ct` bigint(19) unsigned DEFAULT NULL
1825) ENGINE=MyISAM DEFAULT CHARSET=latin1
1826a	4611686018427387903
1827cf	4611686018427387903
1828cc	4611686018427387903
1829cr	4611686018427387903
1830ct	4611686018427387903
1831-----	-----
1832Type	BIT(63)
1833Table	t2
1834Create Table	CREATE TABLE `t2` (
1835  `a` bit(63) DEFAULT NULL,
1836  `cf` bigint(19) unsigned DEFAULT NULL,
1837  `cc` bigint(19) unsigned DEFAULT NULL,
1838  `cr` bigint(19) unsigned DEFAULT NULL,
1839  `ct` bigint(19) unsigned DEFAULT NULL
1840) ENGINE=MyISAM DEFAULT CHARSET=latin1
1841a	9223372036854775807
1842cf	9223372036854775807
1843cc	9223372036854775807
1844cr	9223372036854775807
1845ct	9223372036854775807
1846-----	-----
1847Type	BIT(64)
1848Table	t2
1849Create Table	CREATE TABLE `t2` (
1850  `a` bit(64) DEFAULT NULL,
1851  `cf` bigint(20) unsigned DEFAULT NULL,
1852  `cc` bigint(20) unsigned DEFAULT NULL,
1853  `cr` bigint(20) unsigned DEFAULT NULL,
1854  `ct` bigint(20) unsigned DEFAULT NULL
1855) ENGINE=MyISAM DEFAULT CHARSET=latin1
1856a	18446744073709551615
1857cf	18446744073709551615
1858cc	18446744073709551615
1859cr	18446744073709551615
1860ct	18446744073709551615
1861#
1862# End of 10.4 tests
1863#
1864