Debian Codegraph @

mysql-test/suite/parts/inc/partition_enum.inc

raw
1 --echo ---- Partitioning and enum data type
2
3 eval create table t1 (a enum('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine
4 partition by key (a) (
5 partition pa1 max_rows=20 min_rows=2,
6 partition pa2 max_rows=30 min_rows=3,
7 partition pa3 max_rows=30 min_rows=4,
8 partition pa4 max_rows=40 min_rows=2);
9 show create table t1;
10 insert into t1 values ('A'),('D'),('L'),('G');
11 --sorted_result
12 select * from t1;
13 select * from t1 where a='A';
14 update t1 set a='E' where a='L';
15 select * from t1;
16 delete from t1 where a='E';
17 --sorted_result
18 select * from t1;
19 drop table t1;
20
21 eval create table t2 (a enum (
22 '1','2','3','4','5','6','7','8','9','0',
23 'A','B','C','D','E','F','G','H','I','J','K','L',
24 'M','N','O','P','Q','R','S','T','U','V','W','X',
25 'Y','Z'
26 ) not null, primary key(a)) engine=$engine
27 partition by key (a) partitions 27;
28 show create table t2;
29 let $letter=26;
30 --echo $count inserts;
31 --disable_query_log
32 begin;
33 while ($letter)
34 {
35 eval insert ignore into t2 values (char(ascii('A')+$letter));
36 dec $letter;
37 }
38 commit;
39 --enable_query_log
40 insert into t2 values ('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'),('0');
41 select count(*) from t2;
42 --sorted_result
43 select * from t2;
44 drop table t2;
45
46 # mleich: Several partitioning functions are no more allowed.
47 if (0)
48 {
49 eval create table t3 (a enum (
50 '1','2','3','4','5','6','7','8','9','0',
51 'A','B','C','D','E','F','G','H','I','J','K','L',
52 'M','N','O','P','Q','R','S','T','U','V','W','X',
53 'Y','Z'
54 ) not null, primary key(a)) engine=$engine
55 partition by range (a) subpartition by key (a) subpartitions 3 (
56 partition pa9 values less than (10),
57 partition pa18 values less than (19),
58 partition pa27 values less than (28),
59 partition pa36 values less than (37)
60 );
61 show create table t3;
62 let $letter=36;
63 --echo $count inserts;
64 --disable_query_log
65 begin;
66 while ($letter)
67 {
68 #eval insert into t3 values ($letter);
69 dec $letter;
70 }
71 commit;
72 --enable_query_log
73 select count(*) from t3;
74 select * from t3;
75 drop table t3;
76 }
77 # End of tests with disallowed partitioning functions.