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