MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
partition_bit.inc
1 --disable_warnings
2 drop table if exists t1;
3 --enable_warnings
4 
5 --error ER_TOO_BIG_DISPLAYWIDTH
6 eval create table t1 (a bit(65), primary key (a)) engine=$engine partition by key (a);
7 
8 eval create table t1 (a bit(0), primary key (a)) engine=$engine partition by key (a);
9 show create table t1;
10 drop table t1;
11 
12 eval create table t1 (a bit(0), primary key (a)) engine=$engine
13 partition by key (a) (
14 partition pa1,
15 partition pa2);
16 show create table t1;
17 drop table t1;
18 
19 eval create table t1 (a bit(64), primary key (a)) engine=$engine
20 partition by key (a) partitions 2;
21 show create table t1;
22 insert into t1 values
23 (b'1111111111111111111111111111111111111111111111111111111111111111'),
24 (b'1000000000000000000000000000000000000000000000000000000000000000'),
25 (b'0000000000000000000000000000000000000000000000000000000000000001'),
26 (b'1010101010101010101010101010101010101010101010101010101010101010'),
27 (b'0101010101010101010101010101010101010101010101010101010101010101');
28 --sorted_result
29 select hex(a) from t1;
30 drop table t1;
31 
32 eval create table t1 (a bit(64), primary key (a)) engine=$engine
33 partition by key (a) (
34 partition pa1 max_rows=20 min_rows=2,
35 partition pa2 max_rows=30 min_rows=3,
36 partition pa3 max_rows=30 min_rows=4,
37 partition pa4 max_rows=40 min_rows=2);
38 show create table t1;
39 insert into t1 values
40 (b'1111111111111111111111111111111111111111111111111111111111111111'),
41 (b'1000000000000000000000000000000000000000000000000000000000000000'),
42 (b'0000000000000000000000000000000000000000000000000000000000000001'),
43 (b'1010101010101010101010101010101010101010101010101010101010101010'),
44 (b'0101010101010101010101010101010101010101010101010101010101010101');
45 select hex(a) from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101';
46 delete from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101';
47 --sorted_result
48 select hex(a) from t1;
49 drop table t1;
50 
51 eval create table t2 (a bit, primary key (a)) engine=$engine
52 partition by key (a) partitions 4;
53 show create table t2;
54 insert into t2 values (b'0'), (b'1');
55 --sorted_result
56 select hex(a) from t2;
57 alter table t2 drop primary key;
58 show create table t2;
59 --sorted_result
60 select hex(a) from t2;
61 alter table t2 add primary key (a);
62 show create table t2;
63 --sorted_result
64 select hex(a) from t2;
65 drop table t2;
66 
67 eval create table t3 (a bit(8), primary key (a)) engine=$engine
68 partition by range (a) subpartition by key (a) subpartitions 2 (
69 partition pa1 values less than (3),
70 partition pa2 values less than (16),
71 partition pa3 values less than (64),
72 partition pa4 values less than (256));
73 show create table t3;
74 let $count=255;
75 --echo $count inserts;
76 --disable_query_log
77 while ($count)
78 {
79 eval insert into t3 values ($count);
80 dec $count;
81 }
82 --enable_query_log
83 select hex(a) from t3 where a=b'01010101';
84 delete from t3 where a=b'01010101';
85 select count(*) from t3;
86 --sorted_result
87 select hex(a) from t3;
88 drop table t3;
89 
90 eval create table t4 (a bit(8), primary key (a)) engine=$engine
91 partition by list (a) subpartition by key (a) subpartitions 2 (
92 partition pa1 values in (0,1,2,3),
93 partition pa2 values in (4,5,6,7,8,9,10,11,12,13,14,15,16),
94 partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32));
95 show create table t4;
96 let $count=32;
97 --echo $count inserts;
98 --disable_query_log
99 while ($count)
100 {
101 eval insert into t4 values ($count);
102 dec $count;
103 }
104 --enable_query_log
105 select hex(a) from t4 where a=b'00000001';
106 delete from t4 where a=b'00000001';
107 select count(*) from t4;
108 --sorted_result
109 select hex(a) from t4;
110 drop table t4;