# # Simple test for the partition storage engine # with most datatypes and null / not null # as partition by key # Created to verify the fix for Bug#31705 # Partitions: crash if varchar length > 65530 # -- source include/have_partition.inc --disable_warnings drop table if exists t1; --enable_warnings -- echo # test with not null create table t1 (a bit not null) partition by key (a); insert into t1 values (b'1'); select hex(a) from t1 where a = b'1'; drop table t1; create table t1 (a tinyint not null) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a smallint not null) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a mediumint not null) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a int not null) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a bigint not null) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a float not null) partition by key (a); insert into t1 values (0.5); select * from t1 where a = 0.5; drop table t1; create table t1 (a double not null) partition by key (a); insert into t1 values (0.5); select * from t1 where a = 0.5; drop table t1; create table t1 (a decimal(4,2) not null) partition by key (a); insert into t1 values (2.1); select * from t1 where a = 2.1; drop table t1; create table t1 (a date not null) partition by key (a); insert into t1 values ('2001-01-01'); select * from t1 where a = '2001-01-01'; drop table t1; create table t1 (a datetime not null) partition by key (a); insert into t1 values ('2001-01-01 01:02:03'); select * from t1 where a = '2001-01-01 01:02:03'; drop table t1; create table t1 (a timestamp not null) partition by key (a); insert into t1 values ('2001-01-01 01:02:03'); select * from t1 where a = '2001-01-01 01:02:03'; drop table t1; create table t1 (a time not null) partition by key (a); insert into t1 values ('01:02:03'); select * from t1 where a = '01:02:03'; drop table t1; create table t1 (a year not null) partition by key (a); insert into t1 values ('2001'); select * from t1 where a = '2001'; drop table t1; create table t1 (a varchar(10) character set utf8 not null) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a varchar(300) character set utf8 not null) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a varchar(10) character set latin1 not null) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a varchar(300) character set latin1 not null) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a char(10) character set utf8 not null) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a char(10) character set latin1 not null) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a enum('y','n') not null) partition by key (a); insert into t1 values ('y'); select * from t1 where a = 'y'; drop table t1; create table t1 (a set('y','n') not null) partition by key (a); insert into t1 values ('y'); select * from t1 where a = 'y'; drop table t1; -- echo # test with null allowed create table t1 (a bit) partition by key (a); insert into t1 values (b'1'); insert into t1 values (NULL); select hex(a) from t1 where a = b'1'; select hex(a) from t1 where a is NULL; select hex(a) from t1 order by a; drop table t1; create table t1 (a tinyint) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a smallint) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a mediumint) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a int) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a bigint) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a float) partition by key (a); insert into t1 values (0.5); select * from t1 where a = 0.5; drop table t1; create table t1 (a double) partition by key (a); insert into t1 values (0.5); select * from t1 where a = 0.5; drop table t1; create table t1 (a decimal(4,2)) partition by key (a); insert into t1 values (2.1); select * from t1 where a = 2.1; drop table t1; create table t1 (a date) partition by key (a); insert into t1 values ('2001-01-01'); select * from t1 where a = '2001-01-01'; drop table t1; create table t1 (a datetime) partition by key (a); insert into t1 values ('2001-01-01 01:02:03'); select * from t1 where a = '2001-01-01 01:02:03'; drop table t1; create table t1 (a timestamp null) partition by key (a); insert into t1 values ('2001-01-01 01:02:03'); select * from t1 where a = '2001-01-01 01:02:03'; drop table t1; create table t1 (a time) partition by key (a); insert into t1 values ('01:02:03'); select * from t1 where a = '01:02:03'; drop table t1; create table t1 (a year) partition by key (a); insert into t1 values ('2001'); select * from t1 where a = '2001'; drop table t1; create table t1 (a varchar(10) character set utf8) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a varchar(300) character set utf8) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a varchar(10) character set latin1) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a varchar(300) character set latin1) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a char(10) character set utf8) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a char(10) character set latin1) partition by key (a); insert into t1 values ('abc'); select * from t1 where a = 'abc'; drop table t1; create table t1 (a enum('y','n')) partition by key (a); insert into t1 values ('y'); select * from t1 where a = 'y'; drop table t1; create table t1 (a set('y','n')) partition by key (a); insert into t1 values ('y'); select * from t1 where a = 'y'; drop table t1; create table t1 (a varchar(65531)) partition by key (a); insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); select * from t1 where a = 'aaaa'; select * from t1 where a like 'aaa%'; select * from t1 where a = 'bbbb'; drop table t1; create table t1 (a varchar(65532)) partition by key (a); insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); select * from t1 where a = 'aaaa'; select * from t1 where a like 'aaa%'; select * from t1 where a = 'bbbb'; drop table t1; create table t1 (a varchar(65533) not null) partition by key (a); insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); select * from t1 where a = 'aaaa'; select * from t1 where a like 'aaa%'; select * from t1 where a = 'bbbb'; drop table t1; -- error ER_TOO_BIG_ROWSIZE create table t1 (a varchar(65533)) partition by key (a); -- error ER_TOO_BIG_ROWSIZE create table t1 (a varchar(65534) not null) partition by key (a); -- error ER_TOO_BIG_ROWSIZE create table t1 (a varchar(65535)) partition by key (a); # # Bug#34358: error in key_restore for bitfields with uneven bits # create table t1 (a bit(27), primary key (a)) engine=myisam partition by hash (a) (partition p0, partition p1, partition p2); show create table t1; insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34); select hex(a) from t1 where a = 7; drop table t1;